Skip to main content
POST
Connect repository

Authorizations

Authorization
string
header
required

API token from cargo-ai login. Send as Authorization: Bearer <token>.

Headers

Idempotency-Key
string

Client-generated key that makes this write safe to retry. Reusing the same key with the same request returns the original response instead of creating a second record. Reusing it with a different request returns 422. A concurrent retry while the first request is still running returns 409. Keys expire after 24 hours. Not accepted on multipart file uploads. Optional: a request without one is processed as it always was.

Maximum string length: 255
Example:

"8e03978e-40d5-43e8-bc93-6894a57f9324"

Path Parameters

uuid
string
required

Project to connect a repository to.

Body

application/json

Request body schema.

githubOwner
string
required

Owner of the repository to connect.

Required string length: 1 - 255
githubRepo
string
required

Repository to connect.

Required string length: 1 - 255
connectorUuid
string<uuid>
required

The workspace's GitHub connector. Its account must be an admin of the repository.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
productionBranch
string
required

Pushes to this branch deploy. Every other branch only plans.

Required string length: 1 - 255
directory
string

Project directory inside the repository. Defaults to the repository root.

Maximum string length: 1024
autoDeploy
boolean

Whether pushes to the production branch deploy. Pull requests are planned either way. Defaults to true.

runAsUserUuid
string<uuid>

Service user a deploy runs as, whose permissions must be covered by the caller's. Each deploy gets a temporary CARGO_API_TOKEN for that user. Without one, a service user is created for this repository with the caller's permissions.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$

Response

Connect repository

state
object
required