The gateway sits between an agent and an external tool, such as an email service or an HTTP API. It decides whether the requested action is allowed, denied, or needs a human decision. Choose an authorization check to inspect policy without running the tool, a tool action to track approval, or gateway execution when you want the permitted action to run immediately.
Three routes, distinct effects
auth_checks returns allowed, denied, or requires approval as HTTP 200 and never executes. tool_actions writes audit/approval state but does not execute an already-allowed action. gateway/execute authorizes and immediately runs the connector only when policy says allowed.
Approval polling is observation
A tool action that needs approval returns 202, Location, Retry-After: 2, and a status URL. A permitted, signed-in operator's approval queues one execution attempt. The worker rechecks the connector, actor, freeze, and current authorization before running. Rejection or a failed recheck ends that attempt. Polling the status URL never starts execution or retries an interrupted attempt.
Policy fields have a shared envelope
Use the same connector, action, payload, amount, environment, risk_score, and contains_phi across check and execution. Authorization snapshots live in execution metadata and audit records, not as a top-level success field.
Before you begin
The command-line examples require curl and jq; any exception is identified in its introduction.
An active workspace connector created by an operator and a permission grant binding it to the calling service agent.
A credential with gateway:check for dry decisions or gateway:execute for tool actions, status reads, and execution.
An action supported by the connector executor; a policy-only connector can authorize yet still be non-executable.
How it works
Preflight sensitive actions
Run an auth check with real policy inputs. Branch on decision, not HTTP status, because denied and requires-approval decisions are valid 200 responses on this route.
Choose immediate or approval-aware flow
Use gateway execute for an action expected to be allowed now. Use tool actions when a requires-approval result should create an operator request and expose a pollable state machine.
Retain execution evidence
On direct execution, save the trace_id, connector, action, duration, events, and output. On approval flow, follow the returned status URL and stop polling according to state, next_action, and any retry-after value.
Examples
These examples are illustrative. Replace the sample values with your own.
Keep credentials in environment variables or a secret manager, never in client-side code.
Create an approval-aware tool action
This records authorization state but does not itself call the connector.
Allowed policy returns HTTP 200 with status: ok but no connector execution. Approval-required policy returns HTTP 202 with approval_request_id, status_url, Location, Retry-After, and no-store headers.
Execute an allowed HTTP connector action
This route performs the external side effect synchronously after policy allows it. The internal-api connector must already have an operator-configured base URL and authentication plus a write grant for this agent; otherwise execution fails as not configured or unauthorized.
HTTP 200 returns status: success, trace and connector identities, duration, action, ordered execution events, and action-specific output.
Troubleshooting
Auth check says allowed but execution fails
The check does not reserve policy state or test the external system. Recheck connector status, action support, current grant/policy state, outbound URL policy, and the executor events in the failed response.
A connector is 404
Machine lookup returns only active, non-archived connectors in the authenticated workspace. Missing and paused connectors are surfaced as not found on execution.
Polling does not start execution
That is intentional. Status GET is read-only, and automatic_retry is false. If state reports indeterminate execution or operator review, do not manufacture a retry that might duplicate the external side effect.
A lost POST response may hide a side effect
POST /tool_actions has no idempotency or deduplication: resending can create another approval request, and each duplicate can execute if approved. Reconcile the operator approval queue and audit trail with available request or business identifiers before resending. Non-SMTP /gateway/execute also ignores Idempotency-Key; HTTP executor retry: false prevents an internal transport retry but cannot prove a timed-out call did not reach the remote service. Only email-smtpsend_email and send_bulk_email have the documented platform idempotency protection.
Endpoint reference
Ready to integrate? Open an endpoint for its required permissions, request fields,
response format, and status codes. The examples above explain the workflow;
these details define each individual request.
POST
/api/v1/auth_checks
API key / access token
Check if an action is authorized
gateway:check
Description
Evaluates whether a service agent is authorized to perform a specific action on a connector. Prerequisite: A connector must exist in the workspace (create via operator dashboard).
Auth
API key / access token
Required Scopes
gateway:check
Request Body
Field
Type
Required
Description
amount
number
No
Numeric amount for approval-policy conditions (top-level)
payload
object
No
Action input parameters used by approval-policy conditions
action_name
string
Yes
Name of the action to check
environment
string
No
Environment for approval-policy conditions (top-level)
connector_id
string
No
Connector UUID
connector_slug
string
No
Connector slug (alternative to connector_id)
contains_phi
boolean
No
Healthcare policy input. Merged into payload.contains_phi for the same PDP envelope as execute and email.
risk_score
number
No
Risk score for approval-policy conditions (top-level)
Responses
200
Authorization decision. denied and requires_approval are also 200 — this route never executes.
Validation failed: missing connector_id/connector_slug or action_name, invalid connector UUID, or non-numeric amount/risk_score
POST
/api/v1/tool_actions
API key / access token
Authorize a tool action
gateway:execute
Description
Authorizes a tool action, writes an audit row, and optionally creates an approval request. GatewayExecutor is not called. Allowed returns 200 {status:"ok", decision, connector_id}. requires_approval returns 202 with approval_request_id, status_url, Location and Retry-After: 2; poll status_url until execution completes. Indeterminate execution is never retried automatically and requires review. Prerequisite: a connector must exist in the workspace.
Auth
API key / access token
Required Scopes
gateway:execute
Request Body
Field
Type
Required
Description
amount
number
No
Numeric amount for approval-policy conditions (top-level)
payload
object
No
Action input parameters
action_name
string
Yes
Name of the action to authorize (this route does not execute it)
environment
string
No
Environment for approval-policy conditions (top-level)
input_payload
object
No
Alternative key for payload
connector_id
string
No
Connector UUID
connector_slug
string
No
Connector slug (alternative to connector_id)
contains_phi
boolean
No
Healthcare policy input. Merged into payload.contains_phi for the same PDP envelope as execute and email.
risk_score
number
No
Risk score for approval-policy conditions (top-level)
Responses
200
Authorized. No connector action ran. Body is {status:"ok", decision, connector_id}.
Policy requires approval. Body includes status_url; poll it with the same gateway:execute token. Location points to the same URL, Retry-After is 2 seconds, and Cache-Control is no-store.
Denied by policy. Body is {error:"denied", decision, connector_id}, not problem JSON.
404
Connector not found
422
Validation failed: missing connector ref or action_name, invalid UUID, or non-numeric amount/risk_score
POST
/api/v1/gateway/execute
API key / access token
Execute connector action with full trace recording
gateway:execute
Description
Runs a connector action after PDP authorization, records a runtime trace, and returns the event timeline. SMTP (email-smtp) handles send_email and send_bulk_email; only those SMTP actions accept optional Idempotency-Key (maximum 200 visible ASCII bytes; malformed keys return 422) for safe replay; other connector actions do not use the key. SMTP accepts bounded inline attachments (filename, content_type, content_base64), while URL/path attachments are rejected. HTTPExecutor already runs slack, github, jira, linear, internal-api, stripe, salesforce, and twilio (events http_request/http_response; actions such as messages.post). Policy-only slugs have no executor and fail as EXECUTION_ERROR (:not_executable). AuthorizationSnapshot is stored only in execution metadata/audit — it is not a top-level 200 field.
Auth
API key / access token
Required Scopes
gateway:execute
Request Body
Field
Type
Required
Description
metadata
object
No
Optional metadata including trace_id, campaign_id, etc.
metadata.trace_id
string
No
Custom trace ID: a non-blank string of at most 255 bytes with no null bytes, unique per workspace. Invalid values return 422; a reused value returns TRACE_ID_CONFLICT.
metadata.campaign_id
string
No
Campaign identifier
action
string
No
Action to execute (e.g. send_email, send_bulk_email, messages.post)
amount
number
No
Fintech policy amount. Hoisted into the same PDP envelope as auth_checks/tool_actions.
payload
object
No
Action-specific input parameters
action_name
string
No
Alternative key for action (alias)
environment
string
No
Environment label for approval-policy conditions (top-level)
service_agent_id
string
No
Optional service agent ID for audit trail
input_payload
object
No
Alternative key for payload
connector_id
string
No
Connector UUID
connector_slug
string
No
Connector slug (alternative to connector_id)
contains_phi
boolean
No
Healthcare policy input. Cast is skipped; the controller hoists this into the PDP payload.contains_phi envelope.
risk_score
number
No
Risk score for approval-policy conditions (top-level)
Error code. Paused or missing connectors are 404 Problem JSON, not CONNECTOR_PAUSED/CONNECTOR_NOT_FOUND. :http_error, :not_executable, :http_not_configured, and outbound URL-policy atoms collapse to EXECUTION_ERROR. INVALID_REQUEST means a GET/HEAD query value or a {param} path value in the payload was not a string, number, boolean or null; nothing was sent upstream.
Connector not found. get_connector only returns active, non-archived connectors, so paused and missing connectors are this 404 Problem JSON — not a 400 CONNECTOR_PAUSED body.
409
Problem JSON for SMTP Idempotency-Key conflict, in-progress execution, or failed prior execution
422
Validation error (missing action or connector)
GET
/api/v1/tool_actions/:id
API key / access token
Poll a tool approval and execution
gateway:execute
Description
Returns the requesting service agent's approval and execution state. This read never executes, retries, or enqueues the connector action. A pending request may expire without being mutated; an interrupted execution is indeterminate and requires operator review.
Auth
API key / access token
Required Scopes
gateway:execute
Parameters
Name
In
Type
Required
Description
id
path
string
Yes
Approval request UUID returned by POST /api/v1/tool_actions