Skip to main content
PUT
/
api
/
v2
/
agents
/
{agentId}
/
sources
/
{sourceId}
Update file source
curl --request PUT \
  --url https://files.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'name=Employee Handbook v2' \
  --form file='@example-file'
{
  "id": "a63a69a5-e7a9-4757-b73b-2041854d435d",
  "type": "file",
  "name": "Employee Handbook v2",
  "size": 261120,
  "createdAt": "2025-01-15T10:30:00.000Z",
  "status": "updated",
  "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"

sourceId
string
required

The source ID

Minimum string length: 1
Example:

"a63a69a5-e7a9-4757-b73b-2041854d435d"

Body

multipart/form-data
name
string

New display name. If omitted, the existing name is preserved.

Minimum string length: 1
Example:

"Employee Handbook v2"

file
file

Replacement file. Same constraints as create. If omitted, existing content is preserved.

Response

Updated file source. If the file was replaced and previously trained, status becomes updated.

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".