TrylleDocs
API ReferenceOpenAPI 3 reference

Branch protection

GET
/v1/repositories/{owner}/{name}/branch-protection-check-contexts

List status check context names reported for a repository ref.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

owner*string

Repository owner.

Length1 <= length
name*string

Repository name.

Length1 <= length

Query Parameters

ref*string

Branch, tag, or commit ref whose head statuses should be inspected.

Length1 <= length

Response Body

application/json

curl -X GET "https://example.com/v1/repositories/aa/aa/branch-protection-check-contexts?ref=aa"
"abc123"
GET
/v1/repositories/{owner}/{name}/branch-protections

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

owner*string

Repository owner.

Length1 <= length
name*string

Repository name.

Length1 <= length

Response Body

application/json

curl -X GET "https://example.com/v1/repositories/aa/aa/branch-protections"
"abc123"
POST
/v1/repositories/{owner}/{name}/branch-protections

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

owner*string

Repository owner.

Length1 <= length
name*string

Repository name.

Length1 <= length

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/v1/repositories/aa/aa/branch-protections" \  -H "Content-Type: application/json" \  -d '{    "applyToAdmins": false,    "approvalsWhitelistUsernames": [      "abc123"    ],    "blockOnOfficialReviewRequests": false,    "blockOnOutdatedBranch": false,    "blockOnRejectedReviews": false,    "branchName": "aa",    "dismissStaleApprovals": false,    "enableApprovalsWhitelist": false,    "enableMergeWhitelist": false,    "enablePush": false,    "enablePushWhitelist": false,    "enableStatusCheck": false,    "ignoreStaleApprovals": false,    "mergeWhitelistUsernames": [      "abc123"    ],    "protectedFilePatterns": "abc123",    "pushWhitelistDeployKeys": false,    "pushWhitelistUsernames": [      "abc123"    ],    "requireSignedCommits": false,    "requiredApprovals": 1,    "ruleName": "abc123",    "statusCheckContexts": [      "abc123"    ],    "unprotectedFilePatterns": "abc123"  }'
"abc123"
GET
/v1/repositories/{owner}/{name}/branch-protections/{branchName}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

owner*string

Repository owner.

Length1 <= length
name*string

Repository name.

Length1 <= length
branchName*string

Branch name.

Length1 <= length

Response Body

application/json

curl -X GET "https://example.com/v1/repositories/aa/aa/branch-protections/aa"
"abc123"
PATCH
/v1/repositories/{owner}/{name}/branch-protections/{branchName}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

owner*string

Repository owner.

Length1 <= length
name*string

Repository name.

Length1 <= length
branchName*string

Branch name (literal name only — patterns not yet supported).

Length1 <= length

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X PATCH "https://example.com/v1/repositories/aa/aa/branch-protections/aa" \  -H "Content-Type: application/json" \  -d '{    "applyToAdmins": false,    "approvalsWhitelistUsernames": [      "abc123"    ],    "blockOnOfficialReviewRequests": false,    "blockOnOutdatedBranch": false,    "blockOnRejectedReviews": false,    "dismissStaleApprovals": false,    "enableApprovalsWhitelist": false,    "enableMergeWhitelist": false,    "enablePush": false,    "enablePushWhitelist": false,    "enableStatusCheck": false,    "ignoreStaleApprovals": false,    "mergeWhitelistUsernames": [      "abc123"    ],    "protectedFilePatterns": "abc123",    "pushWhitelistDeployKeys": false,    "pushWhitelistUsernames": [      "abc123"    ],    "requireSignedCommits": false,    "requiredApprovals": 1,    "ruleName": "abc123",    "statusCheckContexts": [      "abc123"    ],    "unprotectedFilePatterns": "abc123"  }'
"abc123"
DELETE
/v1/repositories/{owner}/{name}/branch-protections/{branchName}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

owner*string

Repository owner.

Length1 <= length
name*string

Repository name.

Length1 <= length
branchName*string

Branch name.

Length1 <= length

Response Body

application/json

curl -X DELETE "https://example.com/v1/repositories/aa/aa/branch-protections/aa"
"abc123"