Skip to main content
Use Files to upload documents once. Use Vector Stores to index those files for semantic search and retrieval. This is the standard pattern for document-backed assistants, retrieval workflows, and grounded responses.

Upload a file

Upload the file with multipart/form-data. The live OpenAPI spec requires file and purpose.
curl https://apigw.mka1.com/api/v1/llm/files \
  --request POST \
  --header 'Authorization: Bearer <mka1-api-key>' \
  --header 'X-On-Behalf-Of: <end-user-id>' \
  --form 'file=@./support-manual.pdf' \
  --form 'purpose=assistants'
The response returns a file object with an ID such as file-abc123.

Create a vector store

Create a vector store and attach one or more uploaded file IDs.
curl https://apigw.mka1.com/api/v1/llm/vector_stores \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <mka1-api-key>' \
  --header 'X-On-Behalf-Of: <end-user-id>' \
  --data '{
    "name": "Support knowledge base",
    "description": "Indexed support manuals and help center docs",
    "file_ids": [
      "file-abc123"
    ],
    "expires_after": {
      "anchor": "last_active_at",
      "days": 30
    }
  }'
This response returns a vector store ID such as vs_abc123.

Add more files later

You can add more files to an existing vector store without recreating it.
curl https://apigw.mka1.com/api/v1/llm/vector_stores/vs_abc123/files \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <mka1-api-key>' \
  --header 'X-On-Behalf-Of: <end-user-id>' \
  --data '{
    "file_id": "file-def456",
    "attributes": {
      "category": "manual",
      "version": "2.0"
    }
  }'
The vector store file can return status: "in_progress" while indexing runs. Check the Files and Vector Stores endpoints in the API Reference if you need to poll for status.

Search the vector store

Use semantic search to retrieve the most relevant chunks for a user question.
curl https://apigw.mka1.com/api/v1/llm/vector_stores/vs_abc123/search \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <mka1-api-key>' \
  --header 'X-On-Behalf-Of: <end-user-id>' \
  --data '{
    "query": "How do I reset my password?",
    "max_num_results": 5
  }'
The response returns ranked matches with file_id, filename, score data, and chunk content.

Typical workflow

Use this sequence for most retrieval setups:
  1. Upload the source file.
  2. Create a vector store with file_ids, or attach the file later.
  3. Wait for file processing to complete.
  4. Search the vector store when you need relevant context.
You can then feed the returned text into your own application logic or a Responses request.