Link a project to an existing GitHub repository
curl --request PUT \ --url https://example.com/api/v1/projects/example/repository \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "baseBranch": "example", "repository": "example" }'Links the project to a repository that already exists in the organization Chelsea manages, named by repository, the way the project’s Overview does. The name is looked up only inside that organization, never in another account the App is installed on. Linking again replaces the previous link. baseBranch sets where pull requests go and is checked before anything is saved, so a refusal never leaves the project linked. Requires both projects.manage and settings.manage, and a project the caller reaches. Answers: 403 FORBIDDEN without both permissions; 404 NOT_FOUND when the project is not one the caller reaches, or the organization has no such repository that the App reaches (an archived one, or one moved to another owner, counts as missing); 409 CONFLICT when the repository already serves a project of another company, does not hold agents back (the message names what is missing; POST /github/repositories/{name}/agent-protection adds the rule set that does), or Chelsea has no organization to administer yet; 422 INVALID_INPUT when baseBranch does not exist or is under agent/; 424 GITHUB_API_ERROR when GitHub cannot be read, or GITHUB_ACCESS_MISSING when the App or the organization lacks the access this needs; 429 RATE_LIMITED when GitHub or Chelsea throttles the call.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Project identifier (CUID2).
Project identifier (CUID2).
Request Body
Section titled “Request Body”object
The repository’s name inside the organization, such as acme-theme. It must be one the GitHub App reaches.
Example generated
{ "baseBranch": "example", "repository": "example"}Responses
Section titled “Responses”The linked repository and the branch pull requests go to.
object
object
The branch pull requests go to; null means the repository’s default branch.
The linked repository, as organization/name.
Example generated
{ "data": { "baseBranch": "example", "fullName": "example" }}Validation error. Parse failures include field paths and expectations.
Validation error with safe field paths and expected values; submitted values are never returned.
object
object
Stable machine-readable error code.
object
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Unauthorized.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Forbidden.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Not found.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Conflict.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Invalid input.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}GitHub failed (GITHUB_API_ERROR), or Chelsea’s GitHub App or the organization has not granted the access this needs (GITHUB_ACCESS_MISSING; the message names the step in Settings, Integrations, GitHub).
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Rate limit exceeded. Wait for Retry-After before retrying.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Headers
Section titled “Headers”Maximum requests in the current quota window.
Quota policy in requests and window seconds, for example 60;w=60.
Requests left in this quota window (zero when blocked).
Seconds until the current quota window resets, when available from the rate-limit store.
Seconds until another request may be attempted.
Chelsea is operated by Arepa Labs LLC