LEIA Docs

Upload RAG document

POST
/rag-documents

Uploads one source document as multipart/form-data, stores it, creates a RAG document record, and starts asynchronous processing. If neither courseId nor draftCourseId is supplied, a new draftCourseId is returned. Idempotency is scoped to upload metadata and file checksum.

Authorization

AuthorizationBearer <token>

LEIA API key passed as Bearer token (recommended). Keys start with leia_sk_.

In: header

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/rag-documents" \  -F file="string"
{
  "fileId": "string",
  "documentId": "string",
  "fileName": "string",
  "mimeType": "string",
  "fileSize": 0,
  "publicUrl": "http://example.com",
  "status": "PENDING",
  "courseId": "string",
  "draftCourseId": "string"
}
Empty
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Valid LEIA API key required"
  }
}

{
  "error": {
    "code": "FORBIDDEN",
    "message": "API key service user must be a CREATOR user"
  }
}

{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "IDEMPOTENCY_CONFLICT",
    "message": "Idempotency-Key was reused with a different request body"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}