AgentDBDocs

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

stable

Download file bytes (Range: bytes=a-b supported)

REST
GET /v1/workspaces/{ws}/files/{file}/content scope records:read
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring

Example

REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/content" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.content.patch

stable

Resumable upload: one part at Upload-Offset (application/octet-stream)

REST
PATCH /v1/workspaces/{ws}/files/{file}/content scope records:write
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring

Example

REST
curl -s -X PATCH "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/content" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.content.put

stable

Upload file bytes (application/octet-stream)

REST
PUT /v1/workspaces/{ws}/files/{file}/content scope records:write
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring

Example

REST
curl -s -X PUT "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/content" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.create

stable

files create

REST
POST /v1/workspaces/{ws}/files scope records:write
ParameterInTypeRequiredDescription
wspathstringyesstring
Idempotency-KeyheaderstringRetry key: the same key and request return the stored result (7 days).

JSON body: the arguments in the table above, as an object.

Example

REST
curl -s -X POST "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.link.list_all

stable

Signed file links of the workspace

REST
GET /v1/workspaces/{ws}/file-links scope records:read
ParameterInTypeRequiredDescription
wspathstringyesstring

Example

REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/file-links" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.link.view

stable

Open a signed file link (public; Range supported)

REST
GET /v1/file-links/{token} no authentication
ParameterInTypeRequiredDescription
tokenpathstringyesstring

Example

REST
curl -s "https://app.agentdb.link/v1/file-links/<token>"

#files.thumbnail.get

stable

Thumbnail JPEG made by the media worker (rc.8; worker off by default)

REST
GET /v1/workspaces/{ws}/files/{file}/thumbnail scope records:read
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring

Example

REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/thumbnail" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.upload_status

stable

files upload status

REST
GET /v1/workspaces/{ws}/files/{file}/upload scope records:read
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring
versionqueryintegerinteger, at least 1

Example

REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/upload" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.version.content.get

stable

Download one version's bytes (Range supported)

REST
GET /v1/workspaces/{ws}/files/{file}/versions/{version}/content scope records:read
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring
versionpathstringyesstring

Example

REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/versions/<version>/content" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.version.content.patch

stable

Resumable upload part of a pending version

REST
PATCH /v1/workspaces/{ws}/files/{file}/versions/{version}/content scope records:write
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring
versionpathstringyesstring

Example

REST
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

stable

Upload the bytes of a pending version

REST
PUT /v1/workspaces/{ws}/files/{file}/versions/{version}/content scope records:write
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring
versionpathstringyesstring

Example

REST
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

stable

files version create

REST
POST /v1/workspaces/{ws}/files/{file}/versions scope records:write
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring
Idempotency-KeyheaderstringRetry key: the same key and request return the stored result (7 days).

JSON body: the arguments in the table above, as an object.

Example

REST
curl -s -X POST "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/versions" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files.waveform.get

stable

Audio waveform peaks made by the media worker (rc.8; worker off by default)

REST
GET /v1/workspaces/{ws}/files/{file}/waveform scope records:read
ParameterInTypeRequiredDescription
wspathstringyesstring
filepathstringyesstring

Example

REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/<file>/waveform" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"

#files_attach

stable added in 0.2.0-alpha.4 or earlier changes data

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}/attachments scope records:write
CLI
agentdb files attach

Arguments

ArgumentTypeRequiredDescription
file_idstringyesFile id (fil_...).
record_idstringyesId of the record to attach the file to.
rolestringstring, default "attachment"
idempotency_keystringOptional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again.
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_attach",
  "arguments": {
    "file_id": "fil_example",
    "record_id": "rec_example",
    "role": "contract"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_attach",
    "arguments": {
      "file_id": "fil_example",
      "record_id": "rec_example",
      "role": "contract"
    }
  }
}
REST
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"}'
CLI
agentdb files attach [options] <file_id> <record_id>

#files_delete

stable added in 0.2.0-alpha.4 or earlier changes data destructive

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

ArgumentTypeRequiredDescription
forcebooleanboolean, default false
file_idstringyesFile id (fil_...)
idempotency_keystringOptional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again.
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_delete",
  "arguments": {
    "file_id": "fil_example"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_delete",
    "arguments": {
      "file_id": "fil_example"
    }
  }
}
REST
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 '{}'
CLI
agentdb files delete [options] <file_id>

#files_delete_version

stable added in 1.0.0-rc.6 changes data destructive

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

ArgumentTypeRequiredDescription
file_idstringyesFile id (fil_...)
versionintegeryesVersion number (not the current one)
idempotency_keystringOptional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again.
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_delete_version",
  "arguments": {
    "file_id": "fil_example",
    "version": 1
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_delete_version",
    "arguments": {
      "file_id": "fil_example",
      "version": 1
    }
  }
}
REST
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 '{}'
CLI
agentdb files delete-version [options] <file_id> <version>

#files_detach

stable added in 0.2.0-alpha.4 or earlier changes data destructive

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

ArgumentTypeRequiredDescription
attachment_idstringyesAttachment id (att_...) from files_attach / files_get
idempotency_keystringOptional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again.
workspacestringWorkspace 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.

MCP
{
  "tool": "files_detach",
  "arguments": {
    "attachment_id": "att_example"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_detach",
    "arguments": {
      "attachment_id": "att_example"
    }
  }
}
REST
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 '{}'
CLI
agentdb files detach [options] <attachment_id>

#files_download

stable added in 0.2.0-alpha.4 or earlier read-only

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

ArgumentTypeRequiredDescription
file_idstringyesFile id (fil_...)
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_download",
  "arguments": {
    "file_id": "fil_example"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_download",
    "arguments": {
      "file_id": "fil_example"
    }
  }
}
CLI
agentdb files download [options] <file_id>

#files_get

stable added in 0.2.0-alpha.4 or earlier read-only

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

ArgumentTypeRequiredDescription
file_idstringyesFile id (fil_...)
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_get",
  "arguments": {
    "file_id": "fil_example"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_get",
    "arguments": {
      "file_id": "fil_example"
    }
  }
}
REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"
CLI
agentdb files get [options] <file_id>

#files_list

stable added in 0.2.0-alpha.4 or earlier read-only

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}/files scope records:read
CLI
agentdb files list

Arguments

ArgumentTypeRequiredDescription
record_idstringRecord id.
status"pending" | "ready"string, one of: pending, ready
folderstringstring, up to 255 characters
recursiveboolean | "true" | "false"boolean | "true" | "false"
tagstringstring, up to 50 characters
kind"image" | "audio" | "video" | "text" | "document" | "archive" | "other"string, one of: image, audio, video, text, document, archive, other
limitintegerinteger, 1–200, default 50
afterstringstring
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_list",
  "arguments": {
    "record_id": "rec_example",
    "limit": 20
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_list",
    "arguments": {
      "record_id": "rec_example",
      "limit": 20
    }
  }
}
REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"
CLI
agentdb files list [options]

#files_replace

stable added in 1.0.0-rc.6 changes data

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

ArgumentTypeRequiredDescription
content_base64stringyesNew file content, base64-encoded. It becomes a new version.
content_typestringMIME type, e.g. image/png or text/csv.
filenamestringFile name, with its extension. (min length 1, max length 255)
file_idstringyesFile id (fil_...)
idempotency_keystringOptional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again.
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_replace",
  "arguments": {
    "file_id": "fil_example",
    "content_base64": "aGVsbG8gYWdhaW4=",
    "content_type": "text/plain"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_replace",
    "arguments": {
      "file_id": "fil_example",
      "content_base64": "aGVsbG8gYWdhaW4=",
      "content_type": "text/plain"
    }
  }
}
CLI
agentdb files replace [options] <file_id> <path>

#files_update

stable added in 1.0.0-rc.6 changes data

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

ArgumentTypeRequiredDescription
filenamestringFile name, with its extension. (min length 1, max length 255)
folderstring | nullstring | null
tagsstring[]string[], up to 20 items
file_idstringyesFile id (fil_...)
idempotency_keystringOptional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again.
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_update",
  "arguments": {
    "file_id": "fil_example",
    "folder": "contracts",
    "tags": [
      "signed"
    ]
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_update",
    "arguments": {
      "file_id": "fil_example",
      "folder": "contracts",
      "tags": [
        "signed"
      ]
    }
  }
}
REST
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"]}'
CLI
agentdb files update [options] <file_id>

#files_upload

stable added in 0.2.0-alpha.4 or earlier changes data

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

ArgumentTypeRequiredDescription
filenamestringyesFile name, with its extension. (min length 1, max length 255)
content_typestringyesMIME type, e.g. image/png or text/csv.
content_base64stringyesFile content, base64-encoded.
record_idstringRecord id.
rolestringstring, default "attachment"
folderstringstring, up to 255 characters
tagsstring[]string[], up to 20 items
idempotency_keystringOptional retry key ([A-Za-z0-9._:-], max 255). Repeating a call with the same key and arguments returns the original result without writing again.
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_upload",
  "arguments": {
    "filename": "hello.txt",
    "content_type": "text/plain",
    "content_base64": "aGVsbG8=",
    "record_id": "rec_example",
    "role": "attachment"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_upload",
    "arguments": {
      "filename": "hello.txt",
      "content_type": "text/plain",
      "content_base64": "aGVsbG8=",
      "record_id": "rec_example",
      "role": "attachment"
    }
  }
}
CLI
agentdb files upload [options] <path>

#files_versions

stable added in 1.0.0-rc.6 read-only

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}/versions scope records:read
CLI
agentdb files versions

Arguments

ArgumentTypeRequiredDescription
file_idstringyesFile id (fil_...)
workspacestringWorkspace id (preferred), slug or exact name. Omit for the default workspace. Resolve names once with workspace_select.

Example

MCP
{
  "tool": "files_versions",
  "arguments": {
    "file_id": "fil_example"
  }
}
MCP via agentdb_execute
{
  "tool": "agentdb_execute",
  "arguments": {
    "operation": "files_versions",
    "arguments": {
      "file_id": "fil_example"
    }
  }
}
REST
curl -s "https://app.agentdb.link/v1/workspaces/$AGENTDB_WORKSPACE/files/fil_example/versions" \
  -H "Authorization: Bearer $AGENTDB_TOKEN"
CLI
agentdb files versions [options] <file_id>