API reference
Pull requests
/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ reviewInline review comments with their file and line, approvals, and how many approvals the pull request still needs.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Errors
400These branches are too far apart to compare.404Repository not found404Pull request not found404Not found404Branch or commit not found.
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/review' \
-H "Authorization: Bearer $CACTIVE_TOKEN"Response 200
{
revisionId: string
base: null | string
head: null | string
approvals: {
id: null | string
name: string
email: null | string
}[]
required: number
rules: {
name: string
required: number
fromTemplate: boolean
satisfied: boolean
}[]
approved: boolean
overridden: boolean
viewerApproved: boolean
threads: {
id: string
path: null | string
line: null | number
side: "new" | "old"
beforeCommitId: null | string
afterCommitId: null | string
outdated: boolean
comments: {
id: string
body: string
author: {
id: null | string
name: string
email: null | string
}
createdAt: null | number
updatedAt: null | number
deleted: boolean
}[]
}[]
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ review/ commentsAdds a review comment: a new thread on a line of the diff (path, line, side), or a reply (inReplyTo).
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Request body
bodystringrequired1–10,240 characters. Trimmed.
inReplyTostring1–256 characters.
pathstring1–4,096 characters.
lineinteger≥ 1.
side"old" | "new"Default
"new".basestringMatches
^[0-9a-f]{40}$.headstringMatches
^[0-9a-f]{40}$.
Errors
400These branches are too far apart to compare.400Choose a line to comment on.404Repository not found404Pull request not found404Not found404Branch or commit not found.409This pull request has no changes to comment on.
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/review/comments' \
-H "Authorization: Bearer $CACTIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"body": "example"
}'Response 201
{
comment: {
id: null | string
}
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ approvalApproves the pull request's current revision, or withdraws your approval. Authors can't approve their own.
- Auth
- A person's token or an API key, as Authorization: Bearer.
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Request body
approvebooleanrequiredrevisionIdstringAt least 1 character.
Errors
403You can't approve your own pull request.404Repository not found404Pull request not found404Not found409This pull request is closed.409New commits were pushed. Review the latest changes, then approve.409This pull request has the maximum number of approvals.
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/approval' \
-H "Authorization: Bearer $CACTIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"approve": true
}'Response 200
{
approved: boolean
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ reopenCodeCommit can't reopen a closed pull request; a new one replaces it under the same number.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
- Allowed
- Author, or
git:write
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Errors
403Only the author or members with git:write can reopen this pull request.404Repository not found404Pull request not found404Not found409Merged pull requests can't be reopened.409Pull request #… is already open for these branches.409The branch … or … no longer exists. Push it again to reopen.409The branches point at the same commit; there is nothing to merge.409Too many open pull requests in this repository.409The pull request changed. Reload and try again.
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/reopen' \
-H "Authorization: Bearer $CACTIVE_TOKEN"Response 200
{
state: string
}/ v1/ orgs/ :orgId/ repos/ :name/ pullsLists pull requests in one state, newest first. Listing open pull requests also settles any that were merged or closed outside the portal.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
Query parameters
state"open" | "closed" | "merged"Default
"open".cursorstringlabelstringUp to 50 characters.
authorstringUp to 64 characters.
assigneestringUp to 64 characters.
Errors
404Repository not found404Not found404Pull request not found
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls' \
-H "Authorization: Bearer $CACTIVE_TOKEN"Response 200
{
pulls: {
number: number
createdAt?: number
updatedAt?: number
orgId: string
title: string
labels?: string[]
repoId: string
state?: "open" | "closed" | "merged"
assignees?: string[]
comments?: number
closedAt?: number
closedBy?: string
authorId: string
authorEmail?: string
authorName?: string
pullRequestId: string
sourceBranch: string
targetBranch: string
mergeCommitId?: string
reviewers?: string[]
previousPullRequestIds?: string[]
}[]
cursor: null | string
}
| {
pulls: {
number: number
createdAt?: number
updatedAt?: number
orgId: string
title: string
labels?: string[]
repoId: string
state?: "open" | "closed" | "merged"
assignees?: string[]
comments?: number
closedAt?: number
closedBy?: string
authorId: string
authorEmail?: string
authorName?: string
pullRequestId: string
sourceBranch: string
targetBranch: string
mergeCommitId?: string
reviewers?: string[]
previousPullRequestIds?: string[]
}[]
cursor: null
}/ v1/ orgs/ :orgId/ repos/ :name/ pullsOpens a pull request that merges source into target.
- Auth
- A person's token or an API key, as Authorization: Bearer.
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
Request body
titlestringrequired1–150 characters. Trimmed.
descriptionstringDefault
"". Up to 10,240 characters.sourcestringrequired1–255 characters.
targetstringrequired1–255 characters.
labelsstring[]Default
[]. Up to 10 items. Each 1–50 characters, trimmed.assigneesstring[]Default
[]. Up to 10 items. Each 1–64 characters.reviewersstring[]Default
[]. Up to 10 items. Each 1–64 characters.
Errors
400Choose two different branches.400Assignees must be members of this organization.400Branch not found.400The branches have diverged too far to compare.404Repository not found409Pull request #… is already open for these branches.409Too many open pull requests in this repository.409Could not create the pull request. Try again.
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls' \
-H "Authorization: Bearer $CACTIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"title": "Example",
"source": "example",
"target": "example"
}'Response 201
{
pull: {
authorId: string
authorEmail?: string
authorName?: string
reviewers?: string[]
repoId: string
orgId: string
number: number
pullRequestId: string
title: string
sourceBranch: string
targetBranch: string
labels: string[]
assignees: string[]
}
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :numberA pull request with its commit range, the merge strategies available now, its comments, and codeowners: the owners each changed path needs an approval from (null without a CODEOWNERS file).
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Errors
400These branches are too far apart to compare.404Repository not found404Pull request not found404Not found404Branch or commit not found.
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}' \
-H "Authorization: Bearer $CACTIVE_TOKEN"Response 200
{
pull: {
state?: "open" | "closed" | "merged"
title: string
description: string
base: null | string
head: null | string
mergeCommitId: null | string
revisionId: null | string
sourceBranchExists: boolean | null
number: number
createdAt?: number
updatedAt?: number
orgId: string
labels?: string[]
repoId: string
assignees?: string[]
comments?: number
closedAt?: number
closedBy?: string
authorId: string
authorEmail?: string
authorName?: string
pullRequestId: string
sourceBranch: string
targetBranch: string
reviewers?: string[]
previousPullRequestIds?: string[]
}
mergeOptions: ("fast-forward" | "squash" | "three-way")[]
conflicts: {
path: string
conflicts: number
binary: boolean
kind: "type" | "mode" | "content"
}[]
comments: {
number: number
createdAt?: number
updatedAt?: number
orgId: string
repoId: string
body: string
authorId: string
authorEmail?: string
authorName?: string
commentId: string
}[]
codeowners: null | {
required: {
pattern: string
owners: string[]
satisfied: boolean
}[]
satisfied: boolean
}
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :numberChanges a pull request's title, description, labels or assignees.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
- Allowed
- Author, or
git:write
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Request body
titlestring1–150 characters. Trimmed.
descriptionstringUp to 10,240 characters.
labelsstring[]Up to 10 items. Each 1–50 characters, trimmed.
assigneesstring[]Up to 10 items. Each 1–64 characters.
reviewersstring[]Up to 10 items. Each 1–64 characters.
Errors
400Assignees must be members of this organization.403Only the author or members with git:write can edit this pull request.404Repository not found404Pull request not found404Not found
curl -X PATCH 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}' \
-H "Authorization: Bearer $CACTIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"title": "Example",
"description": "example",
"labels": [
"example"
]
}'Response 200
{
pull: {
number: number
createdAt?: number
updatedAt?: number
orgId: string
title: string
labels?: string[]
repoId: string
state?: "open" | "closed" | "merged"
assignees?: string[]
comments?: number
closedAt?: number
closedBy?: string
authorId: string
authorEmail?: string
authorName?: string
pullRequestId: string
sourceBranch: string
targetBranch: string
mergeCommitId?: string
reviewers?: string[]
previousPullRequestIds?: string[]
}
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ commitsCommits the pull request adds to its target.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Errors
400These branches are too far apart to compare.404Repository not found404Pull request not found404Not found404Branch or commit not found.404Commit not found
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/commits' \
-H "Authorization: Bearer $CACTIVE_TOKEN"Response 200
{
commits: {
id: string
message: string
author: {
name?: string
email?: string
date?: number
}
parents: string[]
committedAt?: number
}[]
truncated: boolean
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ filesChanged files with unified diffs.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Errors
400These branches are too far apart to compare.404Repository not found404Pull request not found404Not found404Branch or commit not found.
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/files' \
-H "Authorization: Bearer $CACTIVE_TOKEN"Response 200
{
files: []
total: number
truncated: false
base: null
head: null
}
| {
base: null | string
head: string
files: {
path: string
previousPath?: string
change: "added" | "deleted" | "modified" | "renamed"
similarity?: number
additions: number
deletions: number
binary?: boolean
collapsed?: boolean
hunks: {
oldStart: number
oldLines: number
newStart: number
newLines: number
lines: string[]
}[]
}[]
total: number
truncated: boolean
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ mergeMerges the pull request. Pass sourceCommitId (the head you reviewed) to fail if the branch has moved since. Into a ruled branch it needs the rule's approvals and code owner reviews (409 otherwise) and a clean secret scan (422); bypass: true merges without the reviews for people on the bypass list, audited.
- Auth
- A person's token or an API key, as Authorization: Bearer.
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Request body
strategy"squash" | "fast-forward" | "three-way"requiredmessagestringUp to 4,096 characters. Trimmed.
sourceCommitIdstringMatches
^[0-9a-f]{40}$.bypassboolean
Errors
400… has no branch rule to bypass.400These branches are too far apart to compare.403Only people on …'s bypass list can merge without required reviews.404Repository not found404Pull request not found404Not found404Branch or commit not found.409This pull request is already closed.409This pull request needs … approval… before it can be merged into ….409This pull request needs a review from a code owner of ….409This pull request can't be merged automatically with that strategy.409The source branch changed. Reload and try again.409The target branch changed. Try again.409The branches have diverged too far to merge.409This pull request needs more approvals before it can be merged.
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/merge' \
-H "Authorization: Bearer $CACTIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"strategy": "squash"
}'Response 200
{
merged: true
mergeCommitId: null | string
closedIssues: number[]
}Response 202
{
status: string
scanned: number
}Response 422
{
error: string
code: string
findings: {
line: number
fingerprint: string
preview: string
path?: string
rule: "aws_access_key" | "aws_secret_key" | "stripe_key" | "private_key" | "si_token" | "github_token"
label: string
}[]
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ closeCloses the pull request without merging.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
- Allowed
- Author, or
git:write
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Errors
403Only the author or members with git:write can close this pull request.404Repository not found404Pull request not found404Not found
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/close' \
-H "Authorization: Bearer $CACTIVE_TOKEN"Response 200
{
state?: "closed" | "merged"
}
| {
state: string
}
| {
state?: "open" | "closed" | "merged"
}/ v1/ orgs/ :orgId/ repos/ :name/ pulls/ :number/ commentsAdds a comment to a pull request.
- Auth
- A person's token or an API key, as Authorization: Bearer.
- Scope
- git:read
Path parameters
orgIdOrganization id (
org_…).nameRepository name.
numberIssue or pull request number, or under
pipelinesa run number.
Request body
bodystringrequired1–65,536 characters. Trimmed.
Errors
404Repository not found404Pull request not found404Not found409Could not add the comment. Try again.
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/comments' \
-H "Authorization: Bearer $CACTIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"body": "example"
}'Response 201
{
comment: {
authorId: string
authorEmail: string
authorName?: string
repoId: string
orgId: string
number: number
commentId: string
body: string
} | {
authorId: string
authorEmail?: undefined
authorName?: undefined
repoId: string
orgId: string
number: number
commentId: string
body: string
}
}