Actions and policy API
An action registers the exact consequential operation the customer may request. A policy version snapshots its security-relevant constraints: context schema, allowed audiences and callers, proof lifetime, assurance requirements, challenge behavior, and hold or deny conditions.
Administrative flow
Use an admin-scoped credential for action creation, supported updates, archival, policy creation, and activation. Runtime services ordinarily use server scope to read the relevant configuration and request decisions. Use the least privileged credential that covers each operation.
Create a version, review it, and activate it explicitly. Policy content is immutable and integrity checked. Activation changes the active version transactionally. Select a reviewed prior version for rollback rather than modifying immutable policy content.
Request constraints
Register a context schema that includes every security-relevant value needed to distinguish the operation. Use safe integers and the supported schema features for canonical action material. Validate business account ownership alongside the request schema.
New actions start in shadow mode. Use test and shadow decisions to inspect policy behavior. An eligible enforce-mode allow supplies a proof for backend verification and consumption. Check the returned mode after configuration changes and handle a rejected change without advancing the protected operation. See Actions and policies for mode configuration, policy examples, and decision precedence. The operations below specify the request and response contracts.
GET /api/v1/actions
Read non-archived action definitions in this environment.
Credential: Server credential.
Inputs: No body or pagination parameters; the list contains at most 500 non-archived actions.
Effect and retry behavior: Read-only bounded list. Use the returned record id for action administration and the key for authorization.
Responses
| HTTP status | Meaning | Body |
|---|---|---|
200 | Array of up to 500 non-archived protected actions. | application/json: Array of ProtectedAction |
Response handling: An empty list means the query returned no visible registered actions. Register and configure the intended action before authorization.
Example
GET /api/v1/actions[
{
"id": "act_example",
"key": "payout.destination.change",
"mode": "shadow"
}
]POST /api/v1/actions
Create an action definition and its initial active policy in shadow mode.
Credential: Admin server credential.
Inputs: Supply a dotted key, display name, consequence and nonempty allowed_audiences. Use context_schema to bind sensitive business fields.
Effect and retry behavior: Creates a new action and initial policy in shadow mode. Defaults include risk_class high and proof_ttl_seconds 300. Configure the action mode separately.
Request body
application/json; required. ActionCreate.
Responses
| HTTP status | Meaning | Body |
|---|---|---|
201 | ProtectedAction in shadow mode with its initial active policy version. | application/json: ProtectedAction |
422 | The canonical handler returns a Problem for invalid input; correct the request before retrying. | application/problem+json: Problem |
Response handling: Conflicting keys, invalid context schemas and unsupported settings are refused. Read existing configuration before retrying a create after a timeout.
Example
POST /api/v1/actions{
"key": "payout.destination.change",
"name": "Change payout destination",
"consequence": "Future payouts may be sent to a different destination.",
"resource_type": "merchant",
"allowed_audiences": [
"merchant-api"
],
"context_schema": {
"type": "object",
"properties": {
"destination_fingerprint": {
"type": "string"
}
},
"required": [
"destination_fingerprint"
],
"additionalProperties": false
}
}{
"id": "act_example",
"key": "payout.destination.change",
"mode": "shadow",
"active_policy_version": 1
}DELETE /api/v1/actions/{action_id}
Stop using an action through the normal active action surface while retaining its historical records.
Credential: Admin server credential.
Inputs: Action record id only.
Effect and retry behavior: Archives the action. Historical authorizations and policies are not rewritten; integrations must handle subsequent refusal.
Parameters
| Name / location | Required | Meaning, type and constraints |
|---|---|---|
action_id (path) | Yes | Protected-action record identifier returned by action creation. Supply this record ID in the path; use the dotted action key in authorization requests. string |
Responses
| HTTP status | Meaning | Body |
|---|---|---|
204 | Action archival completed; the 204 response has no body. | No response body |
422 | The canonical handler returns a Problem for invalid input; correct the request before retrying. | application/problem+json: Problem |
Response handling: Missing or unavailable actions are refused. Reconcile uncertain archive responses through action state before accepting new business requests.
Example
DELETE /api/v1/actions/act_exampleHTTP 204; no response body.
GET /api/v1/actions/{action_id}
Inspect the action’s display metadata, mode and active policy settings before integration or a configuration change.
Credential: Server credential.
Inputs: Use the action record id, not its key.
Effect and retry behavior: Read-only; compare active_policy_version when reviewing changes.
Parameters
| Name / location | Required | Meaning, type and constraints |
|---|---|---|
action_id (path) | Yes | Protected-action record identifier returned by action creation. Supply this record ID in the path; use the dotted action key in authorization requests. string |
Responses
| HTTP status | Meaning | Body |
|---|---|---|
200 | ProtectedAction with mode and effective active policy settings. | application/json: ProtectedAction |
422 | The canonical handler returns a Problem for invalid input; correct the request before retrying. | application/problem+json: Problem |
Response handling: 404 for missing, archived or out-of-scope actions.
Example
GET /api/v1/actions/act_example{
"id": "act_example",
"key": "payout.destination.change",
"mode": "shadow",
"active_policy_version": 1
}PATCH /api/v1/actions/{action_id}
Change an action’s customer-facing name, consequence or test/shadow/enforce mode.
Credential: Admin server credential.
Inputs: Omit fields that should remain unchanged. Change audiences, caller restrictions, context or proof lifetime through a new policy version.
Effect and retry behavior: Updates the supplied action metadata or mode. Read the returned mode to confirm the effective configuration.
Parameters
| Name / location | Required | Meaning, type and constraints |
|---|---|---|
action_id (path) | Yes | Protected-action record identifier returned by action creation. Supply this record ID in the path; use the dotted action key in authorization requests. string |
Request body
application/json; required. ActionUpdate.
Responses
| HTTP status | Meaning | Body |
|---|---|---|
200 | Updated ProtectedAction metadata and current mode. | application/json: ProtectedAction |
422 | The canonical handler returns a Problem for invalid input; correct the request before retrying. | application/problem+json: Problem |
Response handling: For error.enforcement_not_approved, retain the effective mode and confirm the environment configuration with GrayPass. Action display metadata and immutable policy versions are configured separately.
Example
PATCH /api/v1/actions/act_example{
"name": "Change merchant payout destination"
}{
"id": "act_example",
"key": "payout.destination.change",
"mode": "shadow"
}GET /api/v1/actions/{action_id}/policy-versions
Inspect the action’s immutable draft, active and retired policy snapshots.
Credential: Server credential.
Inputs: Action record id only; no pagination cursor.
Effect and retry behavior: Read-only. Only the active version controls new decisions.
Parameters
| Name / location | Required | Meaning, type and constraints |
|---|---|---|
action_id (path) | Yes | Protected-action record identifier returned by action creation. Supply this record ID in the path; use the dotted action key in authorization requests. string |
Responses
| HTTP status | Meaning | Body |
|---|---|---|
200 | Array of bounded policy snapshots with version numbers and lifecycle states. | application/json: Array of PolicyVersion |
422 | The canonical handler returns a Problem for invalid input; correct the request before retrying. | application/problem+json: Problem |
Response handling: 404 for an unavailable action. Use the active policy version for a new authorization.
Example
GET /api/v1/actions/act_example/policy-versions[
{
"id": "pol_example",
"action": "act_example",
"version": 1,
"status": "active"
}
]POST /api/v1/actions/{action_id}/policy-versions
Prepare a new immutable policy snapshot without activating it.
Credential: Admin server credential.
Inputs: requirements is required. Omitted optional audiences, caller restrictions, context schema and proof lifetime inherit from the active version.
Effect and retry behavior: Creates a numbered draft; existing authorizations retain their original snapshot. Activate explicitly after review.
Parameters
| Name / location | Required | Meaning, type and constraints |
|---|---|---|
action_id (path) | Yes | Protected-action record identifier returned by action creation. Supply this record ID in the path; use the dotted action key in authorization requests. string |
Request body
application/json; required. PolicyVersionCreate.
Responses
| HTTP status | Meaning | Body |
|---|---|---|
201 | New immutable draft policy and its assigned version number. | application/json: PolicyVersion |
422 | The canonical handler returns a Problem for invalid input; correct the request before retrying. | application/problem+json: Problem |
Response handling: Invalid claim requirements, challenge methods, audiences or context schema are refused. A retry can create another draft; list versions after uncertainty.
Example
POST /api/v1/actions/act_example/policy-versions{
"requirements": {
"coverage_min": "partial",
"freshness_max_ms": 60000,
"insufficient_evidence": "challenge",
"challenge_methods": [
"passkey"
]
}
}{
"id": "pol_example",
"action": "act_example",
"version": 2,
"status": "draft"
}POST /api/v1/actions/{action_id}/policy-versions/{version}/activate
Select an existing version as the action’s active decision contract.
Credential: Admin server credential.
Inputs: Action record id and integer version number. Review the whole draft snapshot before activating.
Effect and retry behavior: Activates the selected version and retires the prior active version. Pending/retried authorization can fail as stale rather than silently changing meaning.
Parameters
| Name / location | Required | Meaning, type and constraints |
|---|---|---|
action_id (path) | Yes | Protected-action record identifier returned by action creation. Supply this record ID in the path; use the dotted action key in authorization requests. string |
version (path) | Yes | Policy version number belonging to the action. Supply the numeric version in this path. integer |
Responses
| HTTP status | Meaning | Body |
|---|---|---|
200 | Selected policy version in active state. | application/json: PolicyVersion |
422 | The canonical handler returns a Problem for invalid input; correct the request before retrying. | application/problem+json: Problem |
Response handling: Unavailable or incompatible versions and lifecycle conflicts are refused; read the active version after an uncertain response.
Example
POST /api/v1/actions/act_example/policy-versions/2/activate{
"id": "pol_example",
"action": "act_example",
"version": 2,
"status": "active"
}