Skip to main content
You can create goals, start runs, follow them, and answer approvals over the CostGraph API. This lets a script or pipeline start a workflow and approve its changes without opening the app. For every endpoint and schema, see the API reference.

Authenticate

Send an API key in the X-API-Key header, and your tenant ID in X-CostGraph-Tenant-ID. Create a key under Settings > API keys. An API key carries the role of the person who created it. A key created by any member of the tenant can start runs and answer approvals. All calls use the base URL https://api.costgraph.ai and the path prefix /api/v1/tenant/automation.

Create a goal

POST /goals creates a goal. A goal that runs once starts its first run right away. Send a new UUID in Idempotency-Key. Repeating a request with the same key doesn’t create a second goal. The specification holds the same settings as the goal form. Set allowedCategories to include integrations for changes in connected services, and approval.mode to every_change, low_risk_reversible, or any_change.
The response includes the goal and, for a goal that runs once, the run_id. GET /connections lists connection IDs, and GET /capability-categories lists the categories a goal can allow.

Run a goal

POST /goals/{goal_id}/runs starts a new run from the goal’s current settings. It also needs an Idempotency-Key.

Follow a run

GET /runs/{run_id} returns the run’s state, its plan, the changes it made, and any approval or question waiting for you.
GET /events/v2 is an event stream of run updates for the tenant. Send Last-Event-ID to continue after the last event you processed.

Answer an approval

When a run needs you, GET /runs/{run_id} lists the pending approval with its ID, version, and effect_hash. Answer it with POST /runs/{run_id}/checkpoints/{checkpoint_id}/responses. The outcome is approved, rejected, or answered for a question. Send the version and effect_hash from the approval you reviewed. If the approval no longer matches, the call is refused and nothing is applied.
For a question, put the answer in payload. For a rejection, put your reason in payload so the agent can read it.

Pause, resume, retry, and cancel

Next steps

Approvals

What an approval shows and when a change waits.

API reference

Authentication, errors, and every endpoint.