Skip to main content
GET
Read a file

Authorizations

Authorization
string
header
required

An API token for one organization. You create and revoke tokens in the dashboard. A token scoped to one App can reach only that App, so give that kind of token to an agent. An organization-wide token can create a short-lived one with POST /api/tokens.

Scopes

apps:read
OAuth

See the organization's Apps, with their files, deployments, and logs.

apps:read
DPoP

Headers

If-None-Match
string

One or more quoted ETags from earlier reads. If the file still matches one of them, the request returns 304 with no body.

Path Parameters

id
string
required

A unique ID that starts with app_.

Pattern: ^app_[0-9A-Za-z]{24}$
Example:

"app_Zj7XhMgplmTJcp5Dk4vcYuk0"

path
string
required

The file's path from the App's root, such as src/lib/util.ts.

Query Parameters

lines
string

Returns only these lines of a text file: a range such as 120-180, a start such as 120- (to the end), or one line such as 120. Lines are numbered from 1, and both ends are inclusive. An end past the last line stops at the last line.

Pattern: ^[1-9]\d{0,8}(-([1-9]\d{0,8})?)?$

Response

The file, as JSON or as raw bytes.

path
string
required

The file's path from the App's root.

size
integer
required

The file's size, in bytes.

Required range: x >= 0
Example:

2048

binary
boolean
required

True if the file isn't UTF-8 text; false otherwise. For a binary file, content is left out. To get the bytes, send Accept: application/octet-stream.

content
string

The file's text, or only the lines that lines asked for. Left out for a binary file.

line_count
integer

How many lines the whole file has. A final line ending doesn't start another line. Left out for a binary file.

Required range: x >= 0
lines
object

The lines that content holds. Present only when the request sets lines.