Skip to content

Retrieve metadata for a file using a HEAD request. This endpoint returns file existence and headers (such as Content-Length, Content-Type, Last-Modified, and ETag) without transferring the file body. Use this when you need to check whether a file exists, get its size, or inspect caching headers before deciding to download.

The endpoint is exposed under the WebDAV-style file root, so requests are made to HEAD /{path} where {path} is the URL-encoded file path within the workspace.

Get file metadata.

NameInTypeRequiredDescription
pathpathstringYesURL-encoded path to the file (e.g. docs/readme.md).
historyquerystringNoList all revisions of a file. Returns JSON with revisions array, pagination via after_id. Mutually exclusive with at / revision / diff.
atquerystringNoRead file content at a point in time. Accepts RFC3339 timestamp or Unix milliseconds. Mutually exclusive with history / revision / diff. Composable with ?lines, ?hash, ?base64.
revisionqueryintegerNoRead file content by stable per-path sequence number. Mutually exclusive with history / at / diff. Composable with ?lines, ?hash, ?base64.
diffquerystringNoCompute unified diff between two versions. Requires from_seq or from_ts. Optional to_seq or to_ts (defaults to current file). Mutually exclusive with history / at / revision.
from_seqqueryintegerNoSource revision seq number for ?diff. Mutually exclusive with from_ts.
from_tsquerystringNoSource timestamp for ?diff (RFC3339 or Unix ms). Mutually exclusive with from_seq.
to_seqqueryintegerNoTarget revision seq number for ?diff. Mutually exclusive with to_ts. Default: current file on disk.
to_tsquerystringNoTarget timestamp for ?diff (RFC3339 or Unix ms). Mutually exclusive with to_seq.
after_idqueryintegerNoCursor for ?history pagination. Returns entries with id > after_id.
limitqueryintegerNoMax entries to return for ?history. Default: 100.

This endpoint accepts no request body.

Returns 200 OK with headers describing the file when the file exists.

HTTP/1.1 200 OK
Content-Length: 2048
Content-Type: text/markdown
Last-Modified: Wed, 15 Jan 2025 09:12:34 GMT
ETag: "a1b2c3d4e5f6"
X-File-Path: docs/readme.md
{
"description": "File exists"
}
const metadata = await client.files.files.getMetadata({
path: "docs/readme.md",
});

To retrieve revision history instead of just the current file metadata, pass the history query parameter:

const history = await client.files.files.getMetadata({
path: "docs/readme.md",
history: "",
limit: 50,
});

To compute a diff between two revisions:

const diff = await client.files.files.getMetadata({
path: "docs/readme.md",
diff: "",
from_seq: 12,
to_seq: 18,
});