Skip to content
agentsub
Esc
↑↓navigate↵open⌘Jpreview

Execute a metered service action

Agent sessions execute as themselves; owner sessions must pass agentId of one of their registered agents (400 agent_required if missing). Authorization checks the agent’s clearance (active status, allowed services/categories, connector inbox allowlist) before a 1-credit (1,000,000 microcredit) hold is taken, the action runs, and the hold is captured.

  • On insufficient credits with an unconfigured Link provider: 503 link_configuration_required with the retained intentId and original intent — no payment is charged.
  • If the Link provider is configured but human approval is pending: 402 approval_required with the retained intent and a payment approval URL; execution resumes only after confirmed settlement of the approval.
POST/v1/services/execute
Authorization
AuthorizationBearer token (JWT) · headerrequired

Clerk human owner session JWT; iss must equal the configured Clerk issuer and the identity must be a human (not agent) owner with a verified email.

or
AuthorizationBearer token (JWT) · headerrequired

Verified AgentID agent JWT (iss https://auth.agentid.com) or an AgentSub OAuth access token (typ at+jwt, iss https://api.agentsub.dev, scope agentsub:agent). The agent's human owner must exist in Clerk with the same verified email.

or
AuthorizationOAuth2 access token · headerrequired
Scopes:agentsub:owner
Header parameters
Idempotency-Keystringrequired

Required only where this parameter is listed. Same payload/key recovers prior operation; secret replays omit plaintext.

matches ^[A-Za-z0-9._:-]{1,200}$
Request body
requiredapplication/json
serviceIdstringrequired
Allowed:agentmailgithub-public
actionstringrequired
Allowed:inboxes.listmessages.listmessages.getrepository.get
inputobjectrequired
agentIdstring

Required for owner sessions; agent sessions execute as themselves

max length 200
Responses
200

Completed metered execution with receipt

statestringrequired
resultobjectrequired
receiptCapturerequired
Show properties
idstring
agentIdstring
acceptorIdstring
offerIdstring
categorystring
amountUcMicrocredits

Integer microcredits as a decimal string. 1 credit = 1,000,000 microcredits = $0.01 USD.

matches ^[0-9]+$
statestring
Allowed:heldcapturedreleasedexpired
expiresAtinteger
createdAtinteger
capturedUcMicrocredits

Integer microcredits as a decimal string. 1 credit = 1,000,000 microcredits = $0.01 USD.

matches ^[0-9]+$
allocationsobject[]
Show properties
Array of object
lotIdstring
amountUcMicrocredits

Integer microcredits as a decimal string. 1 credit = 1,000,000 microcredits = $0.01 USD.

matches ^[0-9]+$
priceUcMicrocreditsrequired

Integer microcredits as a decimal string. 1 credit = 1,000,000 microcredits = $0.01 USD.

matches ^[0-9]+$
priceUsdstringrequired
paymentMethodstringrequired
400

invalid_input (bad body or Idempotency-Key) or agent_required problem

typestringrequired
titlestringrequired
statusintegerrequired
codestringrequired
401

unauthorized problem; live 401s advertise WWW-Authenticate: Bearer resource_metadata=...

typestringrequired
titlestringrequired
statusintegerrequired
codestringrequired
402

approval_required problem with retained intent and Link payment instructions; no charge has occurred

typestringrequired
titlestringrequired
statusintegerrequired
codestringrequired
statestring
intentIdstringrequired
intentServiceExecuteRequestrequired
Show properties
serviceIdstringrequired
Allowed:agentmailgithub-public
actionstringrequired
Allowed:inboxes.listmessages.listmessages.getrepository.get
inputobjectrequired
agentIdstring

Required for owner sessions; agent sessions execute as themselves

max length 200
paymentobject
paymentMethodsobject[]required
Show properties
Array of object
typestring
statusstring
instructionsstringrequired
403

Identity, ownership, scope or policy denied (human_required, owner_claim_required, scope_required, FROZEN, CAP_EXCEEDED, SCOPE_FORBIDDEN)

typestringrequired
titlestringrequired
statusintegerrequired
codestringrequired
503

Runtime or provider configuration unavailable (runtime_configuration_required, signing_configuration_required, runtime_unavailable, workspace_unavailable, provider_configuration_required)

typestringrequired
titlestringrequired
statusintegerrequired
codestringrequired
Request
curl -X POST 'https://api.agentsub.dev/v1/services/execute' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Idempotency-Key: string' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "serviceId": "agentmail",
  "action": "inboxes.list",
  "input": {},
  "agentId": "string"
}'
Response
{
  "state": "completed",
  "result": {},
  "receipt": {
    "id": "string",
    "agentId": "string",
    "acceptorId": "string",
    "offerId": "string",
    "category": "string",
    "amountUc": "string",
    "state": "held",
    "expiresAt": 0,
    "createdAt": 0,
    "capturedUc": "string",
    "allocations": [
      {
        "lotId": "string",
        "amountUc": "string"
      }
    ]
  },
  "priceUc": "string",
  "priceUsd": "0.01",
  "paymentMethod": "acs-credit"
}