Every request to the review API carries a Proofline token in the Authorization header, limited to the scopes and repositories chosen when the token was created.
Each token on this page works in one organization; an MCP OAuth connection can cover several, as Organization selection describes.
import { ProoflineClient } from "@proofline/sdk";
// The client sends the token in the Authorization header of every request.
const client = new ProoflineClient({
baseUrl: "https://proofline.sh",
token: process.env.PROOFLINE_TOKEN!,
});
const page = await client.listReviews({
path: { org_id: process.env.PROOFLINE_ORGANIZATION_ID! },
});
console.log(page.items.length);import os
from uuid import UUID
from proofline import ProoflineClient
# The client sends the token in the Authorization header of every request.
with ProoflineClient(os.environ["PROOFLINE_TOKEN"], base_url="https://proofline.sh") as client:
page = client.list_reviews(UUID(os.environ["PROOFLINE_ORGANIZATION_ID"]))
print(len(page.items))curl -sS --fail-with-body "https://proofline.sh/api/v1/organizations/$PROOFLINE_ORGANIZATION_ID/reviews" \
-H "Authorization: Bearer $PROOFLINE_TOKEN"Tokens#
A token acts with its holder's current GitHub identity and access. Through the review API, every token reads or requests reviews and never changes configuration, billing, seats, cloud access, integrations or other tokens. Those actions need a signed-in browser.
An organization administrator can approve a CLI device sign-in or an MCP OAuth connection with the setup and configuration permissions. The agent holding it can then set up Proofline and change ordinary settings through the MCP server, and propose sensitive changes, which wait for an administrator's approval in a browser. Both need a sign-in or connection approved for every repository of the organization. Personal, organization and CI job tokens never gain these permissions. See Change settings from your agent.
| Kind | Created by | Default lifetime | Kind limit |
|---|---|---|---|
| Personal | You, from Personal tokens in the account menu | 30 days | 90 days |
| Organization | An administrator, from the organization's API tokens settings | 90 days | 365 days |
| CLI device | A command-line tool, through device sign-in | 14 days | 14 days |
The kind limit is the longest any token of that kind can last. Each organization's key policy sets a second limit, its maximum lifetime, which is 90 days until an owner saves a policy. A new token can last no longer than the lower of the two, so an organization token lasts more than 90 days only after an owner saves a higher maximum.
A request to create a token that omits the expiry gets the kind's default lifetime, or the policy maximum when that is lower. A request that names an expiry gets exactly that lifetime: one above the kind limit or the policy maximum is refused, never shortened. The console's Expires in field starts at the kind's default and always sends it, so under a lower maximum, enter a lifetime within it. A CLI device token always lasts 14 days, and a policy maximum below that refuses the approval, as Approve in the browser describes.
Under these example maximums, a new token gets:
| Policy maximum | CLI device sign-in | Personal, expiry omitted | Organization, expiry omitted | Organization, 365 days requested |
|---|---|---|---|---|
| 90 days, not saved | 14 days | 30 days | 90 days | Refused |
| 365 days | 14 days | 30 days | 90 days | 365 days |
| 30 days | 14 days | 30 days | 30 days | Refused |
| 7 days | Approval refused | 7 days | 7 days | Refused |
The console shows a token's secret once, when you create it. Revoking a token takes effect on its next request.
A CI job in GitHub Actions needs none of these. It exchanges the runner's signed identity for a CI job token that holds only reviews:read for the job's repository, as the CI review check describes.
Scopes#
Each operation needs one scope. Give a token only the scopes its job needs.
| Scope | Operations |
|---|---|
analytics:read | exportReviews |
reviews:read | listRepositories, listReviews, getReview, getReviewRouting, getDeploymentReview, listPullRequestReviews, getPullRequestReview, getCommitDeployVerifications |
findings:read | getAssessment, getFinding, getFindingFixPrompt |
guidance:read | getReviewGuidance |
agent_sessions:start | getAgentSession, getAgentSessionPrompt, startAgentSession |
reviews:rerun | rerunReview |
reviews:request | stopReview, requestCommitReview, requestFileReview, requestPatchReview, requestReview |
coverage:write | uploadCoverageReports |
scans:request | requestScan |
You can further restrict a token to a list of repositories. Organization tokens that request or rerun reviews must name those repositories. A restricted token can never hold setup:write or org:configure: only a device sign-in or MCP OAuth connection approved for every repository carries them.
Proofline also checks the holder's current GitHub access when a review is requested. Pull request reviews and reruns require write access. Reviews of local changes require read access, because their results are never posted to GitHub.
Errors#
Errors are RFC 9457 problem documents, and the HTTP status is authoritative.
| Status | Meaning |
|---|---|
| 400 | The request sent both a session cookie and a token. |
| 401 | The token is missing, malformed, expired or revoked. |
| 403 | The token lacks the operation's scope, the organization key policy does not allow that scope, the request came from a client address outside the policy's networks, the holder lacks the GitHub access a review request needs, or the organization's single sign-on refuses the credential. The problem's detail says which. |
| 404 | The organization or object is outside what the token can see. |
| 429 | The token made more than 600 requests or 60 export requests in a minute, or you have started the most developer reviews an hour allows. Too many requests tells them apart. |
A 404 also answers when the holder has left the organization, or when the administrator who created an organization token has lost that role.
Too many requests#
Three limits answer 429. Each sends the problem title rate limited, no code and Retry-After: 60, so the status and the header alone do not say which one refused. The operation you sent and the problem's detail do. The limits count different things, and waiting clears them differently.
| Limit | What it counts | What it refuses |
|---|---|---|
| Token request limit | Every request one token or service account key sends, over a minute | Any request past 600 in that minute |
| Export limit | The export requests one token or service account key sends, over a minute, first pages and continuations alike | An export request past 60 in that minute |
| Developer review allowance | The patch, commit and file reviews one person has started in the organization in the last hour | A request for a new one of those reviews once that person's hourly allowance is used |
Every request counts against the token request limit, export and review requests included. Only an export request, GET /api/v1/organizations/{org_id}/exports/{dataset}, can meet the export limit, and only a request for a new patch, commit or file review can meet the allowance. A 429 on any other request, such as a GET while you wait for a review, comes from the token request limit. On an export or review request, either that request's own limit or the token request limit can refuse, and detail names which: the token request limit names the token's requests per minute, the export limit names the token's export requests per minute, and the allowance names how many developer reviews you started in the organization in the last hour.
The token request limit clears within a minute. Wait for Retry-After, send the same request again, and poll less often if it recurs. The SDKs already retry a GET that returns 429, as Errors and retries describes.
The export limit also clears within a minute. A refused export request returns no rows and no cursor, and it leaves the export where it was, so a refused continuation is resumed by repeating it:
- Keep the pages that arrived before the refusal, and treat them as partial: an export is complete only when a page arrives without a next cursor.
- Wait for
Retry-After. - Send the refused request again with the same dataset,
from,to,format,group_byandcursor. Do not start a new export, which would fix a new horizon. - Continue with the cursor of each page that arrives until a page carries none.
If the retry returns 400 cursor does not belong to this export, the cursor no longer works, and you start the export again from its first page. Read every page gives the paging procedure, and HTTP request the headers that carry the cursor.
The allowance counts the person who starts the review, not the token. Every patch, commit and file review you start in the organization counts against the same allowance, whichever of your tokens or sign-ins sent the request, so another token, a new sign-in or a slower poll does not clear it. A service account key's reviews count against its service account. The refused request starts nothing and debits no credits. A place frees only when a review you started an hour earlier leaves the window, so a new request sent after Retry-After can be refused again: the header names the earliest retry, not the moment a place frees. Reviews you already started keep running, and you can read them in the meantime.
A request that repeats one Proofline already admitted is never refused by the allowance and does not count against it. It returns the earlier review with HTTP 200 and existing: true. A repeat is the same patch on the same base with the same findings to re-verify, the same base and head commits, or the same files at the same commit requested by you again. It is still a request, so the token request limit counts it.
A GitHub Actions job that requests a commit review with its CI job token, as A pull request with no review describes, is never refused by the allowance. That review still counts against the allowance of the person whose action started the run, so it can bring their own later requests to the limit. The exception covers only the job's own request with its CI job token: a review a workflow requests with a personal or organization token is counted and refused like any other.
Single sign-on#
An organization that enforces single sign-on admits a person's credential only while that person has a current sign-in at the organization's identity provider. The sign-in belongs to the person's signed-in browser session, not to the token. A personal or CLI device token can therefore be unexpired, hold the operation's scope and reach the repository, and still be refused once the session's sign-in expires or the person signs out of the console.
The REST API then answers 403 with a problem that names the cause:
{
"title": "forbidden",
"status": 403,
"detail": "acme requires single sign-on. Sign in to the Proofline console through its identity provider, then retry.",
"code": "sso_required",
"organization_id": "0199b000-0000-7000-8000-000000000001"
}
Test code rather than the wording of detail. organization_id names the organization whose sign-in is missing. The API reference does not declare these two members, so read them from the response body. A new token, another scope or another network does not help. The token's holder renews the sign-in, as Restore personal token access after SSO expires describes, and then retries the same request with the same token.
The rule depends on whether a person signs in for the credential:
| Credential | While the organization enforces single sign-on |
|---|---|
| Personal token, CLI device token, MCP OAuth connection | Works while its holder's sign-in is current. After the sign-in lapses, it is refused with sso_required until the holder signs in again. |
| Organization token, service account key | Refused with 403 and no code, for as long as enforcement is on. No person signs in for it, so nobody's sign-in restores it. |
| CI job token | Unaffected. GitHub's signed workflow identity authorizes the job's own repository, so a 403 in a GitHub Actions job has one of the other causes above. |
An integration that used an organization token or service account key needs another credential: the CI job token in GitHub Actions, or a person's token outside it. Plan for automation before requiring organization SSO helps an owner find these integrations before enforcement starts.
An MCP client meets the same rule in its own shapes. When single sign-on refuses every organization the credential holds, the MCP endpoint refuses the HTTP request before any tool runs, with the same 403 sso_required problem. When an MCP OAuth connection still reaches other organizations, the enforcing one drops out of list_organizations until its sign-in is renewed, and a call that names it returns NOT_AUTHORIZED. A tool call the server refuses for single sign-on returns a tool result instead of an HTTP error. The result has isError set, and its error holds the code NOT_AUTHORIZED, retryable: false and the message This organization requires single sign-on. Sign in to the Proofline console through its identity provider, then retry. It carries no sso_required code and no organization_id, so the agent reports the message, and its person renews the sign-in for the organization the call named.
Organization key policy#
An organization owner can narrow every token in the organization with its key policy: which scopes tokens may use, the longest lifetime a new token may have, and which client networks may send requests. Until an owner saves a policy, every scope is allowed, a new token lasts at most 90 days, and any network may send requests. An owner can save a maximum lifetime from 1 to 365 days, and Tokens shows how it combines with each kind's limit. Because a CLI device token always lasts 14 days, a maximum below that refuses every device sign-in approval, as Approve in the browser describes.
A request can use only the scopes its token holds that the policy also allows. A policy change leaves existing tokens' scopes and expiry dates as they are, and allowing a scope again restores it only to tokens that already hold it. Under a shorter maximum, the owner's token list marks each personal, organization and CLI device token whose original lifetime exceeds it. An MCP OAuth connection is checked against the current limit each time it refreshes, so one older than the new limit stops refreshing and its person must reconnect. A longer limit extends no existing token or connection. With client networks set, a request from any other address returns 403. The help center describes how an owner restricts token requests to approved client networks.
Device sign-in#
A command-line tool signs in through your browser, so you never copy a token. The tool asks for a code, opens the approval page, and waits while you choose the organization, the scopes and the repositories. proofline login does all of this; the steps below are for a tool of your own.
Request a code#
Send the scopes the tool needs to POST /auth/device/code, as a JSON scopes array:
curl -sS -X POST https://proofline.sh/auth/device/code \
-H "Content-Type: application/json" \
-d '{"scopes":["reviews:read","findings:read"]}'
An OAuth form body works too, with the scopes space-separated in one scope field: --data-urlencode "scope=reviews:read findings:read". Send one of the two. A request with neither asks for reviews:read, findings:read and guidance:read.
A code can ask for one to ten distinct scopes. Device sign-in never issues knowledge:read, agent_sessions:start, plans:implement or coverage:write, and a request for any of them answers invalid_scope. For those, create a token in the console, as Tokens describes. The pages for the knowledge commands, cloud coding-agent sessions and coverage uploads name the kind of token each needs.
The response holds everything the tool needs for the approval and the wait:
{
"device_code": "EXAMPLE7DEVICE7CODE7ONLY7EXAMPLE7DEVICE7CODE7ONLY7AB",
"user_code": "WDJB-MJHT",
"verification_uri": "https://proofline.sh/auth/device",
"verification_uri_complete": "https://proofline.sh/auth/device?user_code=WDJB-MJHT",
"expires_in": 600,
"interval": 5
}
| Field | What the tool does with it |
|---|---|
verification_uri_complete | Opens it in the browser. The page has the code filled in |
user_code | Shows it in the terminal, so you can check it against the page. Without a browser to open, show it with verification_uri |
device_code | Keeps it private and sends it on every poll |
interval | Waits this many seconds before the first poll and between polls |
expires_in | Stops polling this many seconds after the response, when the code expires |
The device code and the user code are secrets until the code expires: anyone holding the device code receives the token once you approve it.
Approve in the browser#
You approve in a signed-in browser. The page asks you to choose one organization, and lets you narrow the request before you approve:
- Permissions: clear scopes the tool should not have. You can grant fewer scopes than the tool asked for, never more.
- Repositories: limit the token to chosen repositories. Otherwise it reaches every repository of the organization that you can reach.
The token acts as you, so its access also follows your membership and your GitHub repository permissions.
The setup and configuration scopes, setup:write and org:configure, need more: an organization administrator with a sign-in from the last 24 hours, and every repository. They cover the whole organization, so if you limit Repositories, the approval is refused until you allow every repository or clear those scopes. Change settings from your agent describes what they allow.
The token lasts 14 days, and the page offers no other lifetime. When the organization's key policy sets a maximum lifetime below 14 days, the approval is refused with a message that names the maximum. An owner can set a maximum lifetime that keeps CLI sign-in working. Then approve the code again, or request a new one if it has expired.
Poll for the token#
The tool sends the device code to POST /auth/device/token with the device grant type, as JSON or an OAuth form:
curl -sS -X POST https://proofline.sh/auth/device/token \
-H "Content-Type: application/json" \
-d "{\"grant_type\":\"urn:ietf:params:oauth:grant-type:device_code\",\"device_code\":\"$DEVICE_CODE\"}"
Until the token is issued, each poll answers HTTP 400 with an OAuth error:
{"error": "authorization_pending", "error_description": "Approve the code in a signed-in browser before polling again."}
error | Meaning | What the tool does |
|---|---|---|
authorization_pending | Nobody has approved the code yet | Waits the interval and polls again |
slow_down | The poll came before the interval had passed | Adds five seconds to the interval for every later poll, then polls again |
expired_token | The code expired, or it already issued its token | Stops and starts sign-in again |
access_denied | The person who approved has since lost access to the organization or a chosen repository, or the key policy has since refused the token's lifetime or scopes | Stops. Every later poll gives the same answer, so start sign-in again once access is restored |
The approval is checked again when the token is issued, so access_denied can follow an approval when a membership, role, repository access or the key policy changed in between.
When the approval holds, the poll answers HTTP 200 with the token:
{
"access_token": "pld_EXAMPLE_ONLY",
"token_type": "Bearer",
"expires_in": 1209600,
"scope": "reviews:read",
"organization_id": "0199b000-0000-7000-8000-000000000001"
}
The token is a CLI device token that lasts 14 days. Read the granted scopes from scope, because the approver may have narrowed them: in this example the tool asked for findings:read too. Put organization_id in every API path; the token works only in that organization. Each code issues one token, however many times it is polled, and polling it again answers expired_token.
This function follows those rules. It needs jq:
poll_device_token() {
interval=$INTERVAL
deadline=$(( $(date +%s) + $EXPIRES_IN ))
while :; do
sleep "$interval"
if [ "$(date +%s)" -ge "$deadline" ]; then
echo "The code expired before it was approved. Request a new code." >&2
return 1
fi
response=$(curl -sS --max-time 30 -w '\n%{http_code}' -X POST https://proofline.sh/auth/device/token \
-H "Content-Type: application/json" \
-d "{\"grant_type\":\"urn:ietf:params:oauth:grant-type:device_code\",\"device_code\":\"$DEVICE_CODE\"}") || {
echo "The poll did not reach Proofline. Request a new code." >&2
return 1
}
http_status=$(printf '%s\n' "$response" | tail -n 1)
body=$(printf '%s\n' "$response" | sed '$d')
if [ "$http_status" = 200 ]; then
if printf '%s' "$body" | jq -e '
(.access_token | type == "string" and length > 0)
and (.token_type | type == "string" and ascii_downcase == "bearer")
and (.expires_in | type == "number" and . > 0)
and (.scope | type == "string" and length > 0)
and (.organization_id | type == "string" and test("^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$"))
' >/dev/null 2>&1; then
token=$(printf '%s' "$body" | jq -r .access_token)
organization=$(printf '%s' "$body" | jq -r .organization_id)
scope=$(printf '%s' "$body" | jq -r .scope)
printf 'Signed in to %s with %s\n' "$organization" "$scope"
return 0
fi
echo "The token response lacks a usable token, organization or scope. Request a new code." >&2
return 1
fi
error=$(printf '%s' "$body" | jq -r 'if type == "object" and (.error | type) == "string" then .error else empty end' 2>/dev/null)
case "$error" in
authorization_pending) ;;
slow_down) interval=$(( interval + 5 )) ;;
"")
echo "Proofline answered HTTP $http_status without an OAuth error. Request a new code." >&2
return 1 ;;
*)
printf 'Sign-in stopped (%s): %s\n' "$error" "$(printf '%s' "$body" | jq -r '.error_description // ""')" >&2
return 1 ;;
esac
done
}
poll_device_token
Set INTERVAL, EXPIRES_IN and DEVICE_CODE from the code response before you run it; its last line starts the polling. The function returns 0 only for an HTTP 200 answer that holds a bearer access_token, a positive expires_in, the granted scope and an organization_id. It then leaves the token in token, the organization in organization and the scopes in scope, and prints neither the token nor the device code. A refusal, an answer it cannot read, a failed request or the code's expiry makes it print why on standard error and return 1, so a script can stop on its status, as in poll_device_token || exit 1. To try again, request a new code.
Organization selection#
A device sign-in names the organization you approved, so the CLI uses it for every command. With two other credentials, each command has to name the organization it acts in:
- a token the CLI reads from
PROOFLINE_TOKEN, as in a CI job or a script; - an MCP OAuth credential approved for several organizations, such as the one a coding agent's MCP client holds.
In the CLI, pass --org ORGANIZATION_ID or set PROOFLINE_ORGANIZATION_ID. The flag takes precedence over the variable. With a stored device sign-in, the CLI keeps the approved organization and refuses a different one.
The knowledge, fix and configuration commands, such as proofline wiki, proofline fix and proofline config, send the selected organization as organization_id in each MCP tool call. proofline --org ORGANIZATION_ID wiki list --repo owner/name reads that organization's wiki pages. proofline mcp, the bridge a coding agent runs, forwards the agent's messages unchanged: an organization_id the agent puts in a tool call reaches the server as written, and the bridge adds none of its own.
In the SDKs, list the organizations an MCP OAuth credential can reach with client.mcp.list_organizations() in Python or client.mcp.listOrganizations() in TypeScript. Each entry has an organization_id, a github_login and its scopes. Pass the chosen ID on each knowledge or fixes call. Python takes the organization_id keyword. TypeScript takes organization_id in a method's argument object, or in a final { organization_id } options object when the method takes plain values. The selection applies to that call only, and a credential for one organization can omit it.
Selection grants no authority. The server checks every call against the organizations, scopes and repositories the credential holds. A target outside them returns NOT_AUTHORIZED, and an omitted target that could mean several organizations returns ORGANIZATION_REQUIRED. The CLI then exits nonzero and the SDK result has isError set; neither picks another organization or retries the call. MCP OAuth credentials work only with MCP, so they cannot call the REST API or the CLI's REST commands, such as proofline reviews.