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.
Contents
01 Authentication 02 Errors 03 Rate limits 04 You and your token 05 Repositories 06 Pull requests 07 Sandboxes 08 Live branches 09 Actions 10 Approvals
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.
Errors are JSON with a code and a sentence: {"error": "forbidden", "message": "...", "reason": "missing_scope"}.
Status error When
401 unauthorizedNo token, or one that is malformed, unknown, expired or revoked. 403 forbiddenYou can read the repository but the token lacks the scope or the role; reason says which. 403 approval_requiredOnly an owner may do this: the answer includes the approval to start. 404 not_foundThe repository, pull request or sandbox does not exist, or the token cannot see it: the two answers are the same. 409, 422 various A conflict, or a request the server understood but cannot do (a merge that conflicts, a name that is taken). 429 rate_limitedToo many requests; wait for Retry-After seconds.
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.
Request What it does Scope
GET /userWho the token belongs to: the account, organizations, scopes and expiry anyDELETE /tokens/currentThe token revokes itself any
Request What it does Scope
GET /repos/:org/:repoThe repository: visibility, default branch, description repo:readPOST /orgs/:org/reposCreate a private repository: {name, description?, default_branch?, init?: {readme: true}} repo:createPOST /repos/:org/:repo/visibility{visibility}: private at once for an owner; public asks an owner to approve repo:write
Under /repos/:org/:repo. Pull requests has the bodies.
Request What it does Scope
GET /pullsList: ?state=open|closed|merged|all, ?q=, ?author=me repo:readPOST /pullsOpen one: {title, head, base?, body?, draft?, reviewers?} repo:writeGET, PATCH /pulls/:nOne pull request with its merge box; edit, close or reopen it repo:read, repo:writeGET /pulls/:n/commits, /files, /diff, /architectureIts commits, files, unified diff, and what it changes in the architecture repo:readGET, POST /pulls/:n/commentsComments; a new one, on a line or as a reply repo:read, repo:writeGET, POST /pulls/:n/reviewsReviews; submit one: {event: approve|request_changes|comment, body?, comments?} repo:read, repo:writePOST /pulls/:n/reviewersAsk for reviews: {add?, remove?} repo:writePOST /pulls/:n/mergeMerge: {method?: merge|squash|rebase|ff, expect_head?, delete_branch?} repo:write
Request What it does Scope
GET, POST /repos/:org/:repo/sandboxesList; create one: {from?, name?, ttl_s?, live?} repo:write or sandbox:writeGET, DELETE .../sandboxes/:owner/:nameRead or delete one repo:write or sandbox:writePOST .../sandboxes/:owner/:name/mergeMerge: {into?, mode?: ff|merge|squash, expect?, message?} repo:write or sandbox:writePOST .../sandboxes/:owner/:name/checksRun its on: sandbox workflows repo:write or sandbox:write
Request What it does Scope
GET, POST, DELETE /repos/:org/:repo/liveLive branches; turn live on ({ref}) or off (?ref=) live:read, live:writeGET .../live/files, .../live/treeA file with its version; a directory live:readPOST .../live/ops?ref=Edits: {session, ops}, at most 100 live:writeGET .../live/eventsChanges as server-sent events, resumable with Last-Event-ID live:readPOST .../live/locks, .../live/presence, .../live/checkpointSoft locks, presence, a checkpoint now live:write
Request What it does Scope
GET /repos/:org/:repo/actions/runsRuns: ?workflow, ?branch, ?status, ?sha, ?limit, ?cursor actions:readGET .../actions/runs/:idOne run with its jobs actions:readPOST .../actions/runs/:id/cancelCancel a run actions:writePOST .../actions/workflows/:file/dispatchesStart a manual run: {ref, inputs} actions:writeGET .../commits/:sha/statusesA commit's statuses repo:readPOST .../statuses/:shaPost a status: {state, context, description?, target_url?} statuses:write
Request What it does Scope
POST /approvalsAsk an owner: {kind: repo_visibility | agent_create, ...} any tokenGET /approvals/:idThe request's state the token that askedPOST /approvals/:id/pollPoll every 5 seconds; an approved new agent's token comes back once the token that asked