Rebasely Beta: data may be purged
View as Markdown

REST API

Everything the web pages and the CLI do with repositories, pull requests, sandboxes, live branches and Actions, as JSON under https://rebasely.com/api/v1.

Authentication

Send an access token in Authorization: Bearer <token>. Personal tokens start with dgp_, agent tokens with dga_. A token works within its scopes, its organization (or, for a token of all your organizations, wherever you are a member, with your role there) and the repositories it is limited to; Access tokens lists the scopes.

Shell
curl -fsS -H "Authorization: Bearer $REBASELY_TOKEN" https://rebasely.com/api/v1/user
JavaScript
const res = await fetch("https://rebasely.com/api/v1/repos/acme/app/pulls?state=open", {
  headers: { authorization: `Bearer ${process.env.REBASELY_TOKEN}` },
});
const { pulls } = await res.json();

Errors

Errors are JSON with a code and a sentence: {"error": "forbidden", "message": "...", "reason": "missing_scope"}.

StatuserrorWhen
401unauthorizedNo token, or one that is malformed, unknown, expired or revoked.
403forbiddenYou can read the repository but the token lacks the scope or the role; reason says which.
403approval_requiredOnly an owner may do this: the answer includes the approval to start.
404not_foundThe repository, pull request or sandbox does not exist, or the token cannot see it: the two answers are the same.
409, 422variousA conflict, or a request the server understood but cannot do (a merge that conflicts, a name that is taken).
429rate_limitedToo many requests; wait for Retry-After seconds.

Rate limits

1,200 requests a minute per token (or per signed-in person), and 600 a minute per agent across all its tokens. Lists page with ?limit= (1 to 100, 25 by default) and a cursor: ?cursor= for Actions runs, ?before= for pull requests.

You and your token

RequestWhat it doesScope
GET /userWho the token belongs to: the account, organizations, scopes and expiryany
DELETE /tokens/currentThe token revokes itselfany

Repositories

RequestWhat it doesScope
GET /repos/:org/:repoThe repository: visibility, default branch, descriptionrepo:read
POST /orgs/:org/reposCreate a private repository: {name, description?, default_branch?, init?: {readme: true}}repo:create
POST /repos/:org/:repo/visibility{visibility}: private at once for an owner; public asks an owner to approverepo:write

Pull requests

Under /repos/:org/:repo. Pull requests has the bodies.

RequestWhat it doesScope
GET /pullsList: ?state=open|closed|merged|all, ?q=, ?author=merepo:read
POST /pullsOpen one: {title, head, base?, body?, draft?, reviewers?}repo:write
GET, PATCH /pulls/:nOne pull request with its merge box; edit, close or reopen itrepo:read, repo:write
GET /pulls/:n/commits, /files, /diff, /architectureIts commits, files, unified diff, and what it changes in the architecturerepo:read
GET, POST /pulls/:n/commentsComments; a new one, on a line or as a replyrepo:read, repo:write
GET, POST /pulls/:n/reviewsReviews; submit one: {event: approve|request_changes|comment, body?, comments?}repo:read, repo:write
POST /pulls/:n/reviewersAsk for reviews: {add?, remove?}repo:write
POST /pulls/:n/mergeMerge: {method?: merge|squash|rebase|ff, expect_head?, delete_branch?}repo:write

Sandboxes

RequestWhat it doesScope
GET, POST /repos/:org/:repo/sandboxesList; create one: {from?, name?, ttl_s?, live?}repo:write or sandbox:write
GET, DELETE .../sandboxes/:owner/:nameRead or delete onerepo:write or sandbox:write
POST .../sandboxes/:owner/:name/mergeMerge: {into?, mode?: ff|merge|squash, expect?, message?}repo:write or sandbox:write
POST .../sandboxes/:owner/:name/checksRun its on: sandbox workflowsrepo:write or sandbox:write

Live branches

RequestWhat it doesScope
GET, POST, DELETE /repos/:org/:repo/liveLive branches; turn live on ({ref}) or off (?ref=)live:read, live:write
GET .../live/files, .../live/treeA file with its version; a directorylive:read
POST .../live/ops?ref=Edits: {session, ops}, at most 100live:write
GET .../live/eventsChanges as server-sent events, resumable with Last-Event-IDlive:read
POST .../live/locks, .../live/presence, .../live/checkpointSoft locks, presence, a checkpoint nowlive:write

Actions

RequestWhat it doesScope
GET /repos/:org/:repo/actions/runsRuns: ?workflow, ?branch, ?status, ?sha, ?limit, ?cursoractions:read
GET .../actions/runs/:idOne run with its jobsactions:read
POST .../actions/runs/:id/cancelCancel a runactions:write
POST .../actions/workflows/:file/dispatchesStart a manual run: {ref, inputs}actions:write
GET .../commits/:sha/statusesA commit's statusesrepo:read
POST .../statuses/:shaPost a status: {state, context, description?, target_url?}statuses:write

Approvals

RequestWhat it doesScope
POST /approvalsAsk an owner: {kind: repo_visibility | agent_create, ...}any token
GET /approvals/:idThe request's statethe token that asked
POST /approvals/:id/pollPoll every 5 seconds; an approved new agent's token comes back oncethe token that asked