Depot Code API Reference
Depot Code is in public beta. The API doesn't cover every Depot Code operation yet, and Depot is rapidly iterating toward full API coverage. Requests and responses could change.
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
import {createClient} from '@depot/sdk-node'
const client = createClient({token: process.env.DEPOT_TOKEN})
const {repositoryId} = await client.code.v1beta1.CodeService.createRepository({
source: {
case: 'standalone',
value: {repository: 'team/service', defaultBranch: 'main'},
},
})
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 @depot/sdk-node client exports code.v1beta1.CodeService with
createRepository and deleteRepository. For GitHub mirrors, set source.case to github and
source.value.repository to owner/repository. Delete by passing {repositoryId: 'repository-id'} to deleteRepository.
Go callers can use codev1beta1connect.NewCodeServiceClient from
buf.build/gen/go/depot/api/connectrpc/go/depot/code/v1beta1/codev1beta1connect.
The generated Code service reference
describes both RPCs and their request and response types. Find generated client packages in the
depot/api Buf module.