ColiVara Documentation
  • Welcome
  • Getting Started
    • Quickstart
    • About
      • ColPali Architecture
      • ColiVara Benchmark Evaluation
    • Self-hosting
  • Guide
    • Retrieval Augmented Generation (RAG)
    • Data Extraction
    • Advanced filtering
    • API Reference
    • SDKs
    • Webhooks
    • Integrations
    • Advanced usage
Powered by GitBook
On this page

Was this helpful?

  1. Guide

API Reference

PreviousAdvanced filteringNextSDKs

Last updated 3 months ago

Was this helpful?

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

here

List Collections

get

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
Responses
200
OK
application/json
get
GET /v1/collections/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

[
  {
    "id": 1,
    "name": "text",
    "metadata": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "num_documents": 1
  }
]

Get Collection

get

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
Path parameters
collection_namestringRequired
Responses
200
OK
application/json
404
Not Found
application/json
get
GET /v1/collections/{collection_name}/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 1,
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "num_documents": 1
}

Delete Collection

delete

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
Path parameters
collection_namestringRequired
Responses
204
No Content
404
Not Found
application/json
delete
DELETE /v1/collections/{collection_name}/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Get Document

get

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
Path parameters
document_namestringRequired
Query parameters
collection_nameany ofOptionalDefault: default_collection
stringOptional
or
nullOptional
expandany ofOptional
stringOptional
or
nullOptional
Responses
200
OK
application/json
404
Not Found
application/json
409
Conflict
application/json
get
GET /v1/documents/{document_name}/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 1,
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "url": "text",
  "num_pages": 1,
  "collection_name": "text",
  "pages": [
    {
      "document_name": "text",
      "img_base64": "text",
      "page_number": 1
    }
  ]
}

List Documents

get

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
Query parameters
collection_nameany ofOptionalDefault: default_collection
stringOptional
or
nullOptional
expandany ofOptional
stringOptional
or
nullOptional
Responses
200
OK
application/json
get
GET /v1/documents/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

[
  {
    "id": 1,
    "name": "text",
    "metadata": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "url": "text",
    "num_pages": 1,
    "collection_name": "text",
    "pages": [
      {
        "document_name": "text",
        "img_base64": "text",
        "page_number": 1
      }
    ]
  }
]

Delete Document

delete

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
Path parameters
document_namestringRequired
Query parameters
collection_nameany ofOptionalDefault: default_collection
stringOptional
or
nullOptional
Responses
204
No Content
404
Not Found
application/json
409
Conflict
application/json
delete
DELETE /v1/documents/delete-document/{document_name}/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

  • GETHealth
  • POSTSearch
  • POSTSearch Image
  • POSTUpsert Document
  • GETList Collections
  • GETGet Collection
  • PATCHPartial Update Collection
  • DELETEDelete Collection
  • GETGet Document
  • PATCHPartial Update Document
  • GETList Documents
  • DELETEDelete Document
  • POSTFile To Imgbase64
  • POSTFile To Base64
  • POSTEmbeddings

Health

get
Responses
200
OK
get
GET /v1/health/ HTTP/1.1
Host: api.colivara.com
Accept: */*
200

OK

No content

Search

post

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
Body
querystringRequired
collection_nameany ofOptionalDefault: all
stringOptional
or
nullOptional
top_kany ofOptionalDefault: 3
integerOptional
or
nullOptional
query_filterany ofOptional
or
nullOptional
Responses
200
OK
application/json
402
Payment Required
application/json
503
Service Unavailable
application/json
post
POST /v1/search/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 133

{
  "query": "text",
  "collection_name": "all",
  "top_k": 3,
  "query_filter": {
    "on": "document",
    "key": "text",
    "value": "text",
    "lookup": "key_lookup"
  }
}
{
  "query": "text",
  "results": [
    {
      "collection_name": "text",
      "collection_id": 1,
      "collection_metadata": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "document_name": "text",
      "document_id": 1,
      "document_metadata": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "page_number": 1,
      "raw_score": 1,
      "normalized_score": 1,
      "img_base64": "text"
    }
  ]
}

Search Image

post

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
Body
img_base64stringRequired
collection_nameany ofOptionalDefault: all
stringOptional
or
nullOptional
top_kany ofOptionalDefault: 3
integerOptional
or
nullOptional
query_filterany ofOptional
or
nullOptional
Responses
200
OK
application/json
503
Service Unavailable
application/json
post
POST /v1/search-image/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 138

{
  "img_base64": "text",
  "collection_name": "all",
  "top_k": 3,
  "query_filter": {
    "on": "document",
    "key": "text",
    "value": "text",
    "lookup": "key_lookup"
  }
}
{
  "results": [
    {
      "collection_name": "text",
      "collection_id": 1,
      "collection_metadata": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "document_name": "text",
      "document_id": 1,
      "document_metadata": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "page_number": 1,
      "raw_score": 1,
      "normalized_score": 1,
      "img_base64": "text"
    }
  ]
}

Upsert Document

post

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
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
201
Created
application/json
202
Accepted
application/json
400
Bad Request
application/json
402
Payment Required
application/json
post
POST /v1/documents/upsert-document/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 164

{
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "collection_name": "default_collection",
  "url": "text",
  "base64": "text",
  "wait": false,
  "use_proxy": false
}
{
  "id": 1,
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "url": "text",
  "num_pages": 1,
  "collection_name": "text",
  "pages": [
    {
      "document_name": "text",
      "img_base64": "text",
      "page_number": 1
    }
  ]
}

Partial Update Collection

patch

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
Path parameters
collection_namestringRequired
Body
nameany ofOptional
stringOptional
or
nullOptional
metadataany ofOptional
or
nullOptional
Responses
200
OK
application/json
404
Not Found
application/json
patch
PATCH /v1/collections/{collection_name}/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 65

{
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}
{
  "id": 1,
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "num_documents": 1
}

Partial Update Document

patch

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
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
200
OK
application/json
402
Payment Required
application/json
404
Not Found
application/json
409
Conflict
application/json
patch
PATCH /v1/documents/{document_name}/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 151

{
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "collection_name": "default_collection",
  "url": "text",
  "base64": "text",
  "use_proxy": false
}
{
  "id": 1,
  "name": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "url": "text",
  "num_pages": 1,
  "collection_name": "text",
  "pages": [
    {
      "document_name": "text",
      "img_base64": "text",
      "page_number": 1
    }
  ]
}

File To Imgbase64

post

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
Body
filestring · binaryRequired
Responses
200
OK
application/json
post
POST /v1/helpers/file-to-imgbase64/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 17

{
  "file": "binary"
}
200

OK

[
  {
    "img_base64": "text",
    "page_number": 1
  }
]

File To Base64

post

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
Body
filestring · binaryRequired
Responses
200
OK
post
POST /v1/helpers/file-to-base64/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 17

{
  "file": "binary"
}
200

OK

No content

Embeddings

post

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
Body
input_datastring[]Required
taskstring · enumRequiredPossible values:
Responses
200
OK
application/json
402
Payment Required
application/json
503
Service Unavailable
application/json
post
POST /v1/embeddings/ HTTP/1.1
Host: api.colivara.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 38

{
  "input_data": [
    "text"
  ],
  "task": "image"
}
{
  "data": [
    {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    }
  ],
  "model": "text",
  "usage": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}