Skip to main content
The Forge REST API exposes the same organization-scoped capabilities used by Forge CLI and Forge MCP. The reference is generated from the public OpenAPI contract and documents the method, path, scopes, permission, risk tier, request schema, and response schema for every operation.

Endpoint

All organization data routes include /organizations/{organizationId}. A credential cannot use that path parameter to cross organization boundaries.

Authentication

Send a Forge service-account token or delegated OAuth access token as an HTTP Bearer token:
The organization capabilities response is the authoritative way to determine what the current credential can call. Each capability includes its required scope, permission, risk tier, supported surfaces, stability, and authorization result.
REST API and MCP access tokens have different audiences. Do not send an MCP OAuth token to the REST API.

Requests

JSON request bodies use Content-Type: application/json. Timestamps are RFC 3339 UTC unless an operation states otherwise. Unknown request properties are rejected where the operation schema sets additionalProperties: false.

Pagination

Pagination is defined per operation:
  • Cursor-based operations accept cursor and return the continuation cursor described by their response schema.
  • Offset-based searches accept offset and limit.
  • Bounded queries cap limit; requesting more than the documented maximum is invalid rather than an instruction to return an unbounded result.
Do not infer one pagination model for every endpoint. Use the parameters and response schema on the operation page.

Activity totals and Gateway usage

The activity aggregate endpoint returns server-computed totals for a selected time range and filters. The LLM Gateway usage endpoint returns bounded usage, token, cost, model, provider, and policy-outcome breakdowns for traffic observed by Forge LLM Gateway. Neither endpoint represents traffic that bypassed Forge. Use the generated reference for the available filters, dimensions, and limits. For example, use activity aggregates to calculate the total sessions and active identities for a reporting period, then request a bounded breakdown by product or risk. Use LLM Gateway usage to report tokens and cost for the same period with breakdowns by model, provider, or policy outcome. Continue from the returned pagination fields when a related search is needed to inspect the individual sessions or findings behind a total.

Long-running operations

Deployment, Fleet, collection, and analysis operations can be accepted before their work is complete. An accepted response includes the resource or operation identifier used to read current status. Poll that status at a bounded interval until it reaches a terminal state, and present partial per-target results when the operation provides them. Do not interpret request acceptance as successful delivery or endpoint readback.

Guarded writes

Mutating operations declare their safeguards in the OpenAPI reference. Depending on the capability, the request can require: When both body and header forms are supported, keep their values consistent. Reuse an idempotency key when retrying the same logical operation. Use a new key only for a new intended change.

Errors

Non-2xx JSON responses use the Forge error envelope:
Forge does not define one universal request quota across every capability. Treat operation-specific limits in the reference and any returned Retry-After header as authoritative. Store requestId with automation logs and support cases. Never log bearer tokens, one-time service-account secrets, or upstream provider credentials.

Compatibility

The route prefix carries the API major version. Additive response fields may be introduced without changing that version, so clients should ignore unknown response properties. Operation-level x-forge-stability identifies beta and stable contracts; capability discovery exposes the same stability metadata at runtime. The generated endpoint reference below is the source of truth for operation schemas and authorization requirements.

CLI

Use the same contracts from shell scripts and CI.

Roles

Map roles, permissions, and service-account scopes.