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

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

// Upload raw content
const { document } = await client.documents.upload({
spaceId: 'space_123',
content: '# My Document\n\nSome markdown content...',
filename: 'my-doc.md',
metadata: { category: 'guides' }
});
{
  "document": {
    "id": "<string>",
    "orgId": "<string>",
    "spaceId": "<string>",
    "filename": "<string>",
    "mimeType": "<string>",
    "fileSize": "<string>",
    "storageUrl": "<string>",
    "status": "<string>",
    "errorMessage": "<string>",
    "embeddingModel": "<string>",
    "metadata": "<string>",
    "createdAt": "2023-12-25",
    "updatedAt": "2023-12-25"
  }
}

Authorizations

Oai-Api-Key
string
header
required

Body

spaceId
string
required

The ID of the space to upload the document to

Example:

"space_123"

file
file

The file to upload

filename
string
Required string length: 1 - 255
embeddingModel
string
metadata
string

Response

Document uploaded successfully

document
object
required