Files
Upload, attach, download, version, search and share files.
Start with: files_upload, files_attach, files_list, files_download, files_link_create.
28 operations. Discover them from an agent with agentdb_capabilities {"category": "files"}.
#files.content.get
Download file bytes (Range: bytes=a-b supported)
- REST
GET /v1/workspaces/{ws}/files/{file}/contentscope records:read
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
Example
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/content" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.content.patch
Resumable upload: one part at Upload-Offset (application/octet-stream)
- REST
PATCH /v1/workspaces/{ws}/files/{file}/contentscope records:write
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
Example
curl -s -X PATCH "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/content" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.content.put
Upload file bytes (application/octet-stream)
- REST
PUT /v1/workspaces/{ws}/files/{file}/contentscope records:write
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
Example
curl -s -X PUT "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/content" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.create
files create
- REST
POST /v1/workspaces/{ws}/filesscope records:write
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
Idempotency-Key | header | string | Retry key: the same key and request return the stored result (7 days). |
JSON body: the arguments in the table above, as an object.
Example
curl -s -X POST "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.link.list_all
Signed file links of the workspace
- REST
GET /v1/workspaces/{ws}/file-linksscope records:read
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
Example
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/file-links" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.link.view
Open a signed file link (public; Range supported)
- REST
GET /v1/file-links/{token}no authentication
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
token | path | string | yes | string |
Example
curl -s "https://app.agentdb.link/v1/file-links/<token>"#files.thumbnail.get
Thumbnail JPEG made by the media worker (rc.8; worker off by default)
- REST
GET /v1/workspaces/{ws}/files/{file}/thumbnailscope records:read
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
Example
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/thumbnail" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.upload_status
files upload status
- REST
GET /v1/workspaces/{ws}/files/{file}/uploadscope records:read
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
version | query | integer | integer, at least 1 |
Example
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/upload" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.version.content.get
Download one version's bytes (Range supported)
- REST
GET /v1/workspaces/{ws}/files/{file}/versions/{version}/contentscope records:read
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
version | path | string | yes | string |
Example
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/versions/<version>/content" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.version.content.patch
Resumable upload part of a pending version
- REST
PATCH /v1/workspaces/{ws}/files/{file}/versions/{version}/contentscope records:write
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
version | path | string | yes | string |
Example
curl -s -X PATCH "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/versions/<version>/content" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.version.content.put
Upload the bytes of a pending version
- REST
PUT /v1/workspaces/{ws}/files/{file}/versions/{version}/contentscope records:write
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
version | path | string | yes | string |
Example
curl -s -X PUT "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/versions/<version>/content" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.version.create
files version create
- REST
POST /v1/workspaces/{ws}/files/{file}/versionsscope records:write
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
Idempotency-Key | header | string | Retry key: the same key and request return the stored result (7 days). |
JSON body: the arguments in the table above, as an object.
Example
curl -s -X POST "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/versions" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files.waveform.get
Audio waveform peaks made by the media worker (rc.8; worker off by default)
- REST
GET /v1/workspaces/{ws}/files/{file}/waveformscope records:read
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ws | path | string | yes | string |
file | path | string | yes | string |
Example
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/waveform" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files_attach
Attach an uploaded file to a record with a role (e.g. 'invoice_pdf', 'photo'). The same file can be attached to several records.
- MCP tool
files_attach- REST
POST /v1/workspaces/{ws}/attachmentsscope records:write- CLI
agentdb files attach
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
file_id | string | yes | File id (fil_...). |
record_id | string | yes | Id of the record to attach the file to. |
role | string | string, default "attachment" | |
idempotency_key | string | Optional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again. | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_attach",
"arguments": {
"file_id": "fil_example",
"record_id": "rec_example",
"role": "contract"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_attach",
"arguments": {
"file_id": "fil_example",
"record_id": "rec_example",
"role": "contract"
}
}
}curl -s -X POST "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/attachments" \
-H "Authorization: Bearer $AGENTDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"file_id":"fil_example","record_id":"rec_example","role":"contract"}'agentdb files attach [options] <file_id> <record_id>#files_delete
Delete a file and its bytes. Fails with FILE_IN_USE while it is attached unless force=true (which detaches it everywhere).
- MCP tool
files_delete- REST
DELETE /v1/workspaces/{ws}/files/{file}scope records:write- CLI
agentdb files delete
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
force | boolean | boolean, default false | |
file_id | string | yes | File id (fil_...) |
idempotency_key | string | Optional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again. | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_delete",
"arguments": {
"file_id": "fil_example"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_delete",
"arguments": {
"file_id": "fil_example"
}
}
}curl -s -X DELETE "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example" \
-H "Authorization: Bearer $AGENTDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'agentdb files delete [options] <file_id>#files_delete_version
Delete an earlier version of a file, or cancel a pending replacement. The current version can't be deleted.
- MCP tool
files_delete_version- REST
DELETE /v1/workspaces/{ws}/files/{file}/versions/{version}scope records:write- CLI
agentdb files delete-version
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
file_id | string | yes | File id (fil_...) |
version | integer | yes | Version number (not the current one) |
idempotency_key | string | Optional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again. | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_delete_version",
"arguments": {
"file_id": "fil_example",
"version": 1
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_delete_version",
"arguments": {
"file_id": "fil_example",
"version": 1
}
}
}curl -s -X DELETE "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example/versions/1" \
-H "Authorization: Bearer $AGENTDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'agentdb files delete-version [options] <file_id> <version>#files_detach
Remove one attachment. The file itself is kept.
- MCP tool
files_detach- REST
DELETE /v1/workspaces/{ws}/attachments/{attachment}scope records:write- CLI
agentdb files detach
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
attachment_id | string | yes | Attachment id (att_...) from files_attach / files_get |
idempotency_key | string | Optional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again. | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
attachment_id comes from files_get (attached_to) or files_attach.
{
"tool": "files_detach",
"arguments": {
"attachment_id": "att_example"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_detach",
"arguments": {
"attachment_id": "att_example"
}
}
}curl -s -X DELETE "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/attachments/att_example" \
-H "Authorization: Bearer $AGENTDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'agentdb files detach [options] <attachment_id>#files_download
Return a file's bytes as base64 (up to max_inline_file_bytes). Images are additionally returned as image content.
- MCP tool
files_download- CLI
agentdb files download
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
file_id | string | yes | File id (fil_...) |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_download",
"arguments": {
"file_id": "fil_example"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_download",
"arguments": {
"file_id": "fil_example"
}
}
}agentdb files download [options] <file_id>#files_get
File metadata: filename, content_type, size, sha256, status and the records it is attached to.
- MCP tool
files_get- REST
GET /v1/workspaces/{ws}/files/{file}scope records:read- CLI
agentdb files get
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
file_id | string | yes | File id (fil_...) |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_get",
"arguments": {
"file_id": "fil_example"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_get",
"arguments": {
"file_id": "fil_example"
}
}
}curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example" \
-H "Authorization: Bearer $AGENTDB_TOKEN"agentdb files get [options] <file_id>#files_link_create
Signed, expiring link to one file for a dashboard or public app: works in <img>/<video>/<audio> without an API key, ends at expires_at (max 7 days), revocable with files_link_revoke.
- MCP tool
files_link_create- REST
POST /v1/workspaces/{ws}/files/{file}/linksscope records:write
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
expires_in_seconds | integer | integer, 60–604800, default 3600 | |
disposition | "inline" | "attachment" | string, one of: inline, attachment | |
version | integer | The current version of the item. The call fails with VERSION_CONFLICT if it changed. (min 1) | |
file_id | string | yes | File id (fil_...) |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_link_create",
"arguments": {
"file_id": "fil_example",
"expires_in_seconds": 3600,
"disposition": "inline"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_link_create",
"arguments": {
"file_id": "fil_example",
"expires_in_seconds": 3600,
"disposition": "inline"
}
}
}curl -s -X POST "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example/links" \
-H "Authorization: Bearer $AGENTDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"expires_in_seconds":3600,"disposition":"inline"}'#files_link_list
List signed file links (active, expired and revoked) of the workspace or of one file.
- MCP tool
files_link_list- REST
GET /v1/workspaces/{ws}/files/{file}/linksscope records:read
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
file_id | string | Only links of this file | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_link_list",
"arguments": {
"file_id": "fil_example"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_link_list",
"arguments": {
"file_id": "fil_example"
}
}
}curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example/links" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files_link_revoke
Revoke a signed file link at once. The file itself is kept.
- MCP tool
files_link_revoke- REST
DELETE /v1/workspaces/{ws}/file-links/{link}scope records:write
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
link_id | string | yes | Link id (flk_...) from files_link_create / files_link_list |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
link_id comes from files_link_create or files_link_list.
{
"tool": "files_link_revoke",
"arguments": {
"link_id": "flk_example"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_link_revoke",
"arguments": {
"link_id": "flk_example"
}
}
}curl -s -X DELETE "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/file-links/flk_example" \
-H "Authorization: Bearer $AGENTDB_TOKEN"#files_list
List files, optionally only those attached to record_id. Ordered by id; page with after=next_after.
- MCP tool
files_list- REST
GET /v1/workspaces/{ws}/filesscope records:read- CLI
agentdb files list
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
record_id | string | Record id. | |
status | "pending" | "ready" | string, one of: pending, ready | |
folder | string | string, up to 255 characters | |
recursive | boolean | "true" | "false" | boolean | "true" | "false" | |
tag | string | string, up to 50 characters | |
kind | "image" | "audio" | "video" | "text" | "document" | "archive" | "other" | string, one of: image, audio, video, text, document, archive, other | |
limit | integer | integer, 1–200, default 50 | |
after | string | string | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_list",
"arguments": {
"record_id": "rec_example",
"limit": 20
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_list",
"arguments": {
"record_id": "rec_example",
"limit": 20
}
}
}curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files" \
-H "Authorization: Bearer $AGENTDB_TOKEN"agentdb files list [options]#files_replace
Replace a file's content (base64, up to max_inline_file_bytes) as a new version. Attachments and file fields keep pointing at the file; earlier versions stay in files_versions.
- MCP tool
files_replace- CLI
agentdb files replace
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
content_base64 | string | yes | New file content, base64-encoded. It becomes a new version. |
content_type | string | MIME type, e.g. image/png or text/csv. | |
filename | string | File name, with its extension. (min length 1, max length 255) | |
file_id | string | yes | File id (fil_...) |
idempotency_key | string | Optional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again. | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_replace",
"arguments": {
"file_id": "fil_example",
"content_base64": "aGVsbG8gYWdhaW4=",
"content_type": "text/plain"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_replace",
"arguments": {
"file_id": "fil_example",
"content_base64": "aGVsbG8gYWdhaW4=",
"content_type": "text/plain"
}
}
}agentdb files replace [options] <file_id> <path>#files_search
Find files by a word or phrase in their name or indexed text (exact substring, not semantic). coverage says how many files have indexed text; the others were matched on name only.
- MCP tool
files_search- REST
POST /v1/workspaces/{ws}/files/searchscope records:read- CLI
agentdb files search
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
query | string | yes | Words to find in file names and extracted text. (min length 2, max length 200) |
folder | string | string, up to 255 characters | |
recursive | boolean | "true" | "false" | boolean | "true" | "false" | |
tag | string | string, up to 50 characters | |
kind | "image" | "audio" | "video" | "text" | "document" | "archive" | "other" | string, one of: image, audio, video, text, document, archive, other | |
limit | integer | integer, 1–50, default 20 | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_search",
"arguments": {
"query": "order form",
"kind": "document",
"limit": 10
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_search",
"arguments": {
"query": "order form",
"kind": "document",
"limit": 10
}
}
}curl -s -X POST "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/search" \
-H "Authorization: Bearer $AGENTDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query":"order form","kind":"document","limit":10}'agentdb files search [options] <query>#files_update
Rename a file or set its folder (e.g. 'contracts/2026'; null removes it) and tags. Content is not changed.
- MCP tool
files_update- REST
PATCH /v1/workspaces/{ws}/files/{file}scope records:write- CLI
agentdb files update
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
filename | string | File name, with its extension. (min length 1, max length 255) | |
folder | string | null | string | null | |
tags | string[] | string[], up to 20 items | |
file_id | string | yes | File id (fil_...) |
idempotency_key | string | Optional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again. | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_update",
"arguments": {
"file_id": "fil_example",
"folder": "contracts",
"tags": [
"signed"
]
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_update",
"arguments": {
"file_id": "fil_example",
"folder": "contracts",
"tags": [
"signed"
]
}
}
}curl -s -X PATCH "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example" \
-H "Authorization: Bearer $AGENTDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"folder":"contracts","tags":["signed"]}'agentdb files update [options] <file_id>#files_upload
Upload a file as base64 (images, PDFs, documents, any type within the server's limits; see workspace_info for max_inline_file_bytes). Optionally attach it to record_id with a role (default 'attachment') in the same call. Content is immutable once uploaded.
- MCP tool
files_upload- CLI
agentdb files upload
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
filename | string | yes | File name, with its extension. (min length 1, max length 255) |
content_type | string | yes | MIME type, e.g. image/png or text/csv. |
content_base64 | string | yes | File content, base64-encoded. |
record_id | string | Record id. | |
role | string | string, default "attachment" | |
folder | string | string, up to 255 characters | |
tags | string[] | string[], up to 20 items | |
idempotency_key | string | Optional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again. | |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_upload",
"arguments": {
"filename": "hello.txt",
"content_type": "text/plain",
"content_base64": "aGVsbG8=",
"record_id": "rec_example",
"role": "attachment"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_upload",
"arguments": {
"filename": "hello.txt",
"content_type": "text/plain",
"content_base64": "aGVsbG8=",
"record_id": "rec_example",
"role": "attachment"
}
}
}agentdb files upload [options] <path>#files_versions
Version history of a file, newest first: a pending replacement (if any), the current version, earlier versions.
- MCP tool
files_versions- REST
GET /v1/workspaces/{ws}/files/{file}/versionsscope records:read- CLI
agentdb files versions
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
file_id | string | yes | File id (fil_...) |
workspace | string | Workspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select. |
Example
{
"tool": "files_versions",
"arguments": {
"file_id": "fil_example"
}
}{
"tool": "agentdb_execute",
"arguments": {
"operation": "files_versions",
"arguments": {
"file_id": "fil_example"
}
}
}curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example/versions" \
-H "Authorization: Bearer $AGENTDB_TOKEN"agentdb files versions [options] <file_id>