Skip to content
GroundboxDocs
API referenceStatusPricing
DashboardStart free
GroundboxRunners for GitHub Actions and GitLab CI, and Linux sandboxes for AI agents. One key, one bill.System status

Product

CI runnersSandboxesBuilds and cacheAgent computersUse casesPricing

Developers

DocsAPI referenceAPI explorerCLIMCP serverBenchmark

Compare

vs GitHub-hostedvs Blacksmithvs E2Bvs DaytonaAll comparisons

Company

Talk to usSupportChangelogcontact@groundbox.devGroundmail ↗
© 2026 Groundbox
TermsPrivacyllms.txt
OverviewCI in one lineFirst sandboxHand it to your agent
Sizes and labelsCachesEmail when a run failsFast checkoutBuild cachesMigrateGroundbox or GitHub firstWhen GitHub's runners are stuckCI checkupRuns, logs and insightsci waitTerminal on a jobDr. GroundbotWebhooksSlackPublic repositoriesAuto sizeAuto size: own runnersFlexCI tune-upMerge queueSplit tests by timeAndroid buildsmacOS buildsWindows buildsArm64 LinuxDocker buildsGitLab CIForgejo and GiteaGitCafeBitbucket PipelinesAzure DevOps
Start, exec, filesCommands as rootFrom a Docker imagePrivate imagesCommandsForkTime machineSnapshotsPause and resumeStop and startIdle pause and wakeScheduled runsPreviewsSecretsSecret bindingsSandbox webhooksEgress allowlistFlex sandboxesTemplatesVolumes
Push and pullIn GitHub ActionsStorage and retention
Desktop and actionsLive view in your appHuman handoffSign in onceAgent loop example
BucketsAccess keysMount a bucket
Move from Runloop
OmnaraConnect with Groundbox
REST APIAPI explorerOpenAPI referenceCLIMCP serverSDKsKeys and capsBilling and usageBefore the free minutes run outSupport ticketsLeave or delete a team
  1. Integrations
  2. Connect with Groundbox
Markdown
Open in
ClaudeChatGPT
On this page

    Connect with Groundbox

    If your product runs your users' CI jobs or sandboxes on Groundbox, add a Connect with Groundbox button instead of asking them to make and paste an API key. Your user signs in to Groundbox, or creates an account on the way, picks the team, and approves. Your app gets an ordinary Groundbox API key for that team, with the scopes you asked for.

    It is OAuth 2.1's authorization code flow with PKCE, the same one Groundbox's MCP server uses, so any OAuth library works.

    Get a client ID

    Write to us through support with your app's name, its redirect URIs, a square logo (https) and its website. We register it as a verified partner app and send you its client ID (gbc_...). Your users see your name and logo on the consent page marked as verified, and the accounts created through your button are counted as yours.

    Redirect URIs must be https, http on localhost, or an app's own scheme, with no fragment, and must match exactly (any port on localhost). To try the flow before then, register a client yourself with POST /oauth/register (dynamic registration); the consent page shows its name as given, not verified.

    The flow

    1. Send your user's browser to the authorize URL. Make a fresh code_verifier (43 to 128 characters) and a state for each connection and keep both with the user's session.
      Text
      https://api.groundbox.dev/oauth/authorize
        ?response_type=code
        &client_id=gbc_...
        &redirect_uri=https://yourapp.example/connect/groundbox/callback
        &scope=ci:read ci:write account:read billing:read
        &state=<random, tied to your user's session>
        &code_challenge=<base64url(sha256(code_verifier))>
        &code_challenge_method=S256
    2. Your user signs in or signs up, picks a team and approves. Someone without an account can create one on the way, with $5 of free usage and no card. Add prompt=create to open on sign-up when you know the person is new.
    3. Groundbox sends the browser back to your redirect URI with code and your state, or with error=access_denied if they said no. Check the state.
    4. Trade the code for the key within two minutes. A code works once, and a wrong verifier burns it.
      Terminal
      curl -X POST https://api.groundbox.dev/oauth/token \
        -d grant_type=authorization_code \
        -d code=gbo_... \
        -d redirect_uri=https://yourapp.example/connect/groundbox/callback \
        -d client_id=gbc_... \
        -d code_verifier=<the verifier you made for this connection>
      JSON
      {
        "access_token": "gbx_...",
        "token_type": "Bearer",
        "scope": "ci:read ci:write account:read billing:read"
      }

    The same in Node:

    TypeScript
    import { createHash, randomBytes } from "node:crypto";
    
    // When your user clicks "Connect with Groundbox":
    const verifier = randomBytes(32).toString("base64url");
    const challenge = createHash("sha256").update(verifier).digest("base64url");
    const state = randomBytes(16).toString("base64url");
    // Keep verifier and state with the user's session, then redirect:
    const url = new URL("https://api.groundbox.dev/oauth/authorize");
    url.search = new URLSearchParams({
      response_type: "code",
      client_id: process.env.GROUNDBOX_CLIENT_ID,
      redirect_uri: "https://yourapp.example/connect/groundbox/callback",
      scope: "ci:read ci:write account:read billing:read",
      state,
      code_challenge: challenge,
      code_challenge_method: "S256",
    }).toString();
    
    // On the callback: check state, then trade the code for the key.
    const response = await fetch("https://api.groundbox.dev/oauth/token", {
      method: "POST",
      headers: { "content-type": "application/x-www-form-urlencoded" },
      body: new URLSearchParams({
        grant_type: "authorization_code",
        code: callbackParams.get("code"),
        redirect_uri: "https://yourapp.example/connect/groundbox/callback",
        client_id: process.env.GROUNDBOX_CLIENT_ID,
        code_verifier: verifier,
      }),
    });
    const { access_token } = await response.json(); // gbx_..., store it encrypted

    Scopes

    Ask for what your app needs, space-separated in scope; your user sees each one in plain words before approving. Leave it out and you get the MCP set: sandboxes, schedules, storage, ci:read and account:read. The full list is under Keys and caps. A CI runner provider usually wants ci:read ci:write account:read billing:read.

    Usage and limits

    With account:read, GET /v1/account answers the team's balance, its usage this month and its limits. With billing:read, GET /v1/billing answers the plan and billing settings, and GET /v1/billing/usage the usage by day.

    Terminal
    curl https://api.groundbox.dev/v1/account -H "Authorization: Bearer gbx_..."
    curl https://api.groundbox.dev/v1/billing -H "Authorization: Bearer gbx_..."

    The key

    • It does not expire, so there is no refresh token. Store it as you would a password. It stops working when your user revokes it on the dashboard's API keys page, where it is listed under your app's name and can be given a spend cap.
    • When your user disconnects Groundbox in your app, revoke the key:
      Terminal
      curl -X POST https://api.groundbox.dev/oauth/revoke -d token=gbx_...
    • It spends from the team your user picked. Each connection makes a new key; connecting again does not end the old one, so revoke it.

    Questions: support.

    ← PreviousOmnaraNext →REST API
    System statusSupportPricingllms.txtgroundbox.dev