Skip to content

Browse a Worker's code

GET
/api/v1/sites/{site}/code
curl --request GET \
--url https://digize.com/api/v1/sites/example/code \
--header 'x-api-key: <x-api-key>'

A folder’s files or one file in a Worker’s git repo, at a branch, tag or commit: the newest commit on its deploy branch unless it says. A folder comes with its README, and a text file or image with its content. kind is empty before the first push; null when there’s no such ref or path.

Needs the sites:read permission.

site
required
string
>= 1 characters <= 64 characters
ref

A branch, tag or commit id. Left out, the Worker’s deploy branch.

string
>= 1 characters <= 255 characters /^\S+$/

A branch, tag or commit id. Left out, the Worker’s deploy branch.

path

A path in the repo, such as src/index.ts. Left out, the top.

string
<= 4096 characters

A path in the repo, such as src/index.ts. Left out, the top.

Done

Media typeapplication/json
Any of:
One of:
object
kind
required
string
Allowed value: empty
ref
required
string

Example

{
"kind": "empty"
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}