Depot Code API Reference
Depot Code is in private beta. Your organization must have Depot Code enabled before these requests will succeed. Request access to enable it for your organization.
The depot.code.v1beta1.CodeService
manages repositories hosted by Depot Code. It supports Connect's JSON protocol at https://api.depot.dev, so it can
be called from any HTTP client without a generated SDK.
Authenticate each request with an organization token in the Authorization header. See
API authentication for token setup.
Create a repository
CreateRepository creates either a standalone repository or a mirror of a GitHub repository. Exactly one of
standalone or github must be present.
For a GitHub mirror, the organization must have an active GitHub Code Access connection. GitHub remains the source of truth for mirrored repositories.
Create a standalone repository
const response = await fetch('https://api.depot.dev/depot.code.v1beta1.CodeService/CreateRepository', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DEPOT_TOKEN}`,
'Connect-Protocol-Version': '1',
'Content-Type': 'application/json',
},
body: JSON.stringify({
standalone: {repository: 'team/service', defaultBranch: 'main'},
}),
})
if (!response.ok) throw new Error(await response.text())
const {repositoryId} = (await response.json()) as {repositoryId: string}
console.log(repositoryId)The response contains the new repository's stable ID:
{"repositoryId": "repository-id"}Create a GitHub mirror
Use the GitHub repository's owner/repository name:
curl --request POST \
--url https://api.depot.dev/depot.code.v1beta1.CodeService/CreateRepository \
--header "Authorization: Bearer $DEPOT_TOKEN" \
--header 'Connect-Protocol-Version: 1' \
--header 'Content-Type: application/json' \
--data '{"github":{"repository":"owner/repository"}}'Delete a repository
DeleteRepository deletes the repository identified by the ID returned from CreateRepository. This operation makes
the repository's refs unreachable and cannot be undone.
curl --request POST \
--url https://api.depot.dev/depot.code.v1beta1.CodeService/DeleteRepository \
--header "Authorization: Bearer $DEPOT_TOKEN" \
--header 'Connect-Protocol-Version: 1' \
--header 'Content-Type: application/json' \
--data '{"repositoryId":"repository-id"}'A successful request returns an empty JSON object.
Generated clients
The complete protobuf schema and generated client packages are published in the
depot/api Buf module. @depot/sdk-node does not currently export CodeService; use
Connect JSON as shown above or a generated client until the SDK adds that service.