Skip to main content
POST
/
api
/
v2
/
agents
/
{agentId}
/
sources
Create file source
curl --request POST \
  --url https://files.chatbase.co/api/v2/agents/{agentId}/sources \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'name=Employee Handbook' \
  --form file='@example-file'
{
  "id": "a63a69a5-e7a9-4757-b73b-2041854d435d",
  "type": "file",
  "name": "Employee Handbook",
  "size": 245760,
  "createdAt": "2025-01-15T10:30:00.000Z",
  "status": "untrained",
  "metadata": null
}

Authorizations

Authorization
string
header
required

API key from your account settings

Path Parameters

agentId
string
required

The agent ID

Minimum string length: 1
Example:

"5QHA6VB-DIAbBhxwqxfdi"

Body

multipart/form-data
name
string
required

Display name for the source.

Minimum string length: 1
Example:

"Employee Handbook"

file
file
required

File to upload. Formats: .pdf, .doc, .docx, .txt. Max 20 MB.

Response

File source created. Status is untrained until the agent is retrained.

id
string
required

Source ID

type
enum<string>
required

Source type

Available options:
link,
file,
qna,
notionPage,
text
name
string | null
required

Source name or URL

size
number
required

Source size in bytes

createdAt
string
required

ISO 8601 creation timestamp

status
enum<string>
required

Training status of the source

Available options:
untrained,
trained,
toBeDeleted,
updated
metadata
object
required

Link-specific metadata. Present only for type="link".