iQ Suite - Docs
SDK ReferenceDocument RAG

Create Index

Create a new RAG index by uploading a document.

Description

The Create Index endpoint allows you to create a new searchable index by uploading a document. Supported file types include PDF, DOC, DOCX, PPT, PPTX with max file size of 20MB.

Caution

Create Index method is an async process and our server will return with a task_id and check_status URL to check the status of your uploaded file.

We recommend using our webhooks to receive completed index_id or use our polling methods to wait till completion.

HTTP Request

POST /index/create

Authentication

All requests must include an Authorization header with a valid API key.

Headers

KeyValue
AuthorizationBearer YOUR_API_KEY
Content-Typemultipart/form-data

Request Body

  • document: The file to upload.

Form Data

FieldTypeDescription
documentfile (binary)The document file to upload.

Request Example

# Open the document you want to index in binary read mode
with open('document.pdf', 'rb') as file:
    # Send a request to create an index with the provided document
    response = client.create_index(document=file, filename='document.pdf')
    # Print the received Task ID to monitor progress
    print(f"Task ID: {response.data.task_id}")

Response

Success

Status Code: 200 OK

Body:

{
   "data": {
       "message": "Index creation has started.",
       "task_id": "05a8751a-6575-4dde-ab03-04a9622370b6",
       "check_status": "https://iqsuite.ai/api/v1/create-index/task-status/05a8751a-6575-4dde-ab03-04a9622370b6"
   }
}

Note

The task_id is a unique identifier for the index creation task. Use the check_status URL to monitor the progress of the task. Please note that the check_status URL will return the index_id once the task is completed.

And this endpoint is secured by default, hence you need to pass the Authorization header with the API key.

Need Help?

On this page