Skip to main content
POST
/
documents
/
batch
TypeScript SDK
import { Orchata } from '@orchata/sdk';

const client = new Orchata({ apiKey: 'oai_your_api_key' });

const result = await client.documents.batchUpload({
  spaceId: 'space_123',
  documents: [
    { filename: 'doc1.md', content: '# Doc 1\n\nContent...' },
    { filename: 'doc2.md', content: '# Doc 2\n\nContent...' },
  ]
});
console.log(`Uploaded: ${result.totalSuccessful}, Failed: ${result.totalFailed}`);
{
  "successful": [
    {
      "filename": "<string>",
      "documentId": "<string>",
      "status": "<string>"
    }
  ],
  "failed": [
    {
      "filename": "<string>",
      "error": "<string>"
    }
  ],
  "totalSuccessful": 123,
  "totalFailed": 123
}

Authorizations

Oai-Api-Key
string
header
required

Body

application/json

Batch upload request

spaceId
string
required

The ID of the space to upload the documents to

Example:

"space_123"

documents
object[]
required

Array of documents to upload (max 100)

Required array length: 1 - 100 elements

Response

Batch upload completed

successful
object[]
required
failed
object[]
required
totalSuccessful
number
required
totalFailed
number
required