API Reference

You can get a token from here and try out our API.

Health

get
/v1/health/
Responses
get
/v1/health/
200

OK

No content

Search

post
/v1/search/

Search for pages similar to a given query.

This endpoint allows the user to search for pages similar to a given query. The search is performed across all documents in the specified collection.

Args: request: The HTTP request object, which includes the user information. payload (QueryIn): The input data for the search, which includes the query string and collection ID.

Returns: QueryOut: The search results, including the query and a list of similar pages.

Raises: HttpError: If the collection does not exist or the query is invalid.

Example: POST /search/ { "query": "dog", "collection_name": "my_collection", "top_k": 3, "query_filter": { "on": "document", "key": "breed", "value": "collie", "lookup": "contains" } }

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
querystringRequired
collection_nameany ofOptionalDefault: all
stringOptional
or
nullOptional
top_kany ofOptionalDefault: 3
integerOptional
or
nullOptional
query_filterany ofOptional
or
nullOptional
Responses
post
/v1/search/

Search Image

post
/v1/search-image/

Search for pages similar to a given image.

This endpoint allows the user to search for pages similar to a given image. The search is performed across all documents in the specified collection.

Args: request: The HTTP request object, which includes the user information. payload (SearchImageIn): The input data for the search, which includes the image in base64 format and collection ID.

Returns: SearchImageOut: The search results, a list of similar pages.

Raises: HttpError: If the collection does not exist or the img_base64 is invalid.

Example: POST /search-image/ { "img_base64": "base64_string", "collection_name": "my_collection", "top_k": 3, "query_filter": { "on": "document", "key": "breed", "value": "collie", "lookup": "contains" } }

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
img_base64stringRequired
collection_nameany ofOptionalDefault: all
stringOptional
or
nullOptional
top_kany ofOptionalDefault: 3
integerOptional
or
nullOptional
query_filterany ofOptional
or
nullOptional
Responses
post
/v1/search-image/

Upsert Document

post
/v1/documents/upsert-document/

Create or update a document in a collection. Average latency is 7 seconds per page.

This endpoint allows the user to create or update a document in a collection. The document can be provided as a URL or a base64-encoded string. if the collection is not provided, a collection named "default_collection" will be used. if the collection is provided, it will be created if it does not exist.

Args: request: The HTTP request object, which includes the user information. payload (DocumentIn): The input data for creating or updating the document.

Returns: str: A message indicating that the document is being processed.

Raises: HttpError: If the document cannot be created or updated.

Example: POST /documents/upsert-document/ { "name": "my_document", "metadata": {"author": "John Doe"}, "collection": "my_collection", "url": "https://example.com/my_document.pdf, "wait": true # optional, if true, the response will be sent after waiting for the document to be processed. Otherwise, it will be done asynchronously. }

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
namestringRequired
collection_namestringOptional

The name of the collection to which the document belongs. If not provided, the document will be added to the default_collection. Use 'all' to access all collections belonging to the user.

Default: default_collection
urlany ofOptional
stringOptional
or
nullOptional
base64any ofOptional
stringOptional
or
nullOptional
waitany ofOptionalDefault: false
booleanOptional
or
nullOptional
use_proxyany ofOptionalDefault: false
booleanOptional
or
nullOptional
Responses
202

Accepted

application/json
post
/v1/documents/upsert-document/

List Collections

get
/v1/collections/

Endpoint to list collections.

This endpoint retrieves a list of collections owned by the authenticated user.

Args: request: The request object containing authentication information.

Returns: A list of CollectionOut objects representing the collections owned by the authenticated user.

Raises: HTTPException: If there is an issue with the request or authentication.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Responses
get
/v1/collections/
200

OK

Get Collection

get
/v1/collections/{collection_name}/

Retrieve a collection by its name.

Args: request: The request object containing authentication information. collection_name (str): The name of the collection to retrieve.

Returns: CollectionOut: The retrieved collection with its ID, name, and metadata.

Raises: HTTPException: If the collection is not found or the user is not authorized to access it.

Endpoint: GET /collections/{collection_name}

Tags: collections

Authentication: Bearer token required.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
collection_namestringRequired
Responses
get
/v1/collections/{collection_name}/

Partial Update Collection

patch
/v1/collections/{collection_name}/

Partially update a collection.

This endpoint allows for partial updates to a collection's details. Only the fields provided in the payload will be updated.

Args: request: The request object containing authentication details. collection_name (str): The name of the collection to be updated. payload (PatchCollectionIn): The payload containing the fields to be updated.

Returns: dict: A message indicating the collection was updated successfully.

Raises: HTTPException: If the collection is not found or the user is not authorized to update it.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
collection_namestringRequired
Body
nameany ofOptional
stringOptional
or
nullOptional
metadataany ofOptional
or
nullOptional
Responses
patch
/v1/collections/{collection_name}/

Delete Collection

delete
/v1/collections/{collection_name}/

Delete a collection by its name.

This endpoint deletes a collection specified by the collection_name parameter. The collection must belong to the authenticated user.

Args: request: The HTTP request object, which includes authentication information. collection_id (int): The ID of the collection to be deleted.

Returns: dict: A message indicating that the collection was deleted successfully.

Raises: HTTPException: If the collection does not exist or does not belong to the authenticated user.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
collection_namestringRequired
Responses
delete
/v1/collections/{collection_name}/

No content

Get Document

get
/v1/documents/{document_name}/

Retrieve a specific document from the user documents. Default collection is "default_collection". To get all documents, use collection_name="all".

Args: request: The HTTP request object. document_name (str): The ID of the document to retrieve. expand (Optional[str]): A comma-separated list of fields to expand in the response. If "pages" is included, the document's pages will be included.

Returns: DocumentOut: The retrieved document with its details.

Raises: HTTPException: If the document or collection is not found.

Example: GET /documents/{document_name}/?collection_name={collection_name}&expand=pages

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
document_namestringRequired
Query parameters
collection_nameany ofOptionalDefault: default_collection
stringOptional
or
nullOptional
expandany ofOptional
stringOptional
or
nullOptional
Responses
get
/v1/documents/{document_name}/

Partial Update Document

patch
/v1/documents/{document_name}/

Partially update a document.

This endpoint allows for partial updates to a document's details. Only the fields provided in the payload will be updated. If the URL is changed or base64 is provided, the document will be re-embedded. Otherwise, only the metadata and name will be updated.

Args: request: The request object containing authentication details. document_name (str): The name of the document to be updated. payload (DocumentInPatch): The payload containing the fields to be updated.

Returns: Tuple[int, DocumentOut] | Tuple[int, GenericError]: A tuple containing the status code and the updated document or an error message.

Raises: HTTPException: If the document is not found or the user is not authorized to update it.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
document_namestringRequired
Body
nameany ofOptional
stringOptional
or
nullOptional
metadataany ofOptional
or
nullOptional
collection_nameany ofOptional

The name of the collection to which the document belongs. If not provided, the document will be added to the default_collection. Use 'all' to access all collections belonging to the user.

Default: default_collection
stringOptional
or
nullOptional
urlany ofOptional
stringOptional
or
nullOptional
base64any ofOptional
stringOptional
or
nullOptional
use_proxyany ofOptionalDefault: false
booleanOptional
or
nullOptional
Responses
patch
/v1/documents/{document_name}/

List Documents

get
/v1/documents/

Fetch a list of documents for a given collection.

This endpoint retrieves documents associated with a specified collection name. Optionally, it can expand the response to include pages of each document.

Args: request (Request): The request object. collection_name (Optional[str]): The name of the collection to fetch documents from. Defaults to "default_collection". Use "all" to fetch documents from all collections. expand (Optional[str]): A comma-separated string specifying additional fields to include in the response. If "pages" is included, the pages of each document will be included.

Returns: List[DocumentOut]: A list of documents with their details. If expanded, includes pages of each document.

Raises: HTTPException: If the collection or documents are not found.

Example: GET /documents/?collection_name=default_collection&expand=pages

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
collection_nameany ofOptionalDefault: default_collection
stringOptional
or
nullOptional
expandany ofOptional
stringOptional
or
nullOptional
Responses
get
/v1/documents/
200

OK

Delete Document

delete
/v1/documents/delete-document/{document_name}/

Delete a document by its Name.

This endpoint deletes a document specified by the document_name parameter. The document must belong to the authenticated user.

Args: request: The HTTP request object, which includes authentication information. collection_name (name): The name of the collection containing the document. Defaults to "default_collection". Use "all" to access all collections belonging to the user. document_name (int): The name of the document to be deleted.

Returns: dict: A message indicating that the document was deleted successfully.

Raises: HTTPException: If the document does not exist or does not belong to the authenticated user.

Example: DELETE /documents/delete-document/{document_name}/?collection_name={collection_name}

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
document_namestringRequired
Query parameters
collection_nameany ofOptionalDefault: default_collection
stringOptional
or
nullOptional
Responses
delete
/v1/documents/delete-document/{document_name}/

No content

File To Imgbase64

post
/v1/helpers/file-to-imgbase64/

Upload one file, converts to images and return their base64 encoded strings with 1-indexed page numberss.

Args: request: The HTTP request object. file UploadedFile): One uploaded file

Returns: List[FileOut]: A list of FileOut objects containing the base64 encoded strings of the images.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
filestring · binaryRequired
Responses
post
/v1/helpers/file-to-imgbase64/
200

OK

File To Base64

post
/v1/helpers/file-to-base64/

Upload one file, converts to base64 encoded strings.

Args: request: The HTTP request object. file UploadedFile): One uploaded file

Returns: str: base64 encoded string of the file.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
filestring · binaryRequired
Responses
post
/v1/helpers/file-to-base64/
200

OK

No content

Embeddings

post
/v1/embeddings/

Embed a list of documents.

This endpoint allows the user to embed a list of documents.

Args: request: The HTTP request object, which includes the user information. payload (EmbeddingsIn): The input data for embedding the documents.

Returns: EmbeddingsOut: The embeddings of the documents and metadata.

Raises: HttpError: If the documents cannot be embedded.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
input_datastring[]Required
taskstring · enumRequiredPossible values:
Responses
post
/v1/embeddings/

Last updated

Was this helpful?