Skip to content

create_gateway_token returns 500 'Missing x-account-id header' #840

Description

@atsaplin

Summary

POST /v1/devboxes/{id}/create_gateway_token (exposed as sdk.api.devboxes.createGatewayToken in 1.32.0) consistently returns HTTP 500:

500 Failed to mint gateway token: INTERNAL: INTERNAL: UNAUTHENTICATED: Missing x-account-id header

This is the only documented way to mint a fresh devbox-bound gateway token, so it blocks the workaround for the suspend/resume gateway-token invalidation (separate report).

Reproduction

const sdk = new RunloopSDK({ bearerToken: process.env.RUNLOOP_API_KEY });

const db = await sdk.devbox.create({
  name: "mintsdk",
  blueprint_name: "...",
  gateways: { OPENROUTER: { gateway: "openrouter-gateway", secret: "OPENROUTER_KEY" } },
});

await sdk.api.accounts.me(); // works, returns account id
await sdk.api.devboxes.createGatewayToken(db.id, {
  gateway: "openrouter-gateway",
  secret: "OPENROUTER_KEY",
});
// -> 500 Failed to mint gateway token: INTERNAL: INTERNAL: UNAUTHENTICATED: Missing x-account-id header

Also reproduces via raw REST:

curl -sS -X POST "https://api.runloop.ai/v1/devboxes/$ID/create_gateway_token" \
  -H "Authorization: Bearer $RUNLOOP_API_KEY" \
  -H "content-type: application/json" \
  -d '{"gateway":"openrouter-gateway","secret":"OPENROUTER_KEY"}'

Adding the account id from GET /v1/accounts/me as x-account-id does not help — the header appears to be dropped before the internal mint call.

Expected

Returns GatewayTokenView (token, url, endpoint, gateway_config_id, …) as documented.

Notes

  • sdk.api.accounts.me() succeeds and returns the account id, so the API key/session is valid.
  • The failure is INTERNAL, suggesting the public API → minting service call isn't forwarding the account context.
  • Client version 1.32.0 (the version that introduced this endpoint).

Environment

  • @runloop/api-client 1.32.0
  • Account is on ACCOUNT_TIER_PRO

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions