Contents

Submitting an action

The demo company

The demo company comes with demonstration agents, which use this interface from inside the platform. Connecting your company’s own agents is part of a company deployment, arranged on request: request a quote.

An action is what the agent wants to do: for example, a refund through a payments service. The agent submits it to POST /v1/action-intents, and Guardrails checks it before any execution. The answer is the decision, described in Outcomes and follow-up.

The action’s body

The example below asks for a refund of 350.00 RON through the simulated payments service:

{
  "schema_version": "1.0",
  "idempotency_key": "refund-A-1060-01",
  "capability": { "id": "plati.refund.create", "version": "1.0.0" },
  "connection_id": "98ec5d79-9627-4639-9ea1-a251db747bd0",
  "parameters": {
    "payment_intent": "pi_sim_4f9c2a7e1b3d5c6a8e0f2b4d",
    "amount": { "amount_minor": 35000, "currency": "RON" },
    "reason": "requested_by_customer"
  },
  "max_exposure": { "amount_minor": 35000, "currency": "RON" },
  "justification": "The product arrived damaged; the customer sent photos (order A-1060)."
}
FieldRequiredWhat it holds
schema_versionyesAlways "1.0".
idempotency_keyyesThe key the agent chooses for this action: 8 to 128 characters, letters, digits, ., _, : or -, unique for the agent.
capabilityyesThe action type: its identifier and its version.
connection_idyesThe company’s connection through which the action is executed.
parametersyesThe action type’s parameters, checked against its definition. The members doc and doc_reading are reserved for Synarun: an agent that sends them gets 422 VALIDATION_SCHEMA_FAILED.
max_exposureby typeThe ceiling on the action’s economic exposure. It is required for an action type with an economic effect and refused for a content action; an action of a type with neither is sent without it. It covers the parameters’ amount, in the same currency: a lower ceiling gets 422 VALIDATION_SCHEMA_FAILED, with the keyword coversExposure, and another currency 422 VALIDATION_CURRENCY_MISMATCH.
justificationnoThe agent’s explanation for the approver, at most 2,000 characters. The approver sees it as the agent’s text, never as Synarun’s assessment.
budget_account_idnoThe budget account the agent believes it uses. Synarun determines the account by itself; if the value differs, the action is blocked (ECONOMIC_ACCOUNT_CLAIM_MISMATCH).
context_refsnoAt most 50 identifiers of the information the agent relied on. They are for information only: Synarun chooses by itself the data it decides on.
claimed_agent_id, claimed_business_idnoAn echo of the agent’s identity. If it differs from the authenticated identity, the action is refused with 403 IDENTITY_CLAIM_MISMATCH.

Amounts are written as a whole number of the currency’s minor units, with its three-letter code: 350.00 RON is { "amount_minor": 35000, "currency": "RON" }.

An approval covers exactly the action submitted. To change anything, the agent submits a new action, with a new idempotency key.

The parameters

An action type’s parameters are given by its definition, and Synarun checks them before anything else. A parameter missing, unknown or outside the schema gets 422 VALIDATION_SCHEMA_FAILED, with the parameter’s path, for example /parameters/payment_intent, and the rule broken, for example pattern. The example’s action type, plati.refund.create version 1.0.0, a refund through the simulated payments service, takes exactly these three parameters:

ParameterWhat it holds
payment_intentThe payment to refund, in the simulated payments service: pi_sim_ followed by 24 lower-case hexadecimal characters.
amountThe amount to refund, in RON or EUR, of at least one minor unit.
reasonWhy: duplicate, fraudulent or requested_by_customer.

What not to send

The body never names the company, the agent or the session: identity comes only from authentication. A body with tenant_id, business_id, agent_id or session_id is refused, even when the value is the correct one:

{
  "schema_version": "1.0",
  "idempotency_key": "refund-A-1060-01",
  "agent_id": "06c98a7b-c2b0-4798-a2d7-d9638ef5a3e4",
  "capability": { "id": "plati.refund.create", "version": "1.0.0" },
  "connection_id": "98ec5d79-9627-4639-9ea1-a251db747bd0",
  "parameters": { "payment_intent": "pi_sim_4f9c2a7e1b3d5c6a8e0f2b4d", "amount": { "amount_minor": 35000, "currency": "RON" }, "reason": "requested_by_customer" },
  "max_exposure": { "amount_minor": 35000, "currency": "RON" }
}
{
  "error": {
    "code": "IDENTITY_FIELD_NOT_ALLOWED",
    "category": "IDENTITY",
    "message": "External body carries a reserved identity field (tenant_id, business_id, agent_id, session_id). Identity comes only from the authenticated principal.",
    "retryable": false,
    "trace_id": "47ad0d19d25c3454c5dfc793ef52032c",
    "details": { "fields": ["agent_id"] }
  }
}

Strict JSON

The body is strict JSON, in UTF-8, with Content-Type: application/json:

  • no byte order mark at the start;
  • no member name repeated in an object (PROTOCOL_DUPLICATE_KEY);
  • integers between −(2^53−1) and 2^53−1 (PROTOCOL_NUMBER_OUT_OF_RANGE);
  • no member named __proto__ (PROTOCOL_FORBIDDEN_MEMBER_NAME);
  • no unknown properties (VALIDATION_SCHEMA_FAILED).

The HTTP request

POST /v1/action-intents HTTP/1.1
Host: synarun-api.example
Authorization: DPoP xNpV-O7gPKnPYmv__XVGDr3WpScgL1WiIPORgCr6Gzw
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVkRFNBIiwiandrIjp7…
Content-Type: application/json

{
  "schema_version": "1.0",
  "idempotency_key": "refund-A-1060-01",
  "capability": { "id": "plati.refund.create", "version": "1.0.0" },
  "connection_id": "98ec5d79-9627-4639-9ea1-a251db747bd0",
  "parameters": { "payment_intent": "pi_sim_4f9c2a7e1b3d5c6a8e0f2b4d", "amount": { "amount_minor": 35000, "currency": "RON" }, "reason": "requested_by_customer" },
  "max_exposure": { "amount_minor": 35000, "currency": "RON" },
  "justification": "The product arrived damaged; the customer sent photos (order A-1060)."
}

The answer to a new action is 201, with the decision in the body. The decision, the three outcomes and how to follow them are described in Outcomes and follow-up.

Repeating safely

If the agent receives no answer, for example after a network interruption, it sends the same action again, with the same idempotency key and the same body. Do not use a new key: a new key means a new action.

  • Same key, same body: the answer is 201 again, with the original decision and the idempotent-replayed: true header. Nothing is evaluated again. The comparison ignores the order of members and the whitespace.
  • Same key, another body: 409 IDEMPOTENCY_KEY_REUSED. The first submission stands.
  • The first submission is still being processed: 409 IDEMPOTENCY_REQUEST_IN_PROGRESS. Repeat later, with the same key and body.
HTTP/1.1 201 Created
idempotent-replayed: true
content-type: application/json; charset=utf-8

An error’s retryable field says whether the same HTTP request, with the same key and body, may be sent again. Synarun’s demo agents keep each action’s key and body until they receive the answer, so that a repetition is always identical.