API Reference Guide

All API endpoints are authenticated using API keys.

1. Upload file

POST https://sso.raen.ai/collections/upload/{collection-name}

curl -X 'POST' \
  'https://sso.raen.ai/collections/upload/<your-collection_name>' \
  -H 'accept: application/json' \
  -H 'X-API-Key: <your-api-key>' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@<uploaded_file_path>;type=<uploaded_file_mime_type>'

Response

When the request is successful, you will receive an unique document ID in the response.

{
  "status": "File uploaded.",
  "collection_name": "<your-collection-name>",
  "document_id": <document-id>,
  "filename": "<your-file-name>",
  "metadata": {
    "user": "<user-name>",
    "type": "<file-type>",
    "size": <file-size>
  }
}

Key Notes:

  • Replace <your-collection-name> with the actual name of your collection.

  • Replace <your-api-key> with your actual API key.

2. Retrieve Documents

POST https://sso.raen.ai/collections/retrieve/{collection-name}

curl -X 'POST' \
  'https://sso.raen.ai/collections/retrieve/<collection-name>' \
  -H 'accept: application/json' \
  -H 'X-API-Key: <your-api-key>' \
  -H 'Content-Type: application/json' \
  -d '{
  "query": "<your-quesion>",
  "thread_id": "<pass unique string>",
  "top_k": 4
}'

Response

[
  {
    "id": null,
    "metadata": {
      "source": "<file-location>",
      "filename": "<your-file-name>",
      "_id": "<unique-id>",
      "_collection_name": "<collection-name>",
      "document_id": <unique-document-id>
    },
    "page_content": "<your-page-content>",
    "type": "<document-type>"
  }
]

Key Notes:

  • Replace <your-collection-name> with the actual name of your collection.

  • Replace <your-api-key> with your actual API key.

  • Replace <your-question> with your query.

3. Delete a file

DELETE https://sso.raen.ai/collections/files/{collection-name}

curl -X 'DELETE' \
  'https://sso.raen.ai/collections/files/<your-collection-name>' \
  -H 'accept: application/json' \
  -H 'X-API-Key: <your-api-key>' \
  -H 'Content-Type: application/json' \
  -d '{
  "doc_id": <your-document-id>,
  "delete_all": false
}'

Response:

{
  "status": "File deleted successfully."
}

Key Notes:

  • Replace <your-collection-name> with the actual name of your collection.

  • Replace <your-api-key> with your actual API key.

  • Replace <your-doc-id> with your actual document id.

4. Delete collection

DELETE https://sso.raen.ai/collections/{collection-name}

curl -X 'DELETE' \
  'https://sso.raen.ai/collections/<you-collection-name>' \
  -H 'accept: application/json' \
  -H 'X-API-Key: <you-api-key>'
{
  "status": "Collection deleted successfully."
}

Key Notes:

  • Replace <your-collection-name> with the actual name of your collection.

  • Replace <your-api-key> with your actual API key.

5. Download a specific file

GET https://sso.raen.ai/collections/files/{collection-name}/{document-id}


curl -X 'GET' \
  'https://sso.raen.ai/collections/files/<your-collection-name>/<document-id>' \
  -H 'accept: application/json' \
  -H 'X-API-Key: <your-api-key>'

Response:

{
    "download_url": <presigned_url>,
    "expires_in": 3600,
    "document_id": <document-id>,
    "filename": <file-name>
}

Key Notes:

  • Replace <your-collection-name> with the actual name of your collection.

  • Replace <your-api-key> with your actual API key.

  • Replace <your-document-id> with your actual document id.

6. Get all collections

GET https://sso.raen.ai/collections/

curl -X 'GET' \
  'https://sso.raen.ai/collections/' \
  -H 'accept: application/json' \
  -H 'X-API-Key: <yor-api-key>'

Response:

[
  {
    "id": <collection_id>,
    "user_id": <user_id>,
    "name": "<collection_name>",
    "created_on": "<timestamp>",
    "last_updated": "<timestamp>",
    "documents": [
      {
        "id": <document_id>,
        "user_id": <user_id>,
        "type": "<file_type>",
        "name": "<file_name>",
        "size_bytes": <file_size>,
        "created_on": "<timestamp>",
        "updated_on": "<timestamp>"
      }
    ]
  }
]

Key Notes:

  • Replace <your-api-key> with your actual API key.

Last updated

Was this helpful?