SemaDB API (2.0.0)

Download OpenAPI specification:Download

No fuss vector database for AI

This API provides a way to interact with a vector database, which is a type of database that stores data as high-dimensional vectors. Vectors are mathematical representations of features or attributes, and each vector has a certain number of dimensions, which can range from tens to thousands. Vector databases are used for a variety of tasks, such as similarity search, recommendation systems, and anomaly detection. They are particularly well-suited for tasks involving unstructured data, such as text, images, and audio.

Collection

A collection is a group of points that share the same search space. For example, a collection could be a group of images, where each image is represented as a vector. The collection would be the search space for similarity search, and each image would be a point in that search space.

Create a new collection

Creates a new collection if it does not already exist. The maximum number of collections per user is restricted based on the plan. Before you can insert and search points, you must create a collection.

Request Body schema: application/json
required

The collection to create

id
string (CollectionId) ^[a-z0-9]{3,24}$

The unique identifier of the collection

object (IndexSchema) non-empty

The schema for the collection, each property can be indexed with a different type of index.

Responses

Request samples

Content type
application/json

A sample collection to create with id mycollection, vector size 2 and euclidean distance.

{
  • "id": "mycollection",
  • "indexSchema": {
    }
}

Response samples

Content type
application/json

The operation was successful

{
  • "message": "success"
}

List user collections

Returns a list of all collections for the current user. The list is not sorted by any value and the order may change between requests.

Responses

Response samples

Content type
application/json

A sample collection list with one collection

{
  • "collections": [
    ]
}

Get the details of a collection

This endpoint attempts to also list the shards currently available in the collection. Some shards may be temporarily unavailable. In that case, you can retry at a future time.

path Parameters
collectionId
required
string (Collection Id) ^[a-z0-9]{3,24}$
Example: mycollection

The unique identifier of the collection

Responses

Response samples

Content type
application/json

A sample collection with shard information

{
  • "id": "mycollection",
  • "indexSchema": {
    },
  • "shards": [
    ]
}

Delete a collection

Deletes a collection and all of its points. This operation is irreversible. If you want to delete only some points, use the bulk delete endpoint. If some shards are temporarily unavailable, the operation will still succeed, but some of the data will be deleted in the future.

path Parameters
collectionId
required
string (Collection Id) ^[a-z0-9]{3,24}$
Example: mycollection

The unique identifier of the collection

Responses

Response samples

Content type
application/json

The operation was successful

{
  • "message": "success"
}

Point

A point is a vector with a unique identifier. It can also contain any JSON serialisable metadata such as an external ID, document title or image URL.

Insert new points into the collection

This endpoint assumes all points to be inserted are new points and does not check for duplication. It is important to ensure consistency of the database you do not insert duplicate points. If you are unsure if a point exists, you can leave the id field blank and the database will assign a new id. For cosine distance, you must normalise the vectors prior to inserting them.

path Parameters
collectionId
required
string (Collection Id) ^[a-z0-9]{3,24}$
Example: mycollection

The unique identifier of the collection

Request Body schema: application/json
required

Points to insert

required
Array of objects (PointAsObject) <= 10000 items

Responses

Request samples

Content type
application/json

A sample list of points to insert

{
  • "points": [
    ]
}

Response samples

Content type
application/json
Example

A sample response indicating full success

{
  • "message": "success",
  • "failedRanges": [ ]
}

Update existing points with new data

This endpoint allows updating point vectors and metadata. It does not allow updating the point id. If you want to update the id, you must delete the point and insert a new point. The points are required to exist before you can update them. You can check the failedPoints to see which points failed to update and potentially why.

path Parameters
collectionId
required
string (Collection Id) ^[a-z0-9]{3,24}$
Example: mycollection

The unique identifier of the collection

Request Body schema: application/json
required

Points to update

required
Array of objects (PointAsObject) <= 100 items

Responses

Request samples

Content type
application/json

A sample list of points to update

{
  • "points": [
    ]
}

Response samples

Content type
application/json
Example

A sample response indicating full success

{
  • "message": "success",
  • "failedPoints": [ ]
}

Delete points by id

Bulk delete points based on id. This endpoint does not check if the points exist. If you attempt to delete a point that does not exist, it will be ignored and included in the failedPoints list.

path Parameters
collectionId
required
string (Collection Id) ^[a-z0-9]{3,24}$
Example: mycollection

The unique identifier of the collection

Request Body schema: application/json
required

Point IDs to delete

ids
required
Array of strings <uuid> <= 100 items [ items <uuid > ]

Responses

Request samples

Content type
application/json

A sample list of point ids to delete

{
  • "ids": [
    ]
}

Response samples

Content type
application/json
Example

A sample response indicating full success

{
  • "message": "success",
  • "failedPoints": [ ]
}

Fast index based search

This endpoint allows searching for points in a collection using the index. The search is based on the index schema of the collection.

path Parameters
collectionId
required
string (Collection Id) ^[a-z0-9]{3,24}$
Example: mycollection

The unique identifier of the collection

Request Body schema: application/json
required

Search request

required
object (Query)

A query object that can be used to perform search. The query object can contain multiple filters, each with a property and a value. Use _and and _or to combine queries.

select
Array of strings

A list of properties to return in the search results. If not provided, all properties are returned.

Array of objects (SortOption) <= 10 items

A list of sort options for the search results. The search results are sorted by the first sort option, then the second, and so on.

offset
number >= 0
Default: 0

The number of points to skip in the search results

limit
required
number [ 1 .. 100 ]
Default: 10

Maximum number of points to return

Responses

Request samples

Content type
application/json

A sample vector to search with default limit

{
  • "query": {
    },
  • "limit": 10
}

Response samples

Content type
application/json

A sample response with two points

{
  • "points": [
    ]
}