/fleet paths and fleet.* capability identifiers; use those contract
names exactly as documented in the generated reference.
Endpoint
/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:whoami first when wiring new automation. It confirms the token audience,
principal type, organization access, role, and scopes without mutating data.
REST API and MCP access tokens have different audiences. Do not send an MCP
OAuth token to the REST API.
Requests
JSON request bodies useContent-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
cursorand return the continuation cursor described by their response schema. - Offset-based searches accept
offsetandlimit. - Bounded queries cap
limit. Clients should stay within the documented maximum and must use the effective limit and continuation fields returned by the response. Some beta operations clamp an oversized value to their maximum instead of rejecting it.
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, device-management, 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.
Policy Automation
Use Terraform for long-lived policy lifecycle management. It gives reviewable source, saved plans, drift detection, revision checks, and exclusive ownership. Use the REST API around Terraform for discovery, verification, reporting, and workflow automation.Verify a Terraform-managed policy
Afterterraform apply, read the policy from Forge and check its
authority, manager, revision, and definition:
managementMode should be terraform.
Resource Policy lifecycle requests use the same organization-scoped pattern:
family to resource. Resource definitions accept
authenticated user, group, service-account, device, and Resource scope;
enforce or monitor; Resource conditions or a package forge.resource
module; exceptions; allow, flag_for_review, block, redact, filter, or
require_approval; and an optional block or approval message. Redaction and
filtering require dataTarget plus the shared
redaction or filter object. Approval requires
{ "mode": "admin_approval" } or { "mode": "self_serve" }. Resource
definitions do not accept Access enforcement surfaces or Content evaluation
checkpoints.
This separate route does not represent a separate policy engine. Resource
Policies use the same condition operators and nesting, named exceptions,
outcome handling, messages, revisions, Rego compilation, backtests, plan
validation, and ownership contract as the other families. Protocol fields and
actions are validated against selected Resource capabilities. Valid data
targets are http_request_body, http_response_body, postgres_result, and
mysql_result. HTTP request bodies support redaction; HTTP response bodies and
PostgreSQL or MySQL results support redaction and filtering. Redis supports
connection and command decisions but not result transformation.
Native Resource conditions may use prior-event, sequence, count, and
distinct-value forms. Their history is a bounded ordered set of safe facts from
the same authenticated Resource connection. Clients must not treat these forms
as cross-connection or organization-wide rate limiting.
Resource approval uses the existing governance decision and grant APIs rather
than a Resource-specific workflow service. The first operation returns a
bounded policy error and approval reference without forwarding. Approval issues
a ten-minute, one-use grant; only an exact retry with the same identity,
Resource, operation, and policy revisions can consume it. Mutating approval
requests require the normal idempotency and audit-reason headers.
Resource Activity and backtest responses expose only safe metadata: target,
paths or columns, applied or removed counts, intended and effective outcomes,
and approval linkage when present. HTTP body values, PostgreSQL or MySQL row
values, Redis arguments and replies, raw operation bytes, and private operation
digests are never returned.
Inspect policy-as-code capability
Automation should check its authorized capabilities before attempting writes:Validate the policy contract
The Terraform provider negotiates the policy contract before it plans a write. This call is useful in CI preflight checks and support diagnostics:Terraform plan validation API
The provider sends the desired policy definition to Forge for authoritative validation before apply. Forge returns a short-lived validation token bound to the exact definition, expected revision, service-account principal, manager, manager instance, reference bindings, schema, and compiler fingerprint.family: "resource" and a Resource definition such as:
Supported operational automations
Errors
Non-2xx JSON responses always include a human-readablemessage:
code and requestId in the body. Capture the
X-Request-ID response header for every failed request; it is the reliable
correlation value even when the body contains only message.
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 X-Request-ID (and a body requestId when present) with automation logs
and support cases. Never log bearer tokens, one-time service-account secrets,
or upstream provider credentials.
Runnable approval and audit workflow
The repository includes a curl andjq example that exercises a complete,
auditable automation lifecycle:
- Verify the credential’s runtime capabilities.
- Read two bounded policy-search pages.
- Create an MCP approval request with required safety fields.
- Retry the create with the same idempotency key and verify the same approval is returned.
- Read and deny the disposable request.
- Find the corresponding create and deny events in the audit log.
.invalid domain and the scanner is not
started, so no upstream connection is attempted. The terminal approval is
retained as an audit record; there is intentionally no delete operation.
Policy automation boundary
Use the documented headless policy-family routes for policy lifecycle automation and the Forge Terraform provider for reviewable desired state, saved plans, drift detection, and exclusive ownership. Use the Console for interactive authoring. Do not build a REST client around undocumented/api/v1 Console routes.
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-levelx-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.