# Approve production API calls before they run

Source: https://docs.stacksona.com/playbooks/production-api-approval
Markdown: https://docs.stacksona.com/playbooks/production-api-approval.md

Use this pattern when an agent is about to call a production API, trigger a job, send a webhook, mutate a database record, or touch an internal system.

Workflow Playbook


Use this pattern when an agent is about to call a production API, trigger a job, send a webhook, mutate a database record, or touch an internal system.


## When to use this


Use this pattern when an agent is about to call a production API, trigger a job, send a webhook, mutate a database record, or touch an internal system.


## Where Stacksona fits


Place Stacksona immediately before the production call. The agent should prepare the request, ask Gate for a decision, and only run the call when the decision allows it.


## What the reviewer should see

- endpoint
- method
- affected system
- payload summary
- full payload or safe redacted payload
- expected impact
- rollback plan
- reason the agent wants to call the API
- risk or review reason


## Minimum fields to send

- agent_id
- workflow_id
- tool_name: call_production_api
- action_type: production_api
- method
- endpoint
- affected_system
- payload_summary
- rollback_plan
- reason
- callback_url, if using async review


## Example request


```
{ "agent_id": "ops-agent-01", "workflow_id": "production-api-review", "tool_name": "call_production_api", "action_type": "production_api", "method": "POST", "endpoint": "https://api.internal.example.com/accounts/cus_99/recalculate", "affected_system": "billing-ledger", "payload_summary": "Recalculate account balance after support adjustment.", "rollback_plan": "Run ledger_restore with request_id if the recalculation is incorrect.", "reason": "Agent detected a mismatch between CRM balance and billing ledger.", "callback_url": "https://app.example.com/stacksona/api-callback" }
```


## How to branch after the decision


| Status | Behavior |
| --- | --- |
| allowed or approved | Call the API. |
| pending_review | Pause, poll, or wait for callback. |
| rejected | Do not call the API. |
| expired or error | Fail closed by default. |


## What to log after execution

- decision_id
- endpoint
- method
- provider request id or internal request id
- response status
- execution_status
- executed_at
- rollback_id if applicable


## Common mistakes

- hiding the payload from reviewers
- approving without showing affected system
- not logging the API response result
- failing open on timeout


## Related integrations
[Custom REST](/integrations/custom-rest/index.html)[Node and TypeScript](/integrations/node-typescript/index.html)[MCP Clients](/integrations/mcp/index.html)[LangGraph](/integrations/langgraph/index.html)[GitHub Actions](/integrations/github-actions/index.html)[Patterns](/patterns/index.html)[Gate API Reference](/reference/api-contract/index.html)[Security](/reference/security/index.html)
