{"openapi":"3.1.0","info":{"title":"Nuncio API","version":"1.1.0","description":"Nuncio is a workflow payment and Secrets request platform for autonomous agents. The public model centers on tasks, Secrets catalog/materialization, secrets, requests, trust rules, and request artifacts. Agents typically integrate through `fetchSecretCatalog`, `materializeSecretValues`, `client.secrets.*`, and `actions.run`; curated public docs intentionally omit legacy secret-chain endpoints from the product narrative.\n\nRecommended reading order:\n1. `GET /health`\n2. `GET /agent/me`\n3. `POST /tasks`\n4. `GET /tasks/{id}`\n5. `GET /tasks/{id}/secret-catalog`\n6. `POST /tasks/{id}/secret-value-materializations`\n7. `POST /tasks/{id}/requests`\n8. `POST /tasks/{id}/requests/{requestId}/decisions`\n9. `POST /tasks/{id}/requests/{requestId}/claim`\n10. `POST /tasks/{id}/complete`\n11. `POST /observability/telemetry/traces`"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Nuncio API key sent as Authorization: Bearer <api_key>."}},"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok"],"description":"Static health status for the API deployment.","example":"ok"},"api_version":{"type":"string"},"deployment_id":{"type":"string","nullable":true},"backend_commit":{"type":"string","nullable":true},"capability_protocol_version":{"type":"integer","minimum":0,"exclusiveMinimum":true},"secretCatalogSchemaVersion":{"type":"integer","minimum":0,"exclusiveMinimum":true},"supportedSecretValueTypes":{"type":"array","items":{"type":"string","enum":["date","phone_number","person_name","country","payment_card_number","payment_card_expiry","payment_card_cvv"]}}},"required":["status","api_version","deployment_id","backend_commit","capability_protocol_version","secretCatalogSchemaVersion","supportedSecretValueTypes"],"description":"Public health check response."},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error code.","example":"unauthorized"},"message":{"type":"string","description":"Safe client-facing message. For machine-only states, callers should branch on error, error_code, status, category, and reason instead of parsing this text.","example":"Invalid API key."},"violated_limit":{"type":"string","description":"Limit key returned by policy engine when spending limit is exceeded.","example":"daily_limit"},"current_spend":{"type":"number","description":"Current spend value at the moment the request was blocked.","example":124.5},"limit_value":{"type":"number","description":"Configured spend limit that was violated.","example":100},"provider":{"type":"string","description":"Upstream provider identifier when relevant.","example":"openrouter"},"retry_after":{"type":"number","description":"Retry-after interval in seconds when returned by an upstream provider.","example":30},"error_code":{"type":"string","description":"Structured upstream/provider-specific subcode when available.","example":"structured_output_truncated"},"operation_id":{"type":"string","description":"Exact Nuncio operation id when recovery of that operation is required.","example":"mpo_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},"operation_state":{"type":"string","description":"Persisted Nuncio operation state that blocks the requested action.","example":"failure_confirmed"},"next_action":{"type":"string","enum":["wait","retry_same_request","retry_same_operation","reconcile","retry_ledger_consequence"],"description":"Typed next action for the exact blocked payment operation.","example":"retry_ledger_consequence"},"retryable":{"type":"boolean","description":"Whether the caller can execute the returned next action now.","example":true},"diagnostic_id":{"type":"string","description":"Opaque support correlation id for matching a client error to backend logs.","example":"mpdiag_550e8400e29b41d4a716446655440000"},"status":{"type":"string","description":"Machine-readable state for structured blocked or availability responses.","example":"authorization_required"},"category":{"type":"string","description":"Structured resource category when the error belongs to one resource family.","example":"payment_card"},"reason":{"type":"string","description":"Machine-readable reason for the structured state.","example":"payment_authorization_required"},"finish_reason":{"type":"string","description":"Provider finish reason when relevant to the failure.","example":"length"},"completion_tokens":{"type":"number","description":"Completion token count captured for provider truncation failures.","example":1024},"max_output_tokens":{"type":"number","description":"Configured max output token limit for provider truncation failures.","example":1024}},"required":["error","message"],"description":"Standard error envelope returned by Nuncio API.","example":{"error":"limit_exceeded","message":"Spending limit exceeded.","violated_limit":"daily_limit","current_spend":124.5,"limit_value":100}},"RuntimeRequestEnvelope":{"type":"object","properties":{"request":{"$ref":"#/components/schemas/RuntimeRequestRecord"},"decision":{"$ref":"#/components/schemas/RuntimeRequestDecisionRecord"},"taskStop":{"$ref":"#/components/schemas/TaskStop"},"saveOutcome":{"type":"object","additionalProperties":{"nullable":true}},"otpAvailable":{"type":"boolean"}},"required":["otpAvailable"]},"RuntimeRequestRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"taskId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string"},"kind":{"type":"string","enum":["data","action","choice"]},"status":{"type":"string","enum":["waiting_user","approved","executing","fulfilled","denied","expired","failed","canceled"]},"terminal":{"type":"boolean"},"resolutionMode":{"type":"string","enum":["auto","confirm","provide"]},"blocking":{"type":"boolean"},"spec":{"type":"object","additionalProperties":{"nullable":true}},"context":{"type":"object","additionalProperties":{"nullable":true}},"bridgeContext":{"type":"object","additionalProperties":{"nullable":true}},"resolution":{"type":"object","additionalProperties":{"nullable":true}},"selectedItemRef":{"type":"string","nullable":true,"minLength":1},"matchedApprovalRuleIds":{"type":"array","items":{"type":"string"}},"resultArtifactId":{"type":"string","nullable":true,"format":"uuid"},"operationId":{"type":"string","nullable":true,"pattern":"^mpo_[0-9a-f]{64}$"},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"fundingGate":{"type":"object","properties":{"requiredAtomic":{"type":"string"},"availableAtomic":{"type":"string"},"shortfallAtomic":{"type":"string"},"status":{"type":"string","enum":["insufficient","funded"]},"checkedAt":{"type":"string"}},"required":["requiredAtomic","availableAtomic","shortfallAtomic","status","checkedAt"],"additionalProperties":false},"fundingGateError":{"type":"object","properties":{"errorCode":{"type":"string","enum":["payment_funding_unavailable"]},"retryable":{"type":"boolean","enum":[true]}},"required":["errorCode","retryable"],"additionalProperties":false},"fundingExpiry":{"type":"object","properties":{"errorCode":{"type":"string","enum":["approval_expired_during_funding"]},"expiredAt":{"type":"string","format":"date-time"},"lastCheckedAt":{"type":"string","format":"date-time"},"freshApprovalAllowed":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["check_payment_status"]}},"required":["errorCode","expiredAt","lastCheckedAt","freshApprovalAllowed","nextAction"],"additionalProperties":false},"expiresAt":{"type":"string","nullable":true,"format":"date-time"},"resolvedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deleted":{"type":"boolean"}},"required":["id","taskId","userId","agentId","clientRequestId","kind","status","terminal","resolutionMode","blocking","spec","context","bridgeContext","resolution","selectedItemRef","matchedApprovalRuleIds","resultArtifactId","operationId","title","summary","errorCode","errorMessage","metadata","expiresAt","resolvedAt","createdAt","updatedAt","deleted"]},"RuntimeRequestDecisionRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"requestId":{"type":"string","format":"uuid"},"actorType":{"type":"string","enum":["system","user","agent","wallet","provider"]},"actorId":{"type":"string","nullable":true,"format":"uuid"},"channel":{"type":"string","enum":["policy","api","dashboard","mobile","telegram","otp","wallet_ui","provider_callback"]},"outcome":{"type":"string","nullable":true,"enum":["auto_approved","confirmed","denied","provided",null]},"resolutionStatus":{"type":"string","enum":["pending","resolved","expired","failed"]},"attemptCount":{"type":"integer","minimum":0},"maxAttempts":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true},"payload":{"$ref":"#/components/schemas/RuntimeRequestDecisionPayload"},"expiresAt":{"type":"string","nullable":true,"format":"date-time"},"resolvedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","requestId","actorType","actorId","channel","outcome","resolutionStatus","attemptCount","maxAttempts","payload","expiresAt","resolvedAt","createdAt","updatedAt"]},"RuntimeRequestDecisionPayload":{"type":"object","properties":{"subscription_approval":{"$ref":"#/components/schemas/RuntimeRequestSubscriptionApprovalDecisionPayload"}},"additionalProperties":{"nullable":true}},"RuntimeRequestSubscriptionApprovalDecisionPayload":{"type":"object","properties":{"approval_kind":{"type":"string","enum":["subscription_terms"]},"decision":{"$ref":"#/components/schemas/RuntimeRequestSubscriptionApprovalDecisionValue"},"approved_terms_hash":{"$ref":"#/components/schemas/RuntimeRequestSubscriptionTermsHash"},"previous_approved_terms_hash":{"allOf":[{"$ref":"#/components/schemas/RuntimeRequestSubscriptionTermsHash"},{"nullable":true}]}},"required":["approval_kind","decision","approved_terms_hash"],"additionalProperties":false},"RuntimeRequestSubscriptionApprovalDecisionValue":{"type":"string","enum":["subscribe","do_not_subscribe"]},"RuntimeRequestSubscriptionTermsHash":{"type":"string","minLength":1,"pattern":"\\S","description":"Versioned hash of the normalized observed subscription terms.","example":"subscription_terms_v1_8b0f0a2c"},"TaskStop":{"type":"object","properties":{"status":{"type":"string","enum":["canceled"]},"reasonCode":{"type":"string"},"message":{"type":"string"},"stoppedAt":{"type":"string","format":"date-time"}},"required":["status","reasonCode"]},"AgentResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Canonical agent identifier.","example":"bc6a74cb-6ee7-49f2-a91e-0f5eaa6f3b8d"},"name":{"type":"string","description":"Human-readable agent name.","example":"Finance Automation Agent"},"description":{"type":"string","nullable":true,"description":"Optional operator-facing description of the agent purpose.","example":"Handles recurring SaaS and infra payments."},"email":{"type":"string","nullable":true,"format":"email","description":"Canonical managed email address assigned to this agent."},"managed_email":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready"]},"email":{"type":"string","format":"email"},"provider":{"type":"string","enum":["resend"]}},"required":["status","email","provider"]},{"type":"object","properties":{"status":{"type":"string","enum":["unavailable"]},"email":{"type":"string","nullable":true,"format":"email"},"reason":{"type":"string","enum":["domain_not_ready","agent_not_found","not_assigned"]}},"required":["status","email","reason"]}]},"status":{"type":"string","description":"Current agent lifecycle status.","example":"active"},"budget_limit":{"type":"number","nullable":true,"description":"Optional overall budget limit configured for the agent.","example":1000},"daily_limit":{"type":"number","nullable":true,"description":"Optional daily spend limit configured for the agent.","example":100},"transaction_limit":{"type":"number","nullable":true,"description":"Optional per-operation transaction limit configured for the agent.","example":50},"created_at":{"type":"string","description":"Creation timestamp.","example":"2026-02-20T10:00:00.000Z"},"stats":{"type":"object","nullable":true,"properties":{"monthly_spend":{"type":"number","description":"Current month spend attributed to this agent.","example":312.45},"spend_by_category":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","minLength":1},"total":{"type":"number","nullable":true}},"required":["category","total"]},"description":"Current month spend attributed to this agent, grouped by payment rail."},"payment_operation_count_month":{"type":"number","description":"Number of payment operations created by this agent in the current month.","example":16},"active_subscriptions":{"type":"number","description":"Count of active subscription-style payment operations linked to this agent.","example":4}},"required":["monthly_spend","spend_by_category","payment_operation_count_month","active_subscriptions"],"description":"Aggregated recent statistics for the authenticated agent."},"secretSourcePolicy":{"$ref":"#/components/schemas/SecretSourcePolicySnapshot"},"secretReusePolicy":{"$ref":"#/components/schemas/SecretReusePolicySnapshot"}},"required":["id","name","description","email","managed_email","status","budget_limit","daily_limit","transaction_limit","created_at","stats","secretSourcePolicy","secretReusePolicy"],"description":"Authenticated agent profile and aggregated stats."},"SecretSourcePolicySnapshot":{"type":"object","properties":{"value":{"type":"string","enum":["chat","secrets"]},"revision":{"type":"integer","minimum":0},"resolvedAt":{"type":"string","format":"date-time"}},"required":["value","revision","resolvedAt"],"additionalProperties":false},"SecretReusePolicySnapshot":{"type":"object","properties":{"value":{"type":"string","enum":["confirm_each_time","always_allow"]},"revision":{"type":"integer","minimum":0},"resolvedAt":{"type":"string","format":"date-time"}},"required":["value","revision","resolvedAt"],"additionalProperties":false},"AccountCardsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AccountCard"}},"source":{"type":"string","enum":["provider","cache","ulc_v1"]}},"required":["items","source"]},"AccountCard":{"type":"object","properties":{"id":{"type":"string"},"masked_number":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"created_at":{"type":"string"}},"required":["id","masked_number","status","currency"]},"AccountCardBalanceResponse":{"type":"object","properties":{"balance":{"type":"number"},"currency":{"type":"string"},"card_id":{"type":"string","nullable":true}},"required":["balance","currency"]},"AccountCardTransactionsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AccountCardTransaction"}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"next_page":{"type":"string","nullable":true}},"required":["limit","next_page"]}},"required":["items","pagination"]},"AccountCardTransaction":{"type":"object","properties":{"amount":{"type":"string"},"counterparty_name":{"type":"string"},"currency":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"timestamp":{"type":"string"}},"required":["amount","counterparty_name","currency","type","status","timestamp"]},"AccountTransactionsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AccountTransaction"}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"nextPage":{"type":"string","nullable":true}},"required":["limit","nextPage"]}},"required":["items","pagination"]},"AccountTransaction":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"type":{"type":"string","nullable":true},"paymentMethod":{"type":"string","nullable":true},"totalAmountMajor":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"amountAtomic":{"type":"string","nullable":true,"pattern":"^\\d+$"},"amountScale":{"type":"integer","nullable":true,"minimum":0,"maximum":18},"amountAsset":{"type":"string","nullable":true,"minLength":1},"merchantName":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"createdAt":{"type":"string","nullable":true},"updatedAt":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true}},"required":["id","agentId","status","type","paymentMethod","totalAmountMajor","currency","amountAtomic","amountScale","amountAsset","merchantName","description","createdAt","updatedAt","completedAt"]},"TelegramLinkCodeResponse":{"type":"object","properties":{"start_param":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}},"required":["start_param","expires_at"]},"TelegramLinkCodeBody":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":64,"default":"web"}},"additionalProperties":false},"ChatCompletionResponse":{"type":"object","properties":{"id":{"type":"string","description":"Nuncio-generated chat completion identifier.","example":"chatcmpl_aftercard_123"},"object":{"type":"string","enum":["chat.completion"],"example":"chat.completion"},"created":{"type":"integer","minimum":0,"description":"Unix timestamp in seconds.","example":1743286400},"model":{"type":"string","minLength":1,"description":"Normalized public backend catalog model key used for the request.","example":"aftercard/medium"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0,"example":0},"message":{"type":"object","properties":{"role":{"type":"string","enum":["assistant"],"example":"assistant"},"content":{"type":"string","description":"Assistant response content.","example":"{\"elements\":[{\"elementId\":\"1-42\",\"description\":\"Buy button\",\"method\":\"click\",\"arguments\":[]}]}"}},"required":["role","content"],"additionalProperties":false},"finish_reason":{"type":"string","description":"OpenAI-compatible finish reason.","example":"stop"}},"required":["index","message","finish_reason"],"additionalProperties":false},"description":"Single completion choice returned by Nuncio."},"usage":{"$ref":"#/components/schemas/ChatCompletionUsage"}},"required":["id","object","created","model","choices","usage"],"description":"OpenAI-compatible chat completion response returned by Nuncio."},"ChatCompletionUsage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","minimum":0,"example":512},"completion_tokens":{"type":"integer","minimum":0,"example":97},"total_tokens":{"type":"integer","minimum":0,"example":609},"reasoning_tokens":{"type":"integer","minimum":0,"example":0},"cached_input_tokens":{"type":"integer","minimum":0,"example":0}},"required":["prompt_tokens","completion_tokens","total_tokens"],"description":"Normalized token usage returned by the Nuncio LLM gateway."},"ChatCompletionRequest":{"type":"object","properties":{"model":{"type":"string","minLength":1,"description":"Public backend catalog model key or alias. The response echoes the normalized catalog model key.","example":"aftercard/medium"},"messages":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"role":{"type":"string","enum":["system","user"],"description":"Chat message role.","example":"user"},"content":{"anyOf":[{"type":"string","minLength":1,"description":"String content for simple chat messages.","example":"Find actionable elements on this page."},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"description":"Plain text content block.","example":"Find the active checkout form."}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["image_url"]},"image_url":{"type":"object","properties":{"url":{"type":"string","minLength":1,"description":"Inline image data URL.","example":"data:image/jpeg;base64,/9j/4AAQSk..."},"detail":{"type":"string","enum":["auto","low","high"],"description":"Optional OpenAI-compatible image detail hint.","example":"auto"}},"required":["url"],"additionalProperties":false}},"required":["type","image_url"],"additionalProperties":false}]},"minItems":1,"description":"Rich multimodal content array."}]}},"required":["role","content"],"additionalProperties":false},{"type":"object","properties":{"role":{"type":"string","enum":["assistant"],"description":"Assistant message role.","example":"assistant"},"content":{"anyOf":[{"type":"string","description":"Assistant text content. May be empty when tool_calls are present.","example":""},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1,"description":"Plain text content block.","example":"Find the active checkout form."}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["image_url"]},"image_url":{"type":"object","properties":{"url":{"type":"string","minLength":1,"description":"Inline image data URL.","example":"data:image/jpeg;base64,/9j/4AAQSk..."},"detail":{"type":"string","enum":["auto","low","high"],"description":"Optional OpenAI-compatible image detail hint.","example":"auto"}},"required":["url"],"additionalProperties":false}},"required":["type","image_url"],"additionalProperties":false}]},"minItems":1,"description":"Rich multimodal assistant content array."}]},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Provider tool call identifier.","example":"call_123"},"type":{"type":"string","enum":["function"],"description":"OpenAI-compatible tool call type.","example":"function"},"function":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Function/tool name.","example":"click_element"},"arguments":{"type":"string","description":"JSON string containing function arguments.","example":"{\"index\":1}"}},"required":["name","arguments"],"additionalProperties":false}},"required":["id","type","function"],"additionalProperties":false},"minItems":1,"description":"OpenAI-compatible assistant tool calls from earlier turns."}},"required":["role","content"],"additionalProperties":false},{"type":"object","properties":{"role":{"type":"string","enum":["tool"],"description":"OpenAI-compatible tool result role.","example":"tool"},"content":{"type":"string","minLength":1,"description":"Tool result content.","example":"Clicked destination field."},"tool_call_id":{"type":"string","minLength":1,"description":"Tool call id being answered.","example":"call_123"}},"required":["role","content","tool_call_id"],"additionalProperties":false}],"description":"OpenAI-compatible chat message, including tool-call history."},"minItems":1,"description":"OpenAI-compatible chat messages."},"response_format":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["json_schema"]},"json_schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80,"description":"Structured response schema name.","example":"Observation"},"strict":{"type":"boolean","description":"OpenAI-compatible strict mode flag.","example":true},"schema":{"nullable":true,"description":"JSON Schema describing the required structured output.","example":{"type":"object","properties":{"elements":{"type":"array","items":{"type":"object"}}},"required":["elements"]}}},"required":["name"],"additionalProperties":false}},"required":["type","json_schema"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["json_object"]}},"required":["type"],"additionalProperties":false}],"description":"Optional structured output mode."},"temperature":{"type":"number","minimum":0,"maximum":2,"description":"Optional sampling temperature.","example":0.1},"max_completion_tokens":{"type":"integer","minimum":32,"maximum":10000,"description":"Optional output token ceiling. Backend may clamp it.","example":1024}},"required":["model","messages"],"additionalProperties":false,"description":"OpenAI-compatible chat completion request subset supported by Nuncio.","example":{"model":"aftercard/medium","messages":[{"role":"system","content":"Return only valid JSON."},{"role":"user","content":"Find actionable elements."}],"response_format":{"type":"json_schema","json_schema":{"name":"Observation","strict":true,"schema":{"type":"object","properties":{"elements":{"type":"array","items":{"type":"object"}}},"required":["elements"]}}},"temperature":0.1,"max_completion_tokens":1024}},"CaptchaTaskCreateResponse":{"type":"object","properties":{"provider":{"type":"string","example":"capsolver"},"task_id":{"type":"string","example":"task-123456"},"status":{"type":"string","enum":["pending"],"example":"pending"}},"required":["provider","task_id","status"],"description":"Created captcha task metadata."},"CaptchaTaskCreateRequest":{"type":"object","properties":{"type":{"type":"string","enum":["recaptcha-v2","hcaptcha","turnstile"],"description":"CAPTCHA type observed on checkout page.","example":"hcaptcha"},"site_key":{"type":"string","minLength":1,"description":"Site key extracted from captcha widget.","example":"10000000-ffff-ffff-ffff-000000000001"},"page_url":{"type":"string","format":"uri","description":"Page URL where captcha challenge is shown.","example":"https://checkout.example.com/pay"},"action":{"type":"string","minLength":1,"description":"Cloudflare Turnstile challenge action, when required by the provider.","example":"managed"},"data":{"type":"string","minLength":1,"description":"Cloudflare Turnstile challenge cData payload.","example":"cdata-123"},"pagedata":{"type":"string","minLength":1,"description":"Cloudflare Turnstile challenge chlPageData payload.","example":"pagedata-456"},"user_agent":{"type":"string","minLength":1,"description":"Current browser User-Agent required by some challenge-mode captcha providers.","example":"Mozilla/5.0 Challenge Browser"},"invisible":{"type":"boolean","description":"Whether the detected reCAPTCHA v2 widget is invisible.","example":true},"proxy":{"$ref":"#/components/schemas/CaptchaTaskProxy"}},"required":["type","site_key","page_url"],"description":"Create captcha solving task via backend gateway."},"CaptchaTaskProxy":{"type":"object","properties":{"server":{"type":"string","minLength":1,"description":"Proxy server URL or host:port used by the browser session.","example":"http://proxy.example:8080"},"username":{"type":"string","minLength":1,"description":"Proxy username for basic auth, when required.","example":"demo-user"},"password":{"type":"string","minLength":1,"description":"Proxy password for basic auth, when required.","example":"demo-pass"}},"required":["server"],"description":"Exact proxy used by the browser session when the solver must share the same outward IP."},"CaptchaTaskStatusResponse":{"type":"object","properties":{"provider":{"type":"string","example":"capsolver"},"task_id":{"type":"string","example":"task-123456"},"status":{"type":"string","enum":["pending","ready","failed"],"description":"Current status of captcha task.","example":"ready"},"token":{"type":"string","description":"Captcha token when status=ready.","example":"03AFcWeA7..."},"user_agent":{"type":"string","description":"User-Agent returned by the solver for challenge-mode captchas.","example":"Mozilla/5.0 Solver Browser"},"error":{"type":"string","description":"Provider error when status=failed.","example":"CAPTCHA solve timeout"}},"required":["provider","task_id","status"],"description":"Captcha task polling result."},"MarketmapResponse":{"type":"object","properties":{"matches":{"type":"array","items":{"$ref":"#/components/schemas/ProviderAccessMethod"}}},"required":["matches"],"additionalProperties":false},"ProviderAccessMethod":{"type":"object","properties":{"provider":{"type":"string"},"method":{"type":"string"},"urls":{"type":"array","items":{"type":"string","format":"uri"}},"documentationUrl":{"type":"string","nullable":true,"format":"uri"},"instructions":{"type":"string"}},"required":["provider","method","urls","documentationUrl","instructions"],"additionalProperties":false},"MarketmapRequest":{"type":"object","properties":{"query":{"type":"string","description":"Natural-language provider and payment-method query.","example":"find live hotel availability through a paid API"}},"required":["query"],"additionalProperties":false},"PublicServicesResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PublicListing"}},"pagination":{"type":"object","properties":{"offset":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"total":{"type":"integer","minimum":0},"nextOffset":{"type":"integer","nullable":true,"minimum":0}},"required":["offset","limit","total","nextOffset"]},"facets":{"type":"object","properties":{"categories":{"type":"array","items":{"$ref":"#/components/schemas/PublicCategoryFacet"}}},"required":["categories"],"additionalProperties":false,"description":"Present on list responses; omitted on search responses."}},"required":["items"],"additionalProperties":false},"PublicListing":{"type":"object","properties":{"slug":{"type":"string"},"provider":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","nullable":true,"enum":["inference","data","search","media","social","infrastructure","trading","travel","commerce","utilities",null]},"method":{"type":"string"},"hostname":{"type":"string","nullable":true},"hostnames":{"type":"array","items":{"type":"string"}},"urls":{"type":"array","items":{"type":"string"}},"docsUrl":{"type":"string","nullable":true},"trust":{"$ref":"#/components/schemas/PublicTrust"},"stats":{"$ref":"#/components/schemas/PublicStats"}},"required":["slug","provider","description","category","method","hostname","hostnames","urls","docsUrl","trust","stats"],"additionalProperties":false},"PublicTrust":{"type":"object","properties":{"verdict":{"type":"string","enum":["unknown","proceed","caution","avoid"]},"score":{"type":"integer","nullable":true,"minimum":0,"maximum":100},"scoreVersion":{"type":"integer"},"sampleSize":{"type":"integer","nullable":true,"minimum":0},"stale":{"type":"boolean"},"reason":{"type":"string","nullable":true},"override":{"type":"string","nullable":true,"enum":["allow","deny",null]},"payees":{"type":"array","items":{"type":"string"}},"probe":{"$ref":"#/components/schemas/PublicProbe"}},"required":["verdict","score","scoreVersion","sampleSize","stale","reason","override","payees","probe"],"additionalProperties":false,"description":"Advisory only. A verdict never authorizes a payment; Nuncio approval does. `probe` carries the price the seller advertised when we last asked it for payment requirements."},"PublicProbe":{"type":"object","nullable":true,"properties":{"at":{"type":"string"},"outcome":{"type":"string","enum":["payable","no_402","unpayable","defective","unsafe","unreachable","timeout"]},"payable":{"type":"boolean"},"network":{"type":"string","nullable":true},"asset":{"type":"string","nullable":true},"amountAtomic":{"type":"string","nullable":true},"latencyMs":{"type":"integer","nullable":true}},"required":["at","outcome","payable","network","asset","amountAtomic","latencyMs"],"additionalProperties":false},"PublicStats":{"type":"object","nullable":true,"properties":{"settledCount":{"type":"integer","minimum":0},"deliveredCount":{"type":"integer","minimum":0},"failedAfterSettlement":{"type":"integer","minimum":0},"deliveryRate":{"type":"number","nullable":true,"minimum":0,"maximum":1},"lastSettledAt":{"type":"string","nullable":true}},"required":["settledCount","deliveredCount","failedAfterSettlement","deliveryRate","lastSettledAt"],"additionalProperties":false,"description":"Settled-payment statistics for the seller hostname. `null` below the publication floor of five settled payments."},"PublicCategoryFacet":{"type":"object","properties":{"category":{"type":"string","enum":["inference","data","search","media","social","infrastructure","trading","travel","commerce","utilities"]},"count":{"type":"integer","minimum":0}},"required":["category","count"],"additionalProperties":false},"PublicListingDetail":{"type":"object","properties":{"slug":{"type":"string"},"provider":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","nullable":true,"enum":["inference","data","search","media","social","infrastructure","trading","travel","commerce","utilities",null]},"method":{"type":"string"},"hostname":{"type":"string","nullable":true},"hostnames":{"type":"array","items":{"type":"string"}},"urls":{"type":"array","items":{"type":"string"}},"docsUrl":{"type":"string","nullable":true},"trust":{"$ref":"#/components/schemas/PublicTrust"},"stats":{"$ref":"#/components/schemas/PublicStats"},"guidance":{"type":"string","description":"Operator-written execution guidance, exactly as an agent would receive it."}},"required":["slug","provider","description","category","method","hostname","hostnames","urls","docsUrl","trust","stats","guidance"],"additionalProperties":false},"PublicMerchant":{"type":"object","properties":{"hostname":{"type":"string"},"trust":{"$ref":"#/components/schemas/PublicTrust"},"stats":{"$ref":"#/components/schemas/PublicStats"},"registry":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"provider":{"type":"string"},"method":{"type":"string"}},"required":["slug","provider","method"],"additionalProperties":false}}},"required":["hostname","trust","stats","registry"],"additionalProperties":false},"MerchantCheckResponse":{"type":"object","properties":{"merchants":{"type":"array","items":{"$ref":"#/components/schemas/MerchantCheckItem"}}},"required":["merchants"],"additionalProperties":false},"MerchantCheckItem":{"type":"object","properties":{"url":{"type":"string"},"hostname":{"type":"string","nullable":true},"verdict":{"type":"string","enum":["unknown","proceed","caution","avoid"]},"score":{"type":"integer","nullable":true,"minimum":0,"maximum":100},"sampleSize":{"type":"integer","minimum":0},"stale":{"type":"boolean"},"reason":{"type":"string","nullable":true},"override":{"type":"string","nullable":true,"enum":["allow","deny",null]},"probe":{"type":"object","nullable":true,"properties":{"at":{"type":"string"},"outcome":{"type":"string","enum":["payable","no_402","unpayable","defective","unsafe"]},"payable":{"type":"boolean"},"network":{"type":"string","nullable":true},"asset":{"type":"string","nullable":true},"latencyMs":{"type":"integer","nullable":true,"minimum":0},"httpStatus":{"type":"integer","nullable":true,"minimum":100,"maximum":599},"reason":{"type":"string","nullable":true},"field":{"type":"string","nullable":true}},"required":["at","outcome","payable","network","asset","latencyMs"],"additionalProperties":false},"stats":{"type":"object","properties":{"settledCount":{"type":"integer","minimum":0},"deliveredCount":{"type":"integer","minimum":0},"failedAfterSettlement":{"type":"integer","minimum":0},"deliveryRate":{"type":"number","nullable":true,"minimum":0,"maximum":1},"lastSettledAt":{"type":"string","nullable":true},"lastFailureAt":{"type":"string","nullable":true}},"required":["settledCount","deliveredCount","failedAfterSettlement","deliveryRate","lastSettledAt","lastFailureAt"],"additionalProperties":false},"registry":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"method":{"type":"string"}},"required":["provider","method"],"additionalProperties":false}},"check":{"type":"object","properties":{"state":{"type":"string","enum":["none","ran","running","rate_limited","invalid","unavailable"]}},"required":["state"],"additionalProperties":false}},"required":["url","hostname","verdict","score","sampleSize","stale","reason","override","probe","stats","registry","check"],"additionalProperties":false},"MerchantCheckRequest":{"type":"object","properties":{"requests":{"type":"array","items":{"$ref":"#/components/schemas/MerchantCheckRequestItem"},"minItems":1,"maxItems":10}},"required":["requests"],"additionalProperties":false},"MerchantCheckRequestItem":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"example":"https://esimqr.link/api/agent/purchase"},"method":{"type":"string","maxLength":32},"headers":{"type":"object","additionalProperties":{"type":"string","maxLength":1024}},"body":{"nullable":true}},"required":["url"],"additionalProperties":false},"TaskEnvelope":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"},"currentRequest":{"$ref":"#/components/schemas/TaskCurrentRequest"},"browser":{"$ref":"#/components/schemas/TaskBrowserBinding"}},"required":["task","currentRequest","browser"]},"Task":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["in_progress","waiting_for_user","error","canceled","completed"]},"type":{"type":"string","enum":["payment","subscription","cancellation","general"]},"paymentMethod":{"type":"string","nullable":true,"enum":["card","crypto","x402",null]},"totalAmountMajor":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"amountAtomic":{"type":"string","nullable":true,"pattern":"^\\d+$"},"amountScale":{"type":"integer","nullable":true,"minimum":0,"maximum":18},"amountAsset":{"type":"string","nullable":true,"minLength":1},"merchantName":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"currentRequestId":{"type":"string","nullable":true,"format":"uuid"},"pendingInput":{"$ref":"#/components/schemas/TaskPendingInput"},"lastEventSequence":{"type":"integer","minimum":0},"revision":{"type":"integer","minimum":0},"closeState":{"type":"string","enum":["open","closing","closed"]},"phase":{"type":"string","nullable":true,"enum":["clarification","execution_preparation","execution","completed",null]},"phaseMetadata":{"$ref":"#/components/schemas/TaskJsonRecord"},"commerceProviderId":{"type":"string","nullable":true},"commerceMethodKey":{"type":"string","nullable":true},"commerceMethodType":{"type":"string","nullable":true,"enum":["x402","mcp","api","reversed_api","browser",null]},"commerceProviderName":{"type":"string","nullable":true},"commerceSelection":{"$ref":"#/components/schemas/TaskJsonRecord"},"commerceExecutionMetadata":{"$ref":"#/components/schemas/TaskJsonRecord"},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"context":{"$ref":"#/components/schemas/TaskJsonRecord"},"metadata":{"$ref":"#/components/schemas/TaskJsonRecord"},"secretSourcePolicy":{"$ref":"#/components/schemas/SecretSourcePolicySnapshot"},"secretReusePolicy":{"$ref":"#/components/schemas/SecretReusePolicySnapshot"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","nullable":true,"format":"date-time"},"computeUsage":{"$ref":"#/components/schemas/TaskComputeUsage"},"computeReceipts":{"type":"array","items":{"$ref":"#/components/schemas/TaskComputeReceipt"}}},"required":["id","agentId","status","type","paymentMethod","totalAmountMajor","currency","amountAtomic","amountScale","amountAsset","merchantName","description","currentRequestId","lastEventSequence","errorCode","errorMessage","context","metadata","secretSourcePolicy","secretReusePolicy","createdAt","updatedAt","completedAt"]},"TaskPendingInput":{"type":"object","nullable":true,"properties":{"chatRunId":{"type":"string"},"inputId":{"type":"string"},"revision":{"type":"integer","minimum":0},"conversationId":{"type":"string"},"clientType":{"type":"string","enum":["app","telegram","whatsapp"]},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"header":{"type":"string"},"question":{"type":"string"},"browser":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"integer"},"mode":{"type":"string","enum":["view","control"]}},"required":["url","expiresAt","mode"]},"options":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"description":{"type":"string"}},"required":["label","description"]},"maxItems":8}},"required":["id","header","question"]},"minItems":1,"maxItems":3},"replyUrl":{"type":"string","nullable":true,"format":"uri"}},"required":["chatRunId","inputId","conversationId","clientType","questions","replyUrl"]},"TaskJsonRecord":{"type":"object","nullable":true,"additionalProperties":{"nullable":true},"description":"Arbitrary JSON object stored without additional schema validation."},"TaskComputeUsage":{"type":"object","properties":{"chargedAmount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"chargedAsset":{"type":"string","enum":["USD"]},"pending":{"type":"boolean"},"direct":{"type":"object","properties":{"accruedAmount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"collectingAmount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"paidAmount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"writtenOffAmount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"pendingEvidence":{"type":"boolean"}},"required":["accruedAmount","collectingAmount","paidAmount","writtenOffAmount","pendingEvidence"]}},"required":["chargedAmount","chargedAsset","pending"]},"TaskComputeReceipt":{"type":"object","properties":{"chatRunId":{"type":"string"},"chargedAmount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"chargedAsset":{"type":"string","enum":["USD","USDC"]},"occurredAt":{"type":"string","format":"date-time"},"billingStatus":{"type":"string","enum":["accrued","collecting","settled","written_off"]},"collectionId":{"type":"string","format":"uuid"},"collectionAmount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"transactionHash":{"type":"string","pattern":"^0x[0-9a-f]{64}$/u"}},"required":["chatRunId","chargedAmount","chargedAsset","occurredAt","billingStatus"]},"TaskCurrentRequest":{"type":"object","nullable":true,"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["secret_read","secret_write","purchase","payment_approval","captcha","alert"]},"status":{"type":"string","enum":["pending","fulfilled","denied","expired","failed","canceled"]},"blocking":{"type":"boolean"},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","type","status","blocking","title","summary","createdAt","updatedAt","expiresAt"]},"TaskBrowserBinding":{"type":"object","nullable":true,"properties":{"sessionId":{"type":"string","minLength":1,"description":"Stable browser instance identifier when the workflow task is bound to a live browser runtime.","example":"browser_123"}},"required":["sessionId"],"additionalProperties":false,"description":"Optional browser binding for tasks attached to a live browser runtime."},"CreateTaskBody":{"type":"object","properties":{"clientRequestId":{"type":"string","minLength":1,"maxLength":256,"description":"Stable key for this exact task creation. Retry unchanged facts with the same key after a missing response; changed facts conflict.","example":"task-create-1"},"agentId":{"type":"string","format":"uuid","description":"Explicit agent id when the caller is authenticated with a signed-in user task instead of an agent-scoped API key.","example":"550e8400-e29b-41d4-a716-446655440000"},"browser":{"$ref":"#/components/schemas/CreateTaskBrowser"},"type":{"type":"string","enum":["payment","subscription","cancellation","general"],"default":"payment"},"paymentMethod":{"type":"string","nullable":true,"enum":["card","crypto","x402",null]},"totalAmountMajor":{"type":"number","nullable":true,"minimum":0,"description":"Optional current amount estimate.","example":19.99},"currency":{"type":"string","nullable":true,"minLength":3,"maxLength":3,"description":"Currency code if amount is already known.","example":"USD"},"merchantName":{"type":"string","nullable":true,"minLength":1,"description":"Merchant or target service name if already known.","example":"OpenAI"},"description":{"type":"string","nullable":true,"minLength":1,"description":"Operator-facing task description.","example":"Checkout flow for API usage renewal"},"phase":{"type":"string","nullable":true,"enum":["clarification","execution_preparation","execution","completed",null],"description":"Optional payment-agent phase for staged orchestration flows such as clarification or provider search.","example":"clarification"},"phaseMetadata":{"type":"object","nullable":true,"additionalProperties":{"nullable":true},"description":"Optional structured phase details such as missing clarification fields or provider-search candidates."},"commerceProviderId":{"type":"string","nullable":true,"minLength":1,"description":"Optional selected provider id when a curated commerce provider is already known.","example":"openai.chatgpt_plus.monthly"},"commerceMethodKey":{"type":"string","nullable":true,"minLength":1,"description":"Optional selected provider method key for staged execution flows.","example":"browser-checkout"},"commerceMethodType":{"type":"string","nullable":true,"enum":["x402","mcp","api","reversed_api","browser",null],"description":"Optional selected provider method type for staged execution flows.","example":"browser"},"commerceProviderName":{"type":"string","nullable":true,"minLength":1,"description":"Optional selected provider display name.","example":"openai"},"commerceSelection":{"type":"object","nullable":true,"additionalProperties":{"nullable":true},"description":"Optional structured selection details for the chosen provider or method."},"commerceExecutionMetadata":{"type":"object","nullable":true,"additionalProperties":{"nullable":true},"description":"Optional structured execution metadata for staged or mock commerce execution."},"context":{"$ref":"#/components/schemas/TaskJsonRecord"},"metadata":{"$ref":"#/components/schemas/TaskJsonRecord"},"telemetry":{"$ref":"#/components/schemas/TaskTelemetryEnvelope"}},"required":["clientRequestId"],"additionalProperties":false},"CreateTaskBrowser":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"description":"Stable browser instance identifier returned by the browser runtime.","example":"browser_123"},"entryCommand":{"type":"string","enum":["start-session"],"description":"Optional browser-runtime start marker for runtimes that track command provenance."},"page":{"$ref":"#/components/schemas/TaskPage"},"run":{"$ref":"#/components/schemas/TaskRun"},"step":{"$ref":"#/components/schemas/TaskStep"}},"required":["sessionId"],"additionalProperties":false,"description":"Optional browser binding and runtime metadata for browser-driven tasks."},"TaskPage":{"type":"object","properties":{"ref":{"type":"string","minLength":1,"description":"CLI page ref from the local runtime graph.","example":"p0"},"url":{"type":"string","format":"uri","description":"Current page URL.","example":"https://example.com/checkout"},"title":{"type":"string","minLength":1,"description":"Current page title when available.","example":"Checkout"}}},"TaskRun":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Optional caller-side run id for local runtime correlation.","example":"run_123"},"startedAt":{"type":"string","format":"date-time","description":"ISO timestamp when the local run started.","example":"2026-03-26T09:00:00.000Z"},"endedAt":{"type":"string","format":"date-time","description":"ISO timestamp when the local run ended, if already known.","example":"2026-03-26T09:15:00.000Z"},"source":{"type":"string","enum":["cli","test","replay"],"default":"cli","description":"Run producer source when the caller tracks local runtime lineage."},"status":{"type":"string","enum":["running","completed","failed","aborted"],"description":"Current run status if the caller already knows it.","example":"running"},"profile":{"type":"string","minLength":1,"description":"Named browser profile when a browser runtime is active.","example":"default"},"siteHost":{"type":"string","minLength":1,"description":"Best-effort host summary for the current target site or API origin.","example":"example.com"},"isProtected":{"type":"boolean","description":"Whether the run is currently flagged as sensitive.","example":false}},"required":["id","startedAt"],"additionalProperties":false},"TaskStep":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Optional caller-side step id for local runtime correlation.","example":"step_start_session_1"},"ordinal":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Step ordinal inside the local run.","example":1},"command":{"type":"string","minLength":1,"description":"CLI command that produced this step.","example":"start-session"},"startedAt":{"type":"string","format":"date-time","description":"ISO timestamp when the local step started.","example":"2026-03-26T09:00:00.000Z"},"endedAt":{"type":"string","format":"date-time","description":"ISO timestamp when the local step ended, if already known.","example":"2026-03-26T09:00:01.000Z"},"success":{"type":"boolean","description":"Final command result when the step is already completed.","example":true},"outcomeType":{"type":"string","minLength":1,"description":"Short machine-readable outcome category.","example":"workflow_session_started"},"message":{"type":"string","minLength":1,"description":"Human-readable summary of the command result.","example":"Workflow task started."},"reason":{"type":"string","minLength":1,"description":"Optional longer error or blocking reason.","example":"A new workflow session was started on the same browser session."},"pageRef":{"type":"string","minLength":1,"description":"Current page ref at the time of the step.","example":"p0"},"targetRef":{"type":"string","minLength":1,"description":"Target ref when the step acts on a specific target.","example":"t0"},"surfaceRef":{"type":"string","minLength":1,"description":"Surface ref when the step acts on a surface.","example":"s0"},"fillRef":{"type":"string","minLength":1,"description":"Fill ref when the step is related to a fill action.","example":"fill_123"},"beforeSnapshotId":{"type":"string","minLength":1,"description":"Before snapshot id captured locally, if any.","example":"snap_before_1"},"afterSnapshotId":{"type":"string","minLength":1,"description":"After snapshot id captured locally, if any.","example":"snap_after_1"},"eventCount":{"type":"integer","minimum":0,"description":"Count of local child events captured for this step.","example":2},"childSpanCount":{"type":"integer","minimum":0,"description":"Count of child spans linked to this step.","example":0},"isProtected":{"type":"boolean","description":"Whether the step is marked as sensitive.","example":false}},"required":["id","ordinal","command","startedAt"],"additionalProperties":false},"TaskTelemetryEnvelope":{"type":"object","properties":{"rootTrace":{"nullable":true,"description":"Root OTLP traces payload in the same structure the local CLI exports."},"stepTrace":{"nullable":true,"description":"Step OTLP traces payload in the same structure the local CLI exports."}},"additionalProperties":false},"TaskComputeResponse":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","format":"uuid"},"computeUsage":{"$ref":"#/components/schemas/TaskComputeUsage"}},"required":["taskId","computeUsage"]}}},"required":["items"]},"TaskSurface":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"},"requests":{"type":"array","items":{"$ref":"#/components/schemas/RuntimeRequestRecord"}},"events":{"type":"array","items":{"$ref":"#/components/schemas/TaskEvent"}}},"required":["task","requests","events"]},"TaskEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"taskId":{"type":"string","format":"uuid"},"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true},"type":{"type":"string","enum":["state","observe","reflect","action","error"]},"actor":{"type":"string"},"summary":{"type":"string"},"payload":{"$ref":"#/components/schemas/TaskJsonRecord"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","taskId","sequence","type","actor","summary","payload","createdAt"]},"TaskPaymentResult":{"type":"object","properties":{"taskId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["succeeded","submitted_pending","pending","failed_recoverable","failed_terminal","ambiguous","unknown"]},"failureReason":{"type":"string","nullable":true,"enum":["insufficient_funds","card_declined","expired_card","invalid_card","incorrect_cvc","authentication_required","card_not_supported","provider_unavailable","merchant_rejected","request_expired","unknown",null]},"providerCode":{"type":"string","nullable":true,"maxLength":64},"retryable":{"type":"boolean"},"operationId":{"type":"string","nullable":true,"pattern":"^mpo_[0-9a-f]{64}$"},"providerTransactionId":{"type":"string","nullable":true,"maxLength":200},"evidenceSource":{"type":"string","enum":["provider_transaction","payment_operation","merchant_checkout","none"]},"observedAt":{"type":"string","nullable":true,"format":"date-time"},"totalAmountMajor":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true,"minLength":1,"maxLength":12},"network":{"type":"string","nullable":true,"minLength":1,"maxLength":100},"merchantName":{"type":"string","nullable":true},"provider":{"type":"string","nullable":true},"browserObservation":{"type":"object","properties":{"executionAttemptId":{"type":"string","format":"uuid"},"clientResultId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"result":{"type":"string","enum":["clicked"]},"submissionState":{"type":"string","enum":["submitted"]},"merchantOutcome":{"type":"string","enum":["success","failure","pending","unknown"]}},"required":["executionAttemptId","clientResultId","result","submissionState","merchantOutcome"]},"continuation":{"type":"object","nullable":true,"properties":{"url":{"type":"string","format":"uri"},"source":{"type":"string","enum":["provider","current_checkout","commerce_selection","merchant_origin"]},"preservesMerchantState":{"type":"boolean","enum":[false]}},"required":["url","source","preservesMerchantState"]}},"required":["taskId","status","failureReason","providerCode","retryable","operationId","providerTransactionId","evidenceSource","observedAt","totalAmountMajor","currency","network","merchantName","provider","continuation"]},"SubscriptionEnrollmentInput":{"type":"object","properties":{"clientRequestId":{"type":"string"},"pageUrl":{"type":"string"},"merchantDomain":{"type":"string"},"merchantName":{"type":"string"},"amountDueNow":{"type":"number","enum":[0]},"currency":{"type":"string"},"executionOwner":{"type":"string","enum":["user"]},"billingTerms":{"type":"array","items":{"type":"string"}},"subscriptionDetails":{"type":"object","properties":{"planLabel":{"type":"string"},"recurringAmount":{"type":"number"},"recurringCurrency":{"type":"string"},"recurringAmountKind":{"type":"string","enum":["fixed","variable"]},"intervalUnit":{"type":"string","enum":["day","week","month","year"]},"intervalCount":{"type":"number"},"nextRenewalAt":{"type":"string"},"trialEndAt":{"type":"string"},"autoRenews":{"type":"boolean"},"cancellationHint":{"type":"string"},"cancellationUrl":{"type":"string"}},"required":["recurringAmount","recurringCurrency","recurringAmountKind","intervalUnit","intervalCount"],"additionalProperties":false}},"required":["clientRequestId","pageUrl","merchantDomain","merchantName","amountDueNow","currency","executionOwner","billingTerms","subscriptionDetails"],"additionalProperties":false},"TaskEventResponse":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"},"currentRequest":{"$ref":"#/components/schemas/TaskCurrentRequest"},"browser":{"$ref":"#/components/schemas/TaskBrowserBinding"},"event":{"allOf":[{"$ref":"#/components/schemas/TaskEvent"},{"nullable":true}]},"duplicate":{"type":"boolean","description":"Whether this was an idempotent replay of an already ingested event.","example":false},"workflowStatus":{"type":"string","enum":["completed","canceled","failed"]},"cleanupDisposition":{"type":"string","enum":["released_pre_submit","released_after_failure","released_platform_liability","cleanup_pending","preserved_for_reconciliation","already_completed_by_operation","already_terminal"]},"settlementStatus":{"type":"string","enum":["not_started","pending","succeeded","failed"]},"operationId":{"type":"string","nullable":true},"freshStartAllowed":{"type":"boolean"},"nextAction":{"type":"string","enum":["none","retry_cleanup_same_operation","reconcile_same_operation"]}},"required":["task","currentRequest","browser","event","duplicate"]},"CompleteTaskBody":{"type":"object","properties":{"clientCompletionId":{"type":"string","minLength":1,"description":"Idempotency key for one logical workflow-task completion attempt.","example":"complete_session_1"},"status":{"type":"string","enum":["completed","canceled","error"],"description":"Terminal workflow-task status requested by the CLI.","example":"completed"},"command":{"type":"string","minLength":1,"description":"CLI command that triggered this terminal transition.","example":"end-session"},"summary":{"type":"string","minLength":1,"description":"Human-readable terminal task summary.","example":"Workflow task completed."},"timestamp":{"type":"string","format":"date-time","description":"When the terminal transition happened on the CLI side.","example":"2026-03-26T09:15:00.000Z"},"totalAmountMajor":{"type":"number","nullable":true,"minimum":0,"description":"Optional final purchase amount for this workflow task.","example":19.99},"currency":{"type":"string","nullable":true,"minLength":3,"maxLength":3,"description":"Optional final three-letter purchase currency code.","example":"USD"},"merchantName":{"type":"string","nullable":true,"minLength":1,"description":"Optional final merchant or payee name.","example":"OpenAI"},"details":{"$ref":"#/components/schemas/TaskJsonRecord"},"telemetry":{"$ref":"#/components/schemas/TaskTelemetryEnvelope"},"browser":{"$ref":"#/components/schemas/CompleteTaskBrowser"}},"required":["clientCompletionId","status","command","summary","timestamp"],"additionalProperties":false},"CompleteTaskBrowser":{"type":"object","properties":{"page":{"$ref":"#/components/schemas/TaskPage"},"run":{"$ref":"#/components/schemas/TaskTerminalRun"},"step":{"$ref":"#/components/schemas/TaskStep"}},"additionalProperties":false},"TaskTerminalRun":{"allOf":[{"$ref":"#/components/schemas/TaskRun"},{"type":"object","properties":{"status":{"type":"string","enum":["completed","failed","aborted"],"description":"Final local run status for this workflow task.","example":"completed"}},"required":["status"],"additionalProperties":false}]},"CreateTaskEventBody":{"type":"object","properties":{"clientEventId":{"type":"string","minLength":1,"description":"Idempotency key generated by the CLI for this task event.","example":"evt_start_session_completed_1"},"sequence":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Strictly increasing task event sequence number.","example":2},"type":{"type":"string","enum":["state","observe","reflect","action","error"]},"command":{"type":"string","minLength":1,"description":"CLI command that emitted the event.","example":"observe"},"status":{"type":"string","enum":["started","completed","blocked","failed"]},"summary":{"type":"string","minLength":1,"description":"Human-readable event summary.","example":"Observation completed."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened on the CLI side.","example":"2026-03-26T09:02:00.000Z"},"phase":{"type":"string","nullable":true,"enum":["clarification","execution_preparation","execution","completed",null],"description":"Optional next phase for staged payment-agent orchestration flows.","example":"execution_preparation"},"phaseMetadata":{"type":"object","nullable":true,"additionalProperties":{"nullable":true},"description":"Optional structured phase details to persist alongside the event."},"commerceProviderId":{"type":"string","nullable":true,"minLength":1},"commerceMethodKey":{"type":"string","nullable":true,"minLength":1},"commerceMethodType":{"type":"string","nullable":true,"enum":["x402","mcp","api","reversed_api","browser",null]},"commerceProviderName":{"type":"string","nullable":true,"minLength":1},"commerceSelection":{"$ref":"#/components/schemas/TaskJsonRecord"},"commerceExecutionMetadata":{"$ref":"#/components/schemas/TaskJsonRecord"},"totalAmountMajor":{"type":"number","nullable":true,"minimum":0,"description":"Optional latest known purchase amount for this workflow task.","example":19.99},"currency":{"type":"string","nullable":true,"minLength":3,"maxLength":3,"description":"Optional latest known three-letter purchase currency code.","example":"USD"},"merchantName":{"type":"string","nullable":true,"minLength":1,"description":"Optional latest known merchant or payee name.","example":"OpenAI"},"details":{"$ref":"#/components/schemas/TaskJsonRecord"},"telemetry":{"$ref":"#/components/schemas/TaskTelemetryEnvelope"},"browser":{"$ref":"#/components/schemas/TaskBrowserRuntime"}},"required":["clientEventId","sequence","type","command","status","summary","timestamp"],"additionalProperties":false},"TaskBrowserRuntime":{"type":"object","properties":{"page":{"$ref":"#/components/schemas/TaskPage"},"run":{"$ref":"#/components/schemas/TaskRun"},"step":{"$ref":"#/components/schemas/TaskStep"}},"additionalProperties":false},"ActivityResponse":{"type":"object","properties":{"nextCursor":{"type":"object","nullable":true,"properties":{"occurredAt":{"type":"string","format":"date-time"},"id":{"type":"string"}},"required":["occurredAt","id"]},"items":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/WorkflowSessionActivityItem"},{"$ref":"#/components/schemas/TopUpActivityItem"},{"$ref":"#/components/schemas/AgentUsageActivityItem"}],"discriminator":{"propertyName":"kind","mapping":{"task":"#/components/schemas/WorkflowSessionActivityItem","top_up":"#/components/schemas/TopUpActivityItem","agent_usage":"#/components/schemas/AgentUsageActivityItem"}}}}},"required":["items"]},"WorkflowSessionActivityItem":{"type":"object","properties":{"kind":{"type":"string","enum":["task"]},"id":{"type":"string"},"occurredAt":{"type":"string","format":"date-time"},"task":{"$ref":"#/components/schemas/ActivityTask"}},"required":["kind","id","occurredAt","task"]},"ActivityTask":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"agentId":{"type":"string"},"type":{"type":"string","nullable":true},"paymentMethod":{"type":"string","nullable":true},"approach":{"type":"string","nullable":true},"merchantName":{"type":"string","nullable":true},"totalAmountMajor":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"amountAtomic":{"type":"string","nullable":true,"pattern":"^\\d+$"},"amountScale":{"type":"integer","nullable":true,"minimum":0,"maximum":18},"amountAsset":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["in_progress","waiting_for_user","error","canceled","completed"]},"currentRequestId":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"context":{"type":"object","additionalProperties":{"nullable":true}},"currentRequestStatus":{"type":"string","nullable":true},"phase":{"type":"string","nullable":true},"commerceProviderId":{"type":"string","nullable":true},"commerceMethodKey":{"type":"string","nullable":true},"commerceMethodType":{"type":"string","nullable":true},"commerceProviderName":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","nullable":true,"format":"date-time"},"agents":{"type":"object","nullable":true,"properties":{"name":{"type":"string"}},"required":["name"]},"computeUsage":{"$ref":"#/components/schemas/TaskComputeUsage"}},"required":["id","userId","agentId","type","paymentMethod","merchantName","totalAmountMajor","currency","description","status","currentRequestId","metadata","createdAt","updatedAt","completedAt"]},"TopUpActivityItem":{"type":"object","properties":{"kind":{"type":"string","enum":["top_up"]},"id":{"type":"string"},"occurredAt":{"type":"string","format":"date-time"},"operationId":{"type":"string"},"status":{"type":"string","enum":["completed"]},"simulated":{"type":"boolean"},"externalSettlementVerified":{"type":"boolean"},"creditedAmount":{"type":"string"},"creditedAsset":{"type":"string"},"source":{"type":"object","properties":{"kind":{"type":"string","enum":["crypto"]},"amount":{"type":"string"},"asset":{"type":"string"},"network":{"type":"string"}},"required":["kind","amount","asset","network"]}},"required":["kind","id","occurredAt","operationId","status","creditedAmount","creditedAsset","source"]},"AgentUsageActivityItem":{"type":"object","properties":{"kind":{"type":"string","enum":["agent_usage"]},"id":{"type":"string"},"occurredAt":{"type":"string","format":"date-time"},"chatRunId":{"type":"string"},"conversationId":{"type":"string","nullable":true},"conversationTitle":{"type":"string","nullable":true},"status":{"type":"string","enum":["completed"]},"chargedAmount":{"type":"string"},"chargedAsset":{"type":"string","enum":["USD"]},"pending":{"type":"boolean"}},"required":["kind","id","occurredAt","chatRunId","conversationId","conversationTitle","status","chargedAmount","chargedAsset"]},"WalletTransaction":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["top_up","compute","x402","crypto_send","card"]},"direction":{"type":"string","enum":["in","out"]},"amount":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$"},"asset":{"type":"string"},"status":{"type":"string","enum":["pending","confirmed","failed"]},"counterparty":{"type":"string","nullable":true},"transactionHash":{"type":"string","nullable":true},"taskId":{"type":"string","nullable":true,"format":"uuid"},"occurredAt":{"type":"string"}},"required":["id","kind","direction","amount","asset","status","counterparty","transactionHash","taskId","occurredAt"]},"CreateRuntimeRequestBody":{"type":"object","properties":{"clientRequestId":{"type":"string","minLength":1},"ttlMs":{"type":"integer","minimum":0,"exclusiveMinimum":true},"kind":{"type":"string","enum":["data","action","choice"]},"spec":{"type":"object","additionalProperties":{"nullable":true}},"context":{"$ref":"#/components/schemas/RuntimeRequestContext"},"bridge":{"$ref":"#/components/schemas/RuntimeRequestBridge"}},"required":["clientRequestId","kind","spec"],"additionalProperties":false},"RuntimeRequestContext":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"pageTitle":{"type":"string","minLength":1},"merchantName":{"type":"string","minLength":1},"formPurpose":{"type":"string","minLength":1}},"additionalProperties":false},"RuntimeRequestBridge":{"type":"object","properties":{"pageRef":{"type":"string","minLength":1},"fillRef":{"type":"string","minLength":1},"scopeRef":{"type":"string","minLength":1},"surfaceRef":{"type":"string","minLength":1}},"additionalProperties":false},"RequestDecisionBody":{"type":"object","properties":{"decision":{"type":"string","enum":["confirmed","provided","deny","denied","cancel","canceled","timeout","expired","choose_candidate"]},"selectedItemRef":{"type":"string","minLength":1},"selectedChoiceId":{"type":"string","minLength":1},"adjustmentPrompt":{"type":"string","minLength":1,"maxLength":2000},"selectedAssemblyId":{"type":"string","minLength":1},"targetItemId":{"type":"string","minLength":1},"inlineApprovalRuleRequest":{"type":"object","properties":{"requested":{"type":"boolean"},"mode":{"type":"string","enum":["auto","confirm","provide","auto_with_limit"]},"limit":{"type":"number","minimum":0},"currency":{"type":"string","minLength":1},"period":{"type":"string","enum":["hour","day","week","month","total"]}},"required":["requested"]},"autoApprovalRequest":{"type":"object","properties":{"enabled":{"type":"boolean","enum":[true]},"budgetAtomic":{"type":"string","pattern":"^[1-9][0-9]{0,37}$/u"}},"required":["enabled","budgetAtomic"],"additionalProperties":false},"applicabilityUpdate":{"type":"object","properties":{"addSites":{"type":"array","items":{"type":"string","minLength":1}}}},"subscriptionApproval":{"$ref":"#/components/schemas/RuntimeRequestSubscriptionApprovalDecisionPayload"},"checkoutApprovalFingerprint":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$"},"values":{"type":"object","additionalProperties":{"nullable":true}},"reuseGroups":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":512}},"phoneParts":{"type":"object","additionalProperties":{"type":"object","properties":{"fullPhone":{"type":"string","maxLength":32},"countryCode":{"type":"string","maxLength":5},"phone":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2}},"required":["fullPhone","countryCode","phone"],"additionalProperties":false}},"save":{"type":"boolean"},"saveAs":{"type":"object","properties":{"displayName":{"type":"string","minLength":1},"fieldHints":{"type":"object","additionalProperties":{"type":"string","minLength":1}}}},"saveGroups":{"type":"array","items":{"type":"object","properties":{"group_ref":{"type":"string","minLength":1,"maxLength":512},"template_version":{"type":"integer","minimum":0,"exclusiveMinimum":true},"field_mappings":{"type":"array","items":{"type":"object","properties":{"request_field_key":{"type":"string","minLength":1,"maxLength":512},"template_field_key":{"type":"string","minLength":1,"maxLength":120}},"required":["request_field_key","template_field_key"],"additionalProperties":false},"minItems":1,"maxItems":100},"save_as":{"type":"object","properties":{"template_key":{"type":"string","minLength":1,"maxLength":120},"display_label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"entity":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["existing"]},"entity_id":{"type":"string","format":"uuid"}},"required":["kind","entity_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["new"]},"type":{"type":"string","enum":["person","organization"]},"display_name":{"type":"string","minLength":1,"maxLength":120}},"required":["kind","type","display_name"],"additionalProperties":false}]}},"required":["template_key","display_label","description"],"additionalProperties":false}},"required":["group_ref","template_version","field_mappings","save_as"],"additionalProperties":false},"minItems":1}},"required":["decision"],"additionalProperties":false},"RuntimeRequestConfirmOtpBody":{"type":"object","properties":{"otp":{"type":"string","pattern":"^\\d{6}$"}},"required":["otp"]},"RuntimeArtifactClaim":{"type":"object","properties":{"artifact":{"$ref":"#/components/schemas/RuntimeArtifact"},"taskStop":{"$ref":"#/components/schemas/TaskStop"}}},"RuntimeArtifact":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["values"]},"values":{"type":"object","additionalProperties":{"nullable":true}}},"required":["kind","values"]},{"type":"object","properties":{"kind":{"type":"string","enum":["signature"]},"signature":{"type":"string"},"signer":{"type":"string"}},"required":["kind","signature","signer"]},{"type":"object","properties":{"kind":{"type":"string","enum":["reference"]},"reference":{"type":"string"},"metadata":{"type":"object","additionalProperties":{"nullable":true}}},"required":["kind","reference"]},{"type":"object","properties":{"kind":{"type":"string","enum":["confirmation"]},"confirmed":{"type":"boolean","enum":[true]}},"required":["kind","confirmed"]},{"type":"object","properties":{"kind":{"type":"string","enum":["choice"]},"selected_option":{"type":"object","additionalProperties":{"nullable":true}},"adjustment_prompt":{"type":"string"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","enum":["memory_current_run_artifact"]},"value_scope":{"type":"string","enum":["current_run"]},"usable":{"type":"boolean","enum":[true]},"field_keys":{"type":"array","items":{"type":"string"}},"value_handle":{"type":"object","properties":{"resolver":{"type":"string"},"value_class":{"type":"string"},"ref":{"type":"string"}},"required":["resolver","value_class","ref"]},"memory_mutation":{"type":"string"},"values":{"type":"object","additionalProperties":{"nullable":true}},"selected_item_ref":{"type":"string"},"selected_assembly_id":{"type":"string"}},"required":["kind","value_scope","usable","field_keys","value_handle","memory_mutation"]},{"type":"object","properties":{"kind":{"type":"string","enum":["memory_current_run_artifact"]},"value_scope":{"type":"string","enum":["current_run"]},"usable":{"type":"boolean","enum":[true]},"field_keys":{"type":"array","items":{"type":"string"}},"values":{"type":"object","additionalProperties":{"nullable":true}}},"required":["kind","value_scope","usable","field_keys","values"]}]},"RuntimeRequestList":{"type":"object","properties":{"requests":{"type":"array","items":{"$ref":"#/components/schemas/RuntimeRequestRecord"}}},"required":["requests"]},"RuntimeRequestEventsResponse":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/RuntimeRequestEvent"}}},"required":["events"]},"RuntimeRequestEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"requestId":{"type":"string","format":"uuid"},"type":{"type":"string"},"actor":{"type":"string"},"summary":{"type":"string"},"payload":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","requestId","type","actor","summary","payload","createdAt"]},"HandoverCardRevealStartResponse":{"type":"object","properties":{"status":{"type":"string","enum":["otp_sent"]},"email_masked":{"type":"string"},"expires_at":{"type":"string"},"attempts_remaining":{"type":"integer"}},"required":["status","email_masked","expires_at","attempts_remaining"]},"HandoverCardRevealVerifyResponse":{"type":"object","properties":{"status":{"type":"string","enum":["revealed"]},"card":{"type":"object","properties":{"number":{"type":"string"},"cvv":{"type":"string","nullable":true},"expiration_month":{"type":"string","nullable":true},"expiration_year":{"type":"string","nullable":true},"cardholder_name":{"type":"string","nullable":true}},"required":["number","cvv","expiration_month","expiration_year","cardholder_name"]}},"required":["status","card"]},"HandoverCardRevealVerifyBody":{"type":"object","properties":{"otp":{"type":"string","minLength":4,"maxLength":12}},"required":["otp"]},"SecretFootprint":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.memory-footprint/v3"]},"taskId":{"type":"string","nullable":true,"format":"uuid"},"footprintRevision":{"type":"string","minLength":1},"pagination":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"totalSecrets":{"type":"integer","minimum":0},"totalEntities":{"type":"integer","minimum":0},"returnedSecrets":{"type":"integer","minimum":0},"descriptionMaxChars":{"type":"integer","minimum":0,"exclusiveMinimum":true},"descriptionsTruncated":{"type":"boolean"},"detailsRequiredSecretIds":{"type":"array","items":{"type":"string"}}},"required":["nextCursor","totalSecrets","totalEntities","returnedSecrets","descriptionMaxChars","descriptionsTruncated","detailsRequiredSecretIds"],"additionalProperties":false},"entities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["person","organization"]},"label":{"type":"string"},"description":{"type":"string"},"isDefault":{"type":"boolean"},"secrets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"revision":{"type":"string"},"type":{"type":"string"},"templateKey":{"type":"string"},"templateVersion":{"type":"number"},"label":{"type":"string"},"description":{"type":"string"},"cardSummary":{"type":"object","properties":{"brand":{"type":"string","enum":["visa","mastercard","amex","discover","jcb","unionpay","diners","maestro"]},"last4":{"type":"string","pattern":"^\\d{4}$"},"expiryMonth":{"type":"string","pattern":"^(0[1-9]|1[0-2])$"},"expiryYear":{"type":"string","pattern":"^\\d{4}$"},"state":{"type":"string","enum":["complete","incomplete","expired"]}},"required":["state"]},"resource":{"type":"object","properties":{"kind":{"type":"string","enum":["site","service"]},"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}},"required":["kind","key","label"],"additionalProperties":false},"fields":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"valueType":{"type":"string"},"availability":{"type":"string"},"sensitivity":{"type":"string","enum":["ordinary","protected","provider_managed"]}},"required":["id","key","label","valueType","availability","sensitivity"],"additionalProperties":false}},"reuseRequirement":{"type":"string","enum":["automatic_eligible","approval_required","unavailable"]}},"required":["id","revision","type","templateKey","templateVersion","label","description","fields","reuseRequirement"],"additionalProperties":false}}},"required":["id","type","label","description","isDefault","secrets"],"additionalProperties":false}}},"required":["contract","taskId","footprintRevision","entities"],"additionalProperties":false},"Secret":{"type":"object","properties":{"id":{"type":"string"},"entityId":{"type":"string"},"revision":{"type":"string"},"type":{"type":"string"},"templateKey":{"type":"string"},"templateVersion":{"type":"number"},"label":{"type":"string"},"description":{"type":"string"},"cardSummary":{"type":"object","properties":{"brand":{"type":"string","enum":["visa","mastercard","amex","discover","jcb","unionpay","diners","maestro"]},"last4":{"type":"string","pattern":"^\\d{4}$"},"expiryMonth":{"type":"string","pattern":"^(0[1-9]|1[0-2])$"},"expiryYear":{"type":"string","pattern":"^\\d{4}$"},"state":{"type":"string","enum":["complete","incomplete","expired"]}},"required":["state"]},"resource":{"type":"object","properties":{"kind":{"type":"string","enum":["site","service"]},"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}},"required":["kind","key","label"],"additionalProperties":false},"fields":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"valueType":{"type":"string"},"availability":{"type":"string"},"sensitivity":{"type":"string","enum":["ordinary","protected","provider_managed"]}},"required":["id","key","label","valueType","availability","sensitivity"],"additionalProperties":false}},"reuseRequirement":{"type":"string","enum":["automatic_eligible","approval_required","unavailable"]},"status":{"type":"string","enum":["active","archived","deleted"]},"readOnly":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","entityId","revision","type","templateKey","templateVersion","label","description","fields","reuseRequirement","status","readOnly","createdAt","updatedAt"],"additionalProperties":false},"SecretReviewSummary":{"type":"object","properties":{"id":{"type":"string"},"classificationRequired":{"type":"boolean","enum":[true]},"revision":{"type":"string","minLength":1},"label":{"type":"string"},"status":{"type":"string","enum":["active","archived","pending","revoked","deleted"]},"readOnly":{"type":"boolean"},"readOnlyReason":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"valueType":{"type":"string","nullable":true},"availability":{"type":"string"},"sensitivity":{"type":"string","enum":["ordinary","protected","provider_managed"]}},"required":["id","key","label","valueType","availability","sensitivity"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","classificationRequired","revision","label","status","readOnly","fields","createdAt","updatedAt"],"additionalProperties":false},"SecretFieldInput":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string"},"isSecret":{"type":"boolean"},"valueType":{"type":"string"},"phoneParts":{"type":"object","properties":{"fullPhone":{"type":"string","maxLength":32},"countryCode":{"type":"string","maxLength":5},"phone":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2}},"required":["fullPhone","countryCode","phone"],"additionalProperties":false},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"nullable":true}]}},"required":["key"],"additionalProperties":false},"CreateSecretBody":{"type":"object","properties":{"entityId":{"type":"string","format":"uuid"},"templateKey":{"type":"string","minLength":1},"templateVersion":{"type":"integer","minimum":0,"exclusiveMinimum":true},"expectedRevision":{"type":"string","minLength":1},"label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"resource":{"type":"object","nullable":true,"properties":{"kind":{"type":"string","enum":["site","service"]},"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}},"required":["kind","key","label"],"additionalProperties":false},"askBeforeUse":{"type":"boolean"},"status":{"type":"string","enum":["active","archived"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/SecretFieldInput"},"maxItems":64}},"required":["entityId"],"additionalProperties":false},"SecretEntity":{"type":"object","properties":{"id":{"type":"string"},"ownerUserId":{"type":"string"},"type":{"type":"string","enum":["person","organization"]},"displayName":{"type":"string"},"description":{"type":"string"},"isDefault":{"type":"boolean"},"status":{"type":"string","enum":["active","archived","deleted"]},"contentRevision":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerUserId","type","displayName","description","isDefault","status","contentRevision","createdAt","updatedAt"]},"SecretCatalogResponse":{"type":"object","properties":{"valueVisibility":{"type":"string","enum":["handles_only"]},"catalogSource":{"type":"string","enum":["secrets"]},"taskId":{"type":"string"},"url":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"capabilityProtocolVersion":{"type":"number"},"catalogSchemaVersion":{"type":"number"},"negotiatedValueTypes":{"type":"array","items":{"type":"string","enum":["date","phone_number","person_name","country","payment_card_number","payment_card_expiry","payment_card_cvv"]}},"rankingOrder":{"type":"array","items":{"type":"string"}},"secrets":{"type":"array","items":{"$ref":"#/components/schemas/SecretCatalogEntry"}},"candidates":{"type":"array","items":{"$ref":"#/components/schemas/SecretCatalogEntry"}},"missing":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"conflicts":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"unavailable":{"type":"array","items":{"type":"object","properties":{"availability":{"$ref":"#/components/schemas/SecretAvailabilityState"}},"required":["availability"],"additionalProperties":{"nullable":true}}},"availability":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SecretAvailabilityState"}},"policies":{"type":"object","additionalProperties":{"nullable":true}}},"required":["valueVisibility","catalogSource","taskId","url","purpose","capabilityProtocolVersion","catalogSchemaVersion","negotiatedValueTypes","rankingOrder","secrets","candidates","missing","conflicts","unavailable","availability","policies"],"additionalProperties":false},"SecretCatalogEntry":{"type":"object","properties":{"revision":{"type":"string","minLength":1}},"additionalProperties":{"nullable":true}},"SecretAvailabilityState":{"type":"object","properties":{"status":{"type":"string","enum":["ready","missing","conflict","provider_unavailable","provider_needs_reauth","not_materializable","authorization_required"]},"reason":{"type":"string"},"reservationExpiresAt":{"type":"string","format":"date-time"},"category":{"type":"string"}},"additionalProperties":{"nullable":true}},"SecretMaterializationBody":{"type":"object","properties":{"handles":{"type":"array","items":{"anyOf":[{"type":"string","minLength":1},{"type":"object","properties":{"handle":{"type":"string","minLength":1},"contentRevision":{"type":"string","minLength":1}},"required":["handle"],"additionalProperties":false}]},"minItems":1,"maxItems":64},"context":{"type":"object","additionalProperties":{"nullable":true}},"url":{"type":"string"},"purpose":{"type":"string"},"pageTitle":{"type":"string"}},"required":["handles"],"additionalProperties":false},"TrustRuleList":{"type":"object","properties":{"rules":{"type":"array","items":{"$ref":"#/components/schemas/TrustRule"}}},"required":["rules"]},"TrustRule":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"agent_id":{"type":"string","nullable":true,"format":"uuid"},"scope":{"$ref":"#/components/schemas/TrustScope"},"rule":{"$ref":"#/components/schemas/TrustRuleMode"},"status":{"type":"string","enum":["active","paused"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","user_id","agent_id","scope","rule","status","created_at","updated_at"]},"TrustScope":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["category"]},"category":{"type":"string","minLength":1},"site":{"type":"string","minLength":1}},"required":["type","category"]},{"type":"object","properties":{"type":{"type":"string","enum":["capability"]},"capability":{"type":"string","minLength":1},"site":{"type":"string","minLength":1}},"required":["type","capability"]},{"type":"object","properties":{"type":{"type":"string","enum":["site"]},"site":{"type":"string","minLength":1}},"required":["type","site"]}]},"TrustRuleMode":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["auto"]}},"required":["mode"]},{"type":"object","properties":{"mode":{"type":"string","enum":["confirm"]}},"required":["mode"]},{"type":"object","properties":{"mode":{"type":"string","enum":["auto_with_limit"]},"limit":{"type":"number","minimum":0},"currency":{"type":"string","minLength":1},"period":{"type":"string","enum":["hour","day","week","month","total"]}},"required":["mode","limit","currency","period"]}]},"CreateTrustRuleBody":{"type":"object","properties":{"agent_id":{"type":"string","nullable":true,"format":"uuid"},"scope":{"$ref":"#/components/schemas/TrustScope"},"rule":{"$ref":"#/components/schemas/TrustRuleMode"},"status":{"type":"string","enum":["active","paused"]}},"required":["scope","rule"]},"PatchTrustRuleBody":{"type":"object","properties":{"agent_id":{"type":"string","nullable":true,"format":"uuid"},"scope":{"$ref":"#/components/schemas/TrustScope"},"rule":{"$ref":"#/components/schemas/TrustRuleMode"},"status":{"type":"string","enum":["active","paused"]}}},"TelemetryTraceIngestResponse":{"type":"object","properties":{"accepted":{"type":"boolean","description":"True when the payload passed validation and was accepted for ingest.","example":true},"forwarded":{"type":"boolean","description":"True when the payload was forwarded to the configured OTLP sink.","example":true},"duplicate":{"type":"boolean","description":"Present when ingest recognized a duplicate payload and skipped a second forward.","example":false}},"required":["accepted","forwarded"],"description":"Accepted observability ingest result."},"TelemetryTraceIngestError":{"type":"object","properties":{"error":{"type":"string","description":"Stable machine-readable ingest error code.","example":"invalid_otlp_payload"},"message":{"type":"string","description":"Human-readable explanation of why ingest failed.","example":"Telemetry ingest expects a non-empty OTLP/HTTP JSON traces payload."},"upstreamStatus":{"type":"integer","description":"Status returned by the downstream OTLP sink when forward failed.","example":503}},"required":["error","message"],"description":"Observability ingest error envelope."},"TelemetryTraceIngestBody":{"type":"object","properties":{"resourceSpans":{"type":"array","items":{"type":"object","properties":{"scopeSpans":{"type":"array","items":{"type":"object","properties":{"spans":{"type":"array","items":{"nullable":true},"minItems":1,"description":"Non-empty OTLP span batch for one instrumentation scope."}},"required":["spans"],"additionalProperties":{"nullable":true}},"minItems":1,"description":"One or more scope span batches grouped under one OTLP resource."}},"required":["scopeSpans"],"additionalProperties":{"nullable":true}},"minItems":1,"description":"Non-empty OTLP/HTTP JSON traces payload."}},"required":["resourceSpans"],"additionalProperties":{"nullable":true},"description":"OTLP/HTTP JSON traces payload accepted by the observability ingest route. Additional OTLP fields are preserved and forwarded unchanged.","example":{"resourceSpans":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"aftercard-agent"}}]},"scopeSpans":[{"scope":{"name":"aftercard.local-run-store"},"spans":[{"traceId":"11111111111111111111111111111111","spanId":"2222222222222222","name":"aftercard.start-session"}]}]}]}},"NotificationPreferencesResponse":{"type":"array","items":{"$ref":"#/components/schemas/NotificationPreference"},"description":"List of notification preferences for all notification types."},"NotificationPreference":{"type":"object","properties":{"eventKey":{"type":"string","enum":["payment_approval_required","payment_auto_approved","payment_failed","agent_action_required","agent_choice_required","aftercard_topup_settled","aftercard_crypto_transfer_settled","aftercard_x402_purchase_settled","aftercard_card_payment_settled","payment_completed","subscription_renewal_upcoming","subscription_cancellation_update","high_risk_transaction","balance_low","agent_status_changed","api_key_created","api_key_revoked"],"example":"aftercard_topup_settled"},"type":{"type":"string","enum":["transaction_alert","balance_alert","agent_status","security"],"example":"transaction_alert"},"pushEnabled":{"type":"boolean","example":true},"emailEnabled":{"type":"boolean","example":true},"telegramEnabled":{"type":"boolean","example":false},"source":{"type":"string","enum":["event","category","default"]},"availability":{"type":"object","properties":{"push":{"type":"object","properties":{"available":{"type":"boolean"},"reason":{"type":"string","enum":["verified_email_missing","telegram_not_linked","provider_not_configured"]}},"required":["available"]},"email":{"type":"object","properties":{"available":{"type":"boolean"},"reason":{"type":"string","enum":["verified_email_missing","telegram_not_linked","provider_not_configured"]}},"required":["available"]},"telegram":{"type":"object","properties":{"available":{"type":"boolean"},"reason":{"type":"string","enum":["verified_email_missing","telegram_not_linked","provider_not_configured"]}},"required":["available"]}},"required":["push","email","telegram"]}},"required":["eventKey","type","pushEnabled","emailEnabled","telegramEnabled","source","availability"]},"UpdateNotificationPreferenceResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true],"example":true}},"required":["ok"]},"UpdateNotificationPreferenceBody":{"type":"object","properties":{"eventKey":{"type":"string","enum":["payment_approval_required","payment_auto_approved","payment_failed","agent_action_required","agent_choice_required","aftercard_topup_settled","aftercard_crypto_transfer_settled","aftercard_x402_purchase_settled","aftercard_card_payment_settled","payment_completed","subscription_renewal_upcoming","subscription_cancellation_update","high_risk_transaction","balance_low","agent_status_changed","api_key_created","api_key_revoked"],"description":"The stable notification event to update.","example":"aftercard_topup_settled"},"channel":{"type":"string","enum":["push","email","telegram"],"description":"The delivery channel to toggle.","example":"telegram"},"enabled":{"type":"boolean","description":"Whether the channel should be enabled for this notification type.","example":true}},"required":["eventKey","channel","enabled"],"additionalProperties":false},"HostedLinkCreateResponse":{"type":"object","properties":{"hostedUrl":{"type":"string","format":"uri"},"link":{"$ref":"#/components/schemas/HostedActionLink"},"routing":{"$ref":"#/components/schemas/HostedLinkRouting"}},"required":["hostedUrl","link","routing"]},"HostedActionLink":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"anyOf":[{"type":"string","enum":["request_review","approve_payment","top_up","kyc","card_issue"]},{"type":"string","enum":["wallet_approval"]}]},"status":{"type":"string","enum":["active","expired","revoked","completed"]},"taskId":{"type":"string","nullable":true,"format":"uuid"},"requestId":{"type":"string","nullable":true,"format":"uuid"},"path":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","kind","status","taskId","requestId","path","expiresAt"]},"HostedLinkRouting":{"type":"object","properties":{"preferredSurface":{"type":"string","enum":["auto","web","mobile","miniapp","mcp"]},"recommendedSurface":{"type":"string","enum":["web","mobile","miniapp","mcp"]},"surfaces":{"type":"array","items":{"type":"string","enum":["web","mobile","miniapp","mcp"]}},"path":{"type":"string"},"webUrl":{"type":"string","nullable":true,"format":"uri"},"mobileDeepLink":{"type":"string","nullable":true,"format":"uri"},"miniappUrl":{"type":"string","nullable":true,"format":"uri"}},"required":["preferredSurface","recommendedSurface","surfaces","path","webUrl","mobileDeepLink","miniappUrl"]},"HostedLinkCreateBody":{"type":"object","properties":{"clientLinkId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["request_review","approve_payment","top_up","kyc","card_issue"],"default":"request_review"},"ttlMs":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":86400000},"path":{"type":"string","maxLength":2000,"pattern":"^\\/(?!\\/)"},"preferredSurface":{"type":"string","enum":["auto","web","mobile","miniapp","mcp"],"default":"auto"},"surfaces":{"type":"array","items":{"type":"string","enum":["web","mobile","miniapp","mcp"]},"minItems":1,"maxItems":4},"metadata":{"type":"object","additionalProperties":{"nullable":true},"default":{}}},"additionalProperties":false},"HostedLinkExchangeResponse":{"type":"object","properties":{"link":{"$ref":"#/components/schemas/HostedActionLink"},"routing":{"$ref":"#/components/schemas/HostedLinkRouting"},"auth":{"$ref":"#/components/schemas/HostedLinkAuth"}},"required":["link","routing","auth"]},"HostedLinkAuth":{"type":"object","properties":{"session_required":{"type":"boolean"},"token_hash":{"type":"string"},"verification_type":{"type":"string","enum":["signup","magiclink"]}},"required":["session_required"]},"HostedLinkExchangeBody":{"type":"object","properties":{"code":{"type":"string","minLength":10,"maxLength":500}},"required":["code"],"additionalProperties":false},"SubscriptionEnvelope":{"type":"object","properties":{"subscription":{"$ref":"#/components/schemas/ManagedSubscription"}},"required":["subscription"],"additionalProperties":false},"ManagedSubscription":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"approvalBound":{"type":"boolean"},"approvedTermsEvidence":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionEvidenceItem"}},"billingInterval":{"type":"object","nullable":true,"properties":{"unit":{"type":"string","enum":["day","week","month","year"]},"count":{"type":"integer","minimum":1,"maximum":1200}},"required":["unit","count"],"additionalProperties":false},"agentId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"serviceName":{"type":"string","minLength":1,"pattern":"\\S"},"serviceUrl":{"type":"string","nullable":true,"minLength":1},"providerName":{"type":"string","nullable":true,"minLength":1},"status":{"$ref":"#/components/schemas/SubscriptionLifecycleStatus"},"recurringObligation":{"$ref":"#/components/schemas/SubscriptionRecurringObligation"},"planLabel":{"type":"string","nullable":true,"minLength":1},"billingTerms":{"type":"array","items":{"type":"string","minLength":1,"maxLength":4000},"maxItems":50,"default":[]},"recurringAmountMajor":{"type":"number","nullable":true,"minimum":0},"recurringCurrency":{"type":"string","nullable":true,"minLength":1},"recurringAmountKind":{"type":"string","nullable":true,"enum":["fixed","variable","unknown",null],"default":null},"monthlyAmountMajor":{"type":"number","nullable":true,"minimum":0,"default":null},"serviceLogoUrl":{"type":"string","nullable":true,"default":null},"nextRenewalAt":{"type":"string","nullable":true,"format":"date-time"},"expiresAt":{"type":"string","nullable":true,"format":"date-time"},"autoRenews":{"type":"boolean"},"cancellationDetails":{"type":"object","nullable":true,"properties":{"url":{"type":"string"},"hint":{"type":"string"},"progress":{"type":"string","enum":["pending","cancelled","already_cancelled","needs_user","unsuccessful","awaiting_provider","reply_received"]},"note":{"type":"string"},"evidence":{"type":"string","maxLength":4000},"observedAt":{"type":"string","format":"date-time"},"sourceUrl":{"type":"string","maxLength":2000,"format":"uri"},"nextAction":{"type":"string","maxLength":1000},"nextCheckAt":{"type":"string","nullable":true,"format":"date-time"},"supportContact":{"type":"string","maxLength":500},"supportDraft":{"type":"string","maxLength":4000},"supportSendId":{"type":"string","nullable":true,"format":"uuid"},"supportMessageId":{"type":"string","nullable":true,"format":"uuid"},"revision":{"type":"integer"},"updatedAt":{"type":"string"},"startedAt":{"type":"string"},"renewalUnconfirmed":{"type":"boolean"},"followUpStopped":{"type":"boolean"}}},"estimatedRenewalUsdMajor":{"type":"number","nullable":true,"minimum":0},"trialEndAt":{"type":"string","nullable":true,"format":"date-time"},"lastPaymentAt":{"type":"string","nullable":true,"format":"date-time"},"paidSummary":{"type":"object","nullable":true,"properties":{"amount":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$/u"},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"},"paymentCount":{"type":"integer","minimum":0,"exclusiveMinimum":true},"coverage":{"type":"string","enum":["known_payments"]}},"required":["amount","currency","paymentCount","coverage"]},"deleted":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","nullable":true,"format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"flags":{"type":"array","items":{"type":"string","minLength":1,"pattern":"\\S"}},"derivedStates":{"type":"array","items":{"type":"string","minLength":1,"pattern":"\\S"}},"approvedTermsHash":{"$ref":"#/components/schemas/ManagedSubscriptionTermsHash"},"approvedTermsSnapshot":{"$ref":"#/components/schemas/ObservedTermsSnapshot"},"extractorVersion":{"type":"string","nullable":true,"minLength":1},"normalizerVersion":{"type":"string","nullable":true,"minLength":1},"sourceRequestId":{"type":"string","nullable":true,"format":"uuid"},"sourceTaskId":{"type":"string","nullable":true,"format":"uuid"},"sourceOperationId":{"type":"string","nullable":true,"pattern":"^mpo_[0-9a-f]{64}$"},"sourceApprovalDecisionId":{"type":"string","nullable":true,"format":"uuid"},"managementCapabilities":{"$ref":"#/components/schemas/SubscriptionManagementCapabilities"},"agents":{"$ref":"#/components/schemas/SubscriptionAgent"}},"required":["id","approvalBound","approvedTermsEvidence","billingInterval","agentId","userId","serviceName","serviceUrl","providerName","status","recurringObligation","planLabel","recurringAmountMajor","recurringCurrency","nextRenewalAt","expiresAt","autoRenews","cancellationDetails","estimatedRenewalUsdMajor","trialEndAt","lastPaymentAt","paidSummary","deleted","createdAt","updatedAt","metadata","flags","derivedStates","approvedTermsHash","approvedTermsSnapshot","extractorVersion","normalizerVersion","sourceRequestId","sourceTaskId","sourceOperationId","sourceApprovalDecisionId","managementCapabilities"],"additionalProperties":false},"SubscriptionEvidenceItem":{"type":"object","properties":{"snippet":{"type":"string","minLength":1,"pattern":"\\S"},"source":{"type":"string","minLength":1,"pattern":"\\S"},"polarity":{"$ref":"#/components/schemas/SubscriptionEvidencePolarity"},"normalized_meaning":{"type":"string","minLength":1,"pattern":"\\S"},"proximity":{"type":"string","nullable":true,"minLength":1,"pattern":"\\S"}},"required":["snippet","source","polarity","normalized_meaning","proximity"],"additionalProperties":false},"SubscriptionEvidencePolarity":{"type":"string","enum":["positive","negative","neutral"]},"SubscriptionLifecycleStatus":{"type":"string","enum":["active","pending_activation","needs_review","paused","pending_cancellation","cancelled"]},"SubscriptionRecurringObligation":{"type":"string","enum":["none","confirmed","possible"]},"ManagedSubscriptionTermsHash":{"type":"string","nullable":true,"minLength":1,"pattern":"\\S","description":"Versioned hash of the normalized observed subscription terms.","example":"subscription_terms_v1_8b0f0a2c"},"ObservedTermsSnapshot":{"type":"object","nullable":true,"properties":{"detected_at_phase":{"$ref":"#/components/schemas/SubscriptionDetectedAtPhase"},"recurring_obligation":{"$ref":"#/components/schemas/SubscriptionRecurringObligation"},"billing_shape":{"$ref":"#/components/schemas/SubscriptionBillingShape"},"first_charge":{"$ref":"#/components/schemas/SubscriptionMoneyTermsField"},"recurring_charge":{"$ref":"#/components/schemas/SubscriptionMoneyTermsField"},"interval":{"$ref":"#/components/schemas/SubscriptionStringTermsField"},"trial_end":{"$ref":"#/components/schemas/SubscriptionStringTermsField"},"introductory_period":{"$ref":"#/components/schemas/SubscriptionIntroductoryPeriodTermsField"},"display_price":{"$ref":"#/components/schemas/SubscriptionStringTermsField"},"language_or_locale":{"type":"string","minLength":1,"pattern":"\\S"},"terms_completeness":{"$ref":"#/components/schemas/SubscriptionTermsCompleteness"},"evidence_sufficiency":{"$ref":"#/components/schemas/SubscriptionEvidenceSufficiency"},"context_coverage":{"$ref":"#/components/schemas/SubscriptionContextCoverage"},"missing_fields":{"type":"array","items":{"type":"string","minLength":1,"pattern":"\\S"}},"evidence":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionEvidenceItem"}},"terms_hash":{"$ref":"#/components/schemas/SubscriptionTermsHash"},"extractor_version":{"type":"string","nullable":true,"minLength":1,"pattern":"\\S"},"normalizer_version":{"type":"string","nullable":true,"minLength":1,"pattern":"\\S"}},"required":["detected_at_phase","recurring_obligation","billing_shape","first_charge","recurring_charge","interval","trial_end","display_price","language_or_locale","terms_completeness","evidence_sufficiency","context_coverage","missing_fields","evidence","terms_hash","extractor_version","normalizer_version"],"additionalProperties":false},"SubscriptionDetectedAtPhase":{"type":"string","enum":["pre_fill","pre_submit"]},"SubscriptionBillingShape":{"type":"object","properties":{"summary_label":{"type":"string","nullable":true,"minLength":1,"pattern":"\\S"},"attributes":{"type":"array","items":{"type":"string","minLength":1,"pattern":"\\S"}},"raw_terms":{"type":"array","items":{"type":"string","minLength":1,"pattern":"\\S"}},"unmodeled_terms":{"type":"array","items":{"type":"string","minLength":1,"pattern":"\\S"}}},"required":["summary_label","attributes","raw_terms","unmodeled_terms"],"additionalProperties":false},"SubscriptionMoneyTermsField":{"oneOf":[{"type":"object","properties":{"state":{"type":"string","enum":["known"]},"value":{"$ref":"#/components/schemas/SubscriptionMoneyAmount"}},"required":["state","value"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["unknown"]}},"required":["state"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["not_applicable"]}},"required":["state"],"additionalProperties":false}]},"SubscriptionMoneyAmount":{"type":"object","properties":{"amount":{"type":"number","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["amount","currency"],"additionalProperties":false},"SubscriptionStringTermsField":{"oneOf":[{"type":"object","properties":{"state":{"type":"string","enum":["known"]},"value":{"type":"string","minLength":1,"pattern":"\\S"}},"required":["state","value"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["unknown"]}},"required":["state"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["not_applicable"]}},"required":["state"],"additionalProperties":false}]},"SubscriptionIntroductoryPeriodTermsField":{"oneOf":[{"type":"object","properties":{"state":{"type":"string","enum":["known"]},"value":{"type":"object","properties":{"count":{"type":"integer","minimum":1,"maximum":1200},"unit":{"type":"string","enum":["day","week","month","year"]}},"required":["count","unit"],"additionalProperties":false}},"required":["state","value"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["unknown"]}},"required":["state"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["not_applicable"]}},"required":["state"],"additionalProperties":false}]},"SubscriptionTermsCompleteness":{"type":"string","enum":["complete","partial"]},"SubscriptionEvidenceSufficiency":{"type":"string","enum":["sufficient","insufficient"]},"SubscriptionContextCoverage":{"type":"string","enum":["sufficient","insufficient"]},"SubscriptionTermsHash":{"type":"string","minLength":1,"pattern":"\\S","description":"Versioned hash of the normalized observed subscription terms.","example":"subscription_terms_v1_8b0f0a2c"},"SubscriptionManagementCapabilities":{"type":"object","properties":{"canCancel":{"type":"boolean"},"canPause":{"type":"boolean"},"canResume":{"type":"boolean"},"reason":{"type":"string","nullable":true,"minLength":1}},"required":["canCancel","canPause","canResume","reason"],"additionalProperties":false},"SubscriptionAgent":{"type":"object","nullable":true,"properties":{"name":{"type":"string","minLength":1,"pattern":"\\S"}},"required":["name"],"additionalProperties":false},"SubscriptionListResponse":{"type":"object","properties":{"subscriptions":{"type":"array","items":{"$ref":"#/components/schemas/ManagedSubscription"}}},"required":["subscriptions"],"additionalProperties":false},"SetupStartResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"challenge":{"type":"string"},"code_length":{"type":"integer","minimum":0,"exclusiveMinimum":true},"email_masked":{"type":"string"},"delivery":{"type":"object","properties":{"method":{"type":"string","enum":["wildcard","resend"]},"sent":{"type":"boolean"}},"required":["method","sent"]}},"required":["success","challenge","code_length","email_masked","delivery"]},"SetupStartBody":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email"},"platform":{"type":"string","enum":["openclaw","hermes","claude","codex","manus","generic"],"default":"generic"},"agent_name":{"type":"string","minLength":1,"maxLength":120}},"required":["email"],"additionalProperties":false},"SetupVerifyResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"account":{"type":"object","properties":{"status":{"type":"string","enum":["created","existing"]}},"required":["status"]},"agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","nullable":true,"format":"email"},"email_provider":{"type":"string","nullable":true,"enum":["resend"]},"platform":{"type":"string","nullable":true},"status":{"type":"string","nullable":true}},"required":["id","name","email","email_provider","platform","status"]},"api_key":{"type":"string"},"prefix":{"type":"string"},"gateway":{"type":"object","properties":{"api_url":{"type":"string","format":"uri"}},"required":["api_url"]}},"required":["success","account","agent","api_key","prefix","gateway"]},"SetupVerifyBody":{"type":"object","properties":{"challenge":{"type":"string","minLength":16,"maxLength":5000},"otp":{"type":"string","minLength":4,"maxLength":10},"platform":{"type":"string","enum":["openclaw","hermes","claude","codex","manus","generic"],"default":"generic"},"agent_name":{"type":"string","minLength":1,"maxLength":120}},"required":["challenge","otp"],"additionalProperties":false},"DashboardOverview":{"type":"object","properties":{"active_agents":{"type":"integer","nullable":true,"minimum":0},"active_subscriptions":{"type":"integer","nullable":true,"minimum":0},"threats_blocked_month":{"type":"integer","nullable":true,"minimum":0},"total_spent_month":{"type":"number","nullable":true},"total_spent_last_month":{"type":"number","nullable":true},"balance":{"type":"number","nullable":true},"settled_balance":{"type":"number","nullable":true},"reserved_balance":{"type":"number","nullable":true},"display_currency":{"type":"string","enum":["USD"]},"asset_balances":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","minLength":1},"network":{"type":"string","minLength":1},"scale":{"type":"integer","minimum":0,"maximum":18},"posted":{"type":"string","pattern":"^-?[0-9]+$/u"},"reserved":{"type":"string","pattern":"^-?[0-9]+$/u"},"available":{"type":"string","pattern":"^-?[0-9]+$/u"}},"required":["asset","network","scale","posted","reserved","available"]}},"spend_by_category":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","minLength":1},"total":{"type":"number","nullable":true}},"required":["category","total"]}},"spend_by_agent":{"type":"array","items":{"type":"object","properties":{"agent_id":{"type":"string","nullable":true,"minLength":1},"agent_name":{"type":"string","minLength":1},"total_spend":{"type":"number","nullable":true}},"required":["agent_id","agent_name","total_spend"]}},"agent_stats":{"type":"array","items":{"type":"object","properties":{"agent_id":{"type":"string","minLength":1},"monthly_spend":{"type":"number","nullable":true},"spend_by_category":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","minLength":1},"total":{"type":"number","nullable":true}},"required":["category","total"]}},"payment_operation_count_month":{"type":"integer","nullable":true,"minimum":0},"active_subscriptions":{"type":"integer","nullable":true,"minimum":0}},"required":["agent_id","monthly_spend","spend_by_category","payment_operation_count_month","active_subscriptions"]}}},"required":["active_agents","active_subscriptions","threats_blocked_month","total_spent_month","total_spent_last_month","balance","settled_balance","reserved_balance","display_currency","asset_balances","spend_by_category","spend_by_agent","agent_stats"]}},"parameters":{}},"servers":[{"url":"/functions/v1"}],"tags":[{"name":"Core","description":"Start here: health checks and metadata for the agent linked to your API key."},{"name":"Directory","description":"Open, key-less seller directory: natural-language search, the full list with filters, and the advisory trust record behind every verdict."},{"name":"Tasks","description":"Run browser-backed workflows: start a task, send progress updates, create or review requests, claim one-time artifacts, and finish the run."},{"name":"LLM","description":"OpenAI-compatible chat completions subset backed by the Nuncio LLM gateway."},{"name":"Observability","description":"Ingest OTLP traces for workflow observability without mixing raw telemetry into product session routes."},{"name":"Tools","description":"Call backend services such as CAPTCHA solving."},{"name":"Account","description":"Read-only MagicCard account state for the agent linked to the API key, including balance, cards, and recent transactions."},{"name":"Activity"},{"name":"Agent email"},{"name":"Payment Quotes"},{"name":"Payment Runs"},{"name":"Protected Execution"},{"name":"Setup","description":"Public OTP-backed setup flow for agent-driven Nuncio onboarding."},{"name":"Subscriptions","description":"Read-only managed subscription records with lifecycle, source links, evidence, hashes, and backend capability flags."}],"paths":{"/api/health":{"get":{"operationId":"getHealth","tags":["Core"],"summary":"Check API health","description":"Unauthenticated health check for uptime probes and deployment verification.","responses":{"200":{"description":"API is reachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/payment-balances":{"get":{"operationId":"getPaymentBalances","tags":[],"summary":"Get an exact asset balance or the total Nuncio Ledger valuation","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":128},"required":false,"name":"asset_namespace","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":128},"required":false,"name":"asset_id","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":128},"required":false,"name":"network","in":"query"}],"responses":{"200":{"description":"Exact asset balance when a full tuple is supplied; total valuation otherwise","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.balance/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"posted":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"},"reserved":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"},"available":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["contract","schemaVersion","asset","posted","reserved","available"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.total-balance/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"authority":{"type":"string","enum":["derived_non_authoritative","authoritative_unified"]},"presentation":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":80},"assetId":{"type":"string","minLength":1,"maxLength":80},"scale":{"type":"integer","minimum":0,"maximum":18}},"required":["namespace","assetId","scale"],"additionalProperties":false},"policy":{"type":"object","properties":{"version":{"type":"string","minLength":1,"maxLength":200},"digest":{"type":"string","minLength":1,"maxLength":200}},"required":["version"],"additionalProperties":false},"sources":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"scale":{"type":"integer","minimum":0,"maximum":18},"disposition":{"type":"string","enum":["included","excluded_not_subject","blocked_subject","blocked_input"]},"posted":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"reserved":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"available":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"rate":{"type":"object","nullable":true,"properties":{"numerator":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false},"converted":{"type":"object","properties":{"posted":{"type":"object","properties":{"numerator":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false},"reserved":{"type":"object","properties":{"numerator":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false},"available":{"type":"object","properties":{"numerator":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false}},"required":["posted","reserved","available"],"additionalProperties":false}},"required":["asset","scale","disposition","rate"],"additionalProperties":false},"minItems":1,"maxItems":16},"resultDigest":{"type":"string","minLength":1,"maxLength":200},"outcome":{"type":"string","enum":["available"]},"posted":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"reserved":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"available":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"snapshot":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":200},"revision":{"type":"string","minLength":1,"maxLength":200},"asOfBookSequence":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["bookId","revision","asOfBookSequence"],"additionalProperties":false}},"required":["contract","schemaVersion","authority","presentation","policy","sources","resultDigest","outcome","posted","reserved","available","snapshot"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.total-balance/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"authority":{"type":"string","enum":["derived_non_authoritative","authoritative_unified"]},"presentation":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":80},"assetId":{"type":"string","minLength":1,"maxLength":80},"scale":{"type":"integer","minimum":0,"maximum":18}},"required":["namespace","assetId","scale"],"additionalProperties":false},"policy":{"type":"object","properties":{"version":{"type":"string","minLength":1,"maxLength":200},"digest":{"type":"string","minLength":1,"maxLength":200}},"required":["version"],"additionalProperties":false},"sources":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"scale":{"type":"integer","minimum":0,"maximum":18},"disposition":{"type":"string","enum":["included","excluded_not_subject","blocked_subject","blocked_input"]},"posted":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"reserved":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"available":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"rate":{"type":"object","nullable":true,"properties":{"numerator":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false},"converted":{"type":"object","properties":{"posted":{"type":"object","properties":{"numerator":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false},"reserved":{"type":"object","properties":{"numerator":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false},"available":{"type":"object","properties":{"numerator":{"type":"string","pattern":"^(0|-?[1-9][0-9]*)$/u"},"denominator":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["numerator","denominator"],"additionalProperties":false}},"required":["posted","reserved","available"],"additionalProperties":false}},"required":["asset","scale","disposition","rate"],"additionalProperties":false},"minItems":1,"maxItems":16},"resultDigest":{"type":"string","minLength":1,"maxLength":200},"outcome":{"type":"string","enum":["unavailable"]},"snapshot":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":200},"revision":{"type":"string","minLength":1,"maxLength":200},"asOfBookSequence":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["bookId","revision","asOfBookSequence"],"additionalProperties":false},"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":128},"fieldPath":{"type":"string","minLength":1,"maxLength":512}},"required":["code","fieldPath"],"additionalProperties":false},"minItems":1,"maxItems":64}},"required":["contract","schemaVersion","authority","presentation","policy","sources","resultDigest","outcome","issues"],"additionalProperties":false}]}}}},"400":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/funding-methods":{"get":{"operationId":"getPaymentOperationsFundingMethods","tags":[],"summary":"List configured Nuncio direct top-up methods","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Configured direct funding methods for the authenticated Nuncio runtime","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.funding-methods/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"methods":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":128},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"assetLabel":{"type":"string","minLength":1,"maxLength":32},"network":{"type":"string","minLength":1,"maxLength":32},"networkLabel":{"type":"string","minLength":1,"maxLength":32},"scale":{"type":"integer","minimum":0,"maximum":18}},"required":["key","asset","assetLabel","network","networkLabel","scale"],"additionalProperties":false},"minItems":1,"maxItems":8}},"required":["contract","schemaVersion","methods"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/funding":{"post":{"operationId":"postPaymentOperationsFunding","tags":[],"summary":"Request a Nuncio funding address","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"idempotency_key":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"asset_id":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","asset_id","network"],"additionalProperties":false}},"required":["idempotency_key","asset"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current V1 payment operation projection","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false}}}},"400":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"409":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/{operationId}/x402-result":{"get":{"operationId":"getPaymentOperationsByOperationIdX402Result","tags":[],"summary":"Get the bounded paid x402 resource result","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"operationId","in":"path"}],"responses":{"200":{"description":"Integrity-addressed paid x402 result","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.x402-result/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"resultRef":{"type":"string","pattern":"^mpx402r_v1_[0-9a-f]{64}$/u"},"mediaType":{"type":"string","minLength":1,"maxLength":128},"encoding":{"type":"string","enum":["base64"]},"byteLength":{"type":"integer","minimum":0,"maximum":2097152},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$/u"},"body":{"type":"string","maxLength":2796204,"pattern":"^[A-Za-z0-9+/]*={0,2}$/u"},"expiresAt":{"type":"string","format":"date-time"},"responseStatus":{"type":"integer","minimum":100,"maximum":599}},"required":["contract","schemaVersion","operationId","resultRef","mediaType","encoding","byteLength","sha256","body","expiresAt"],"additionalProperties":false}}}},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/{operationId}/x402-result-details":{"get":{"operationId":"getPaymentOperationsByOperationIdX402ResultDetails","tags":[],"summary":"Get x402 settlement and fulfillment details with initial and final artifacts","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"operationId","in":"path"}],"responses":{"200":{"description":"x402 transaction details","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.x402-result-details/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"resultRef":{"type":"string","pattern":"^mpx402r_v1_[0-9a-f]{64}$/u"},"settlement":{"type":"object","properties":{"state":{"type":"string","enum":["succeeded","pending","failed","unknown"]}},"required":["state"],"additionalProperties":false},"fulfillment":{"oneOf":[{"type":"object","properties":{"state":{"type":"string","enum":["succeeded"]},"mode":{"type":"string","enum":["immediate","poll_json","blink_codes_buy_v1"]},"attempts":{"type":"integer","minimum":0}},"required":["state","mode","attempts"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["pending"]},"mode":{"type":"string","enum":["poll_json","blink_codes_buy_v1"]},"attempts":{"type":"integer","minimum":0},"maximumAttempts":{"type":"integer","minimum":1},"exhausted":{"type":"boolean"},"nextPollAt":{"type":"string","nullable":true,"format":"date-time"}},"required":["state","mode","attempts","maximumAttempts","exhausted","nextPollAt"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["failed"]},"mode":{"type":"string","enum":["immediate","poll_json","blink_codes_buy_v1"]},"attempts":{"type":"integer","minimum":0},"terminalStatus":{"type":"string","minLength":1,"maxLength":64}},"required":["state","mode","attempts","terminalStatus"],"additionalProperties":false},{"type":"object","properties":{"state":{"type":"string","enum":["unverified"]},"mode":{"type":"string","enum":["immediate","poll_json","blink_codes_buy_v1"]},"attempts":{"type":"integer","minimum":0},"terminalStatus":{"type":"string","minLength":1,"maxLength":64}},"required":["state","mode","attempts","terminalStatus"],"additionalProperties":false}]},"initialArtifact":{"type":"object","properties":{"mediaType":{"type":"string","minLength":1,"maxLength":128},"encoding":{"type":"string","enum":["base64"]},"byteLength":{"type":"integer","minimum":0,"maximum":2097152},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$/u"},"body":{"type":"string","maxLength":2796204,"pattern":"^[A-Za-z0-9+/]*={0,2}$/u"},"responseStatus":{"type":"integer","minimum":100,"maximum":599}},"required":["mediaType","encoding","byteLength","sha256","body"],"additionalProperties":false},"finalArtifact":{"type":"object","nullable":true,"properties":{"mediaType":{"type":"string","minLength":1,"maxLength":128},"encoding":{"type":"string","enum":["base64"]},"byteLength":{"type":"integer","minimum":0,"maximum":2097152},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$/u"},"body":{"type":"string","maxLength":2796204,"pattern":"^[A-Za-z0-9+/]*={0,2}$/u"},"responseStatus":{"type":"integer","minimum":100,"maximum":599}},"required":["mediaType","encoding","byteLength","sha256","body"],"additionalProperties":false},"expiresAt":{"type":"string","format":"date-time"}},"required":["contract","schemaVersion","operationId","resultRef","settlement","fulfillment","initialArtifact","finalArtifact","expiresAt"],"additionalProperties":false}}}},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/{operationId}/invoice":{"post":{"operationId":"postPaymentOperationsByOperationIdInvoice","tags":[],"summary":"Attach a PDF invoice or merchant receipt link to one exact card payment operation","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"operationId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"file":{"type":"object","properties":{"download_url":{"type":"string","maxLength":4096,"format":"uri"},"file_id":{"type":"string","minLength":1,"maxLength":512},"file_name":{"type":"string","minLength":1,"maxLength":255},"mime_type":{"type":"string","minLength":1,"maxLength":128}},"required":["download_url","file_id"],"additionalProperties":false}},"required":["file"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current V1 payment operation projection","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false}}}},"400":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"409":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}},"get":{"operationId":"getPaymentOperationsByOperationIdInvoice","tags":[],"summary":"Download the private PDF invoice for one owned payment operation","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"operationId","in":"path"},{"schema":{"type":"string","enum":["json"]},"required":false,"name":"format","in":"query"}],"responses":{"200":{"description":"Ephemeral authorized original download URL","content":{"application/json":{"schema":{"type":"object","properties":{"downloadUrl":{"type":"string","format":"uri"}},"required":["downloadUrl"]}}}},"302":{"description":"Short-lived signed invoice download"},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-invoice-documents/{documentId}/original":{"get":{"operationId":"getPaymentInvoiceDocumentsByDocumentIdOriginal","tags":[],"summary":"Download an owned invoice original independently of AI extraction","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"documentId","in":"path"},{"schema":{"type":"string","enum":["json"]},"required":false,"name":"format","in":"query"}],"responses":{"200":{"description":"Ephemeral authorized original download URL","content":{"application/json":{"schema":{"type":"object","properties":{"downloadUrl":{"type":"string","format":"uri"}},"required":["downloadUrl"]}}}},"302":{"description":"Short-lived signed invoice download"},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/{operationId}":{"get":{"operationId":"getPaymentOperationsByOperationId","tags":[],"summary":"Get one Nuncio V1 payment operation","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"operationId","in":"path"}],"responses":{"200":{"description":"Current V1 payment operation projection","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false}}}},"400":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"409":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/{operationId}/reconcile":{"post":{"operationId":"postPaymentOperationsByOperationIdReconcile","tags":[],"summary":"Reconcile one Nuncio V1 operation","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"operationId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Current V1 payment operation projection","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false}}}},"400":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"409":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/payment-operations/{operationId}/approve":{"post":{"operationId":"postPaymentOperationsByOperationIdApprove","tags":[],"summary":"Approve and resume one exact Nuncio V1 operation","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"operationId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Current V1 payment operation projection","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false}}}},"400":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"404":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"409":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"502":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}},"503":{"description":"Payment operation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["payment_operation_error"]},"code":{"type":"string","enum":["INVALID_REQUEST","UPGRADE_AFTERCARD_WORKFLOW","SPEND_LIMIT_EXCEEDED","INSUFFICIENT_UNIFIED_BALANCE","OPERATION_NOT_FOUND","IDEMPOTENCY_CONFLICT","APPROVAL_REQUIRED","APPROVAL_INVALID","OPERATION_BUSY","OPERATION_OUTCOME_UNKNOWN","RECONCILIATION_REQUIRED","LEDGER_CONSEQUENCE_PENDING","ILLEGAL_OPERATION_STATE","PAYMENT_RUNTIME_UNAVAILABLE","INVALID_OPERATION_EVIDENCE"]},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","enum":["none","complete_approval","reconcile","retry_ledger_consequence","retry_same_request","upgrade_aftercard"]},"operationCreated":{"type":"boolean"},"operationId":{"type":"string","minLength":1,"maxLength":200},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["upgrade_aftercard","reconcile_same_operation"]}},"required":["error","code","message","retryable","action"],"additionalProperties":false}}}}}}},"/api/tasks/{id}/invoices":{"get":{"operationId":"getTasksByIdInvoices","tags":["Tasks"],"summary":"Read invoice files and hosted links bound to an owned task","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stored invoice associations, independent of payment settlement","content":{"application/json":{"schema":{"type":"object","properties":{"taskId":{"type":"string","format":"uuid"},"invoices":{"type":"array","items":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"maxItems":101},"truncated":{"type":"boolean"}},"required":["taskId","invoices","truncated"],"additionalProperties":false}}}},"404":{"description":"Task unavailable"},"503":{"description":"Invoice evidence temporarily unavailable"}}}},"/api/tasks/{id}/website-media":{"post":{"operationId":"postTasksByIdWebsiteMedia","tags":["Tasks"],"summary":"Store a captured public website photo or logo","security":[{"bearerAuth":[]}],"description":"Accepts at most 5 MiB of PNG, JPEG or WebP bytes captured by the task browser. Never fetches remote URLs. Source metadata is an HTTPS origin only.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":512},"required":true,"name":"x-media-source-origin","in":"header"}],"requestBody":{"required":true,"content":{"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"Immutable image URL, including duplicate retries","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"mimeType":{"type":"string","enum":["image/png","image/jpeg","image/webp"]},"width":{"type":"integer","minimum":0,"exclusiveMinimum":true},"height":{"type":"integer","minimum":0,"exclusiveMinimum":true},"bytes":{"type":"integer","minimum":0,"exclusiveMinimum":true},"sha256":{"type":"string"},"reused":{"type":"boolean"}},"required":["url","mimeType","width","height","bytes","sha256","reused"]}}}},"400":{"description":"Invalid image or source metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Session or task scope mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"Image byte or pixel budget exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Storage temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/{agentId}/email/threads":{"get":{"tags":["Agent email"],"security":[{"bearerAuth":[]}],"operationId":"getAgentsByAgentIdEmailThreads","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"agentId","in":"path"},{"schema":{"type":"string","maxLength":2048},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Owned email threads","content":{"application/json":{"schema":{"type":"object","properties":{"threads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"subject":{"type":"string"},"updatedAt":{"type":"string"},"lastMessageAt":{"type":"string"}},"required":["id","subject","updatedAt","lastMessageAt"]}},"nextCursor":{"type":"string","nullable":true}},"required":["threads","nextCursor"]}}}}}}},"/api/agents/{agentId}/email/threads/{threadId}":{"get":{"tags":["Agent email"],"security":[{"bearerAuth":[]}],"operationId":"getAgentsByAgentIdEmailThreadsByThreadId","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"agentId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path"},{"schema":{"type":"string","maxLength":2048},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Owned email messages","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"threadId":{"type":"string","format":"uuid"},"direction":{"type":"string","enum":["inbound","outbound"]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"type":"string","nullable":true},"truncated":{"type":"boolean"},"hydrationState":{"type":"string","enum":["pending","processing","ready","unavailable"]},"createdAt":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","properties":{"documentId":{"type":"string","format":"uuid"},"filename":{"type":"string"},"byteSize":{"type":"integer"},"mediaType":{"type":"string","enum":["application/pdf"]}},"required":["documentId","filename","byteSize","mediaType"]}},"inReplyToEmailMessageId":{"type":"string","nullable":true}},"required":["id","threadId","direction","from","to","cc","bcc","subject","text","truncated","hydrationState","createdAt","attachments","inReplyToEmailMessageId"]}},"nextCursor":{"type":"string","nullable":true}},"required":["id","messages","nextCursor"]}}}}}}},"/api/agents/{agentId}/email/sends":{"post":{"tags":["Agent email"],"security":[{"bearerAuth":[]}],"operationId":"postAgentsByAgentIdEmailSends","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"agentId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"taskId":{"type":"string","format":"uuid"},"idempotencyKey":{"type":"string","minLength":1,"maxLength":128},"draft":{"type":"object","properties":{"to":{"type":"array","items":{"type":"string","maxLength":254,"format":"email"},"minItems":1,"maxItems":20},"cc":{"type":"array","items":{"type":"string","maxLength":254,"format":"email"},"maxItems":20},"bcc":{"type":"array","items":{"type":"string","maxLength":254,"format":"email"},"maxItems":20},"subject":{"type":"string","minLength":1,"maxLength":1000},"text":{"type":"string","minLength":1,"maxLength":12000},"attachmentDocumentIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":20},"replyToEmailMessageId":{"type":"string","format":"uuid"}},"required":["to","subject","text"],"additionalProperties":false}},"required":["taskId","idempotencyKey","draft"],"additionalProperties":false}}}},"responses":{"200":{"description":"Persisted exact draft and canonical approval request","content":{"application/json":{"schema":{"type":"object","properties":{"send":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"requestId":{"type":"string","nullable":true,"format":"uuid"},"threadId":{"type":"string","nullable":true,"format":"uuid"},"messageId":{"type":"string","nullable":true,"format":"uuid"},"state":{"type":"string","enum":["waiting_approval","authorized","queued","dispatching","accepted","submission_unknown","denied","expired","failed"]},"retryable":{"type":"boolean"},"nextAction":{"type":"string","enum":["wait_request","send_agent_email","get_agent_email_send","none"]},"taskId":{"type":"string","format":"uuid"},"deliveryStatus":{"type":"string","enum":["pending","delivered","delayed","bounced","failed"]}},"required":["id","agentId","requestId","threadId","messageId","state","retryable","nextAction","taskId","deliveryStatus"]},"request":{"$ref":"#/components/schemas/RuntimeRequestEnvelope"}},"required":["send","request"]}}}}}}},"/api/agents/{agentId}/email/sends/{sendId}/dispatch":{"post":{"tags":["Agent email"],"security":[{"bearerAuth":[]}],"operationId":"postAgentsByAgentIdEmailSendsBySendIdDispatch","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"agentId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"sendId","in":"path"}],"responses":{"200":{"description":"Same send after exact authorization check","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"requestId":{"type":"string","nullable":true,"format":"uuid"},"threadId":{"type":"string","nullable":true,"format":"uuid"},"messageId":{"type":"string","nullable":true,"format":"uuid"},"state":{"type":"string","enum":["waiting_approval","authorized","queued","dispatching","accepted","submission_unknown","denied","expired","failed"]},"retryable":{"type":"boolean"},"nextAction":{"type":"string","enum":["wait_request","send_agent_email","get_agent_email_send","none"]},"taskId":{"type":"string","format":"uuid"},"deliveryStatus":{"type":"string","enum":["pending","delivered","delayed","bounced","failed"]}},"required":["id","agentId","requestId","threadId","messageId","state","retryable","nextAction","taskId","deliveryStatus"]}}}}}}},"/api/agents/{agentId}/email/sends/{sendId}":{"get":{"tags":["Agent email"],"security":[{"bearerAuth":[]}],"operationId":"getAgentsByAgentIdEmailSendsBySendId","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"agentId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"sendId","in":"path"}],"responses":{"200":{"description":"Durable email send state","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"requestId":{"type":"string","nullable":true,"format":"uuid"},"threadId":{"type":"string","nullable":true,"format":"uuid"},"messageId":{"type":"string","nullable":true,"format":"uuid"},"state":{"type":"string","enum":["waiting_approval","authorized","queued","dispatching","accepted","submission_unknown","denied","expired","failed"]},"retryable":{"type":"boolean"},"nextAction":{"type":"string","enum":["wait_request","send_agent_email","get_agent_email_send","none"]},"taskId":{"type":"string","format":"uuid"},"deliveryStatus":{"type":"string","enum":["pending","delivered","delayed","bounced","failed"]}},"required":["id","agentId","requestId","threadId","messageId","state","retryable","nextAction","taskId","deliveryStatus"]}}}}}}},"/api/payment-quotes/x402":{"post":{"operationId":"postPaymentQuotesX402","tags":["Payment Quotes"],"summary":"Preview a complete x402 debit without creating a payment","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"x402":{"type":"object","properties":{"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"httpRequest":{"type":"object","properties":{"requestVersion":{"type":"number","enum":[1]},"url":{"type":"string"},"method":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"body":{"anyOf":[{"nullable":true},{"type":"object","properties":{"encoding":{"type":"string","enum":["base64"]},"content":{"type":"string"}},"required":["encoding","content"],"additionalProperties":false}]}},"required":["requestVersion","url","method","headers","body"],"additionalProperties":false}},"required":["maximumDebit","httpRequest"],"additionalProperties":false}},"required":["clientRequestId","x402"],"additionalProperties":false}}}},"responses":{"200":{"description":"Unsigned price preview","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.x402-quote/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"quoteRef":{"type":"string","pattern":"^mpquote_v1_[0-9a-f]{64}$/u"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"merchant":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"},"scale":{"type":"number","enum":[6]},"asset":{"type":"object","properties":{"namespace":{"type":"string"},"assetId":{"type":"string"},"network":{"type":"string"}},"required":["namespace","assetId","network"],"additionalProperties":false}},"required":["quantity","scale","asset"],"additionalProperties":false},"debit":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"},"scale":{"type":"number","enum":[6]},"asset":{"type":"object","properties":{"namespace":{"type":"string"},"assetId":{"type":"string"},"network":{"type":"string"}},"required":["namespace","assetId","network"],"additionalProperties":false}},"required":["quantity","scale","asset"],"additionalProperties":false},"fees":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"},"scale":{"type":"number","enum":[6]},"asset":{"type":"object","properties":{"namespace":{"type":"string"},"assetId":{"type":"string"},"network":{"type":"string"}},"required":["namespace","assetId","network"],"additionalProperties":false}},"required":["quantity","scale","asset"],"additionalProperties":false},"classification":{"type":"string","enum":["exact","maximum"]},"expiresAt":{"type":"string","format":"date-time"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"paymentCreated":{"type":"boolean","enum":[false]}},"required":["contract","schemaVersion","quoteRef","clientRequestId","merchant","debit","fees","classification","expiresAt","maximumDebit","paymentCreated"],"additionalProperties":false}}}}}}},"/api/payment-runs/capabilities":{"get":{"operationId":"getPaymentRunsCapabilities","tags":["Payment Runs"],"summary":"Read composed x402 payment-run eligibility","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"agentId","in":"query"}],"responses":{"200":{"description":"Current payment-run compatibility and selected agent","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run-capabilities/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"x402PaymentRun":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready"]},"selectedAgentId":{"type":"string","format":"uuid"},"workflowContract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"minimumPluginVersion":{"type":"string","enum":["0.2.0"]},"fallbackAllowed":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["continue_user_task"]}},"required":["status","selectedAgentId","workflowContract","schemaVersion","minimumPluginVersion","fallbackAllowed","nextAction"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["blocked"]},"reasonCode":{"type":"string","enum":["NO_ACTIVE_AGENT","AGENT_SELECTION_REQUIRED","AGENT_NOT_OWNED","AGENT_SCOPE_UNAVAILABLE","X402_RUNTIME_UNAVAILABLE"]},"workflowContract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"minimumPluginVersion":{"type":"string","enum":["0.2.0"]},"fallbackAllowed":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["complete_setup","select_owned_agent","retry_later"]}},"required":["status","reasonCode","workflowContract","schemaVersion","minimumPluginVersion","fallbackAllowed","nextAction"],"additionalProperties":false}]},"cryptoPaymentRun":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready"]},"selectedAgentId":{"type":"string","format":"uuid"},"supportedAssets":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","enum":["caip-19"]},"assetId":{"type":"string"},"network":{"type":"string"}},"required":["namespace","assetId","network"],"additionalProperties":false}},"workflowContract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"minimumPluginVersion":{"type":"string","enum":["0.2.0"]},"fallbackAllowed":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["continue_user_task"]}},"required":["status","selectedAgentId","workflowContract","schemaVersion","minimumPluginVersion","fallbackAllowed","nextAction"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["blocked"]},"reasonCode":{"type":"string","enum":["NO_ACTIVE_AGENT","AGENT_SELECTION_REQUIRED","AGENT_NOT_OWNED","AGENT_SCOPE_UNAVAILABLE","DIRECT_TRANSFER_RUNTIME_UNAVAILABLE"]},"workflowContract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"minimumPluginVersion":{"type":"string","enum":["0.2.0"]},"fallbackAllowed":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["complete_setup","select_owned_agent","retry_later"]}},"required":["status","reasonCode","workflowContract","schemaVersion","minimumPluginVersion","fallbackAllowed","nextAction"],"additionalProperties":false}]},"browserPaymentRun":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready"]},"cardGuidance":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.card-method-guidance/v1"]},"state":{"type":"string","enum":["no_card","memory_only","aftercard_available","issuance_pending","unknown"]},"savedCardCount":{"type":"integer","minimum":0},"message":{"type":"string","minLength":1,"maxLength":1000},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["issue_aftercard","add_card","use_saved_card","use_aftercard"]},"label":{"type":"string","minLength":1,"maxLength":100},"recommended":{"type":"boolean"},"available":{"type":"boolean"},"unavailableReason":{"type":"string","maxLength":500},"url":{"type":"string","format":"uri"}},"required":["id","label","recommended","available"],"additionalProperties":false},"maxItems":4}},"required":["contract","state","message","actions"],"additionalProperties":false},"selectedAgentId":{"type":"string","format":"uuid"},"workflowContract":{"type":"string","enum":["aftercard.browser-payment/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"minimumPluginVersion":{"type":"string","enum":["0.2.0"]},"executionMode":{"type":"string","enum":["agent_direct"]},"fallbackAllowed":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["continue_user_task"]}},"required":["status","selectedAgentId","workflowContract","schemaVersion","minimumPluginVersion","executionMode","fallbackAllowed","nextAction"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["blocked"]},"cardGuidance":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.card-method-guidance/v1"]},"state":{"type":"string","enum":["no_card","memory_only","aftercard_available","issuance_pending","unknown"]},"savedCardCount":{"type":"integer","minimum":0},"message":{"type":"string","minLength":1,"maxLength":1000},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["issue_aftercard","add_card","use_saved_card","use_aftercard"]},"label":{"type":"string","minLength":1,"maxLength":100},"recommended":{"type":"boolean"},"available":{"type":"boolean"},"unavailableReason":{"type":"string","maxLength":500},"url":{"type":"string","format":"uri"}},"required":["id","label","recommended","available"],"additionalProperties":false},"maxItems":4}},"required":["contract","state","message","actions"],"additionalProperties":false},"reasonCode":{"type":"string","enum":["NO_ACTIVE_AGENT","AGENT_SELECTION_REQUIRED","AGENT_NOT_OWNED","AGENT_SCOPE_UNAVAILABLE","BROWSER_PAYMENT_RUNTIME_UNAVAILABLE","BROWSER_PAYMENT_CONTRACT_INCOMPATIBLE","BROWSER_PAYMENT_CARD_NOT_CONFIGURED","BROWSER_PAYMENT_CARD_INACTIVE","BROWSER_PAYMENT_CARD_CONFIGURATION_AMBIGUOUS","BROWSER_PAYMENT_CARD_PROVIDER_UNSUPPORTED"]},"workflowContract":{"type":"string","enum":["aftercard.browser-payment/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"minimumPluginVersion":{"type":"string","enum":["0.2.0"]},"executionMode":{"type":"string","enum":["agent_direct"]},"fallbackAllowed":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["complete_setup","select_owned_agent","upgrade_aftercard","retry_later"]}},"required":["status","reasonCode","workflowContract","schemaVersion","minimumPluginVersion","executionMode","fallbackAllowed","nextAction"],"additionalProperties":false}]}},"required":["contract","schemaVersion","x402PaymentRun","cryptoPaymentRun","browserPaymentRun"],"additionalProperties":false}}}}}}},"/api/payment-runs":{"post":{"operationId":"postPaymentRuns","tags":["Payment Runs"],"summary":"Create or resume one composed x402 payment run","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"waitTimeoutMs":{"type":"integer","minimum":0,"maximum":12000,"default":12000},"progressCursor":{"type":"integer","minimum":0},"taskId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["x402"]},"x402":{"type":"object","properties":{"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"acceptedQuoteRef":{"type":"string","pattern":"^mpquote_v1_[0-9a-f]{64}$/u"},"httpRequest":{"type":"object","properties":{"requestVersion":{"type":"number","enum":[1]},"url":{"type":"string"},"method":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"body":{"anyOf":[{"nullable":true},{"type":"object","properties":{"encoding":{"type":"string","enum":["base64"]},"content":{"type":"string"}},"required":["encoding","content"],"additionalProperties":false}]}},"required":["requestVersion","url","method","headers","body"],"additionalProperties":false}},"required":["maximumDebit","httpRequest"],"additionalProperties":false}},"required":["clientRequestId","kind","x402"],"additionalProperties":false},{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"waitTimeoutMs":{"type":"integer","minimum":0,"maximum":12000,"default":12000},"progressCursor":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["direct_transfer"]},"directTransfer":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"destination":{"type":"string","minLength":1,"maxLength":512}},"required":["asset","principal","maximumDebit","destination"],"additionalProperties":false}},"required":["clientRequestId","kind","directTransfer"],"additionalProperties":false},{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"waitTimeoutMs":{"type":"integer","minimum":0,"maximum":12000,"default":12000},"progressCursor":{"type":"integer","minimum":0},"taskId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["browser_payment"]},"browserPayment":{"type":"object","properties":{"cardChoice":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["aftercard"]}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["saved_card"]},"itemId":{"type":"string","format":"uuid"}},"required":["kind","itemId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["add_card"]}},"required":["kind"],"additionalProperties":false}]},"pageUrl":{"type":"string","maxLength":2048,"format":"uri"},"pageRef":{"type":"string","minLength":1,"maxLength":500},"merchantDomain":{"type":"string","minLength":1,"maxLength":253},"sellerDomain":{"type":"string","minLength":1,"maxLength":253,"pattern":"^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?\\.[a-z]{2,}$/iu"},"sellerName":{"type":"string","minLength":1,"maxLength":300},"recipient":{"type":"string","minLength":1,"maxLength":300},"description":{"type":"string","minLength":1,"maxLength":1000},"amount":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"maximumDebit":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"paymentType":{"type":"string","enum":["one_time","subscription"],"default":"one_time"},"subscriptionDetails":{"nullable":true},"finalAction":{"type":"object","properties":{"role":{"type":"string","enum":["pay","place_order","donate","book","subscribe"]},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["role","label"],"additionalProperties":false},"ordinaryFields":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"itemRef":{"type":"string","minLength":1,"maxLength":200},"contentRevision":{"type":"string","minLength":1,"maxLength":200},"fieldRef":{"type":"string","minLength":1,"maxLength":200}},"required":["role","itemRef","contentRevision","fieldRef"],"additionalProperties":false},"maxItems":8,"default":[]},"ordinaryFieldRoles":{"type":"array","items":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"maxItems":8},"ordinaryValues":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"fieldRef":{"type":"string","minLength":1,"maxLength":200},"value":{"type":"string","maxLength":4000}},"required":["role","fieldRef","value"],"additionalProperties":false},"maxItems":8}},"required":["pageUrl","merchantDomain","recipient","amount","maximumDebit","finalAction"],"additionalProperties":false}},"required":["clientRequestId","taskId","kind","browserPayment"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Current composed payment run state","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"operation":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false},"progress":{"type":"array","items":{"type":"object","properties":{"cursor":{"type":"integer","minimum":0,"exclusiveMinimum":true},"stage":{"type":"string","enum":["session_bound","authorizing","approval_required","ordinary_field_required","executing","preparing_browser","ready_for_browser","browser_submitted","verifying_result","completed","fulfillment_failed","failed","reconciliation_required"]},"visibility":{"type":"string","enum":["silent","inform","action_required"]},"message":{"type":"string","minLength":1,"maxLength":256},"occurredAt":{"type":"string","format":"date-time"}},"required":["cursor","stage","visibility","message","occurredAt"],"additionalProperties":false},"maxItems":64},"nextProgressCursor":{"type":"integer","minimum":0},"waitAfterMs":{"type":"integer","minimum":0,"maximum":30000},"fundingGate":{"type":"object","properties":{"requiredAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,37})$/u"},"availableAtomic":{"type":"string","pattern":"^(?:0|-?[1-9][0-9]{0,38})$/u"},"shortfallAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,38})$/u"},"status":{"type":"string","enum":["insufficient","funded"]},"checkedAt":{"type":"string"}},"required":["requiredAtomic","availableAtomic","shortfallAtomic","status","checkedAt"],"additionalProperties":false},"fundingGateError":{"type":"object","properties":{"errorCode":{"type":"string","enum":["payment_funding_unavailable"]},"retryable":{"type":"boolean","enum":[true]}},"required":["errorCode","retryable"],"additionalProperties":false},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false},"kind":{"type":"string","enum":["x402","direct_transfer"]},"state":{"type":"string","enum":["running","waiting_for_user","completed","fulfillment_failed","failed","reconciliation_required"]},"result":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.x402-result/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"resultRef":{"type":"string","pattern":"^mpx402r_v1_[0-9a-f]{64}$/u"},"mediaType":{"type":"string","minLength":1,"maxLength":128},"encoding":{"type":"string","enum":["base64"]},"byteLength":{"type":"integer","minimum":0,"maximum":2097152},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$/u"},"body":{"type":"string","maxLength":2796204,"pattern":"^[A-Za-z0-9+/]*={0,2}$/u"},"expiresAt":{"type":"string","format":"date-time"},"responseStatus":{"type":"integer","minimum":100,"maximum":599}},"required":["contract","schemaVersion","operationId","resultRef","mediaType","encoding","byteLength","sha256","body","expiresAt"],"additionalProperties":false},"delivery":{"type":"object","properties":{"state":{"type":"string","enum":["available","awaiting_response","recovery_scheduled","unavailable"]},"fulfillment":{"type":"string","enum":["delivered","pending","failed","unverified"]},"reason":{"type":"string","minLength":1,"maxLength":160},"lastAttemptAt":{"type":"string","format":"date-time"},"nextAttemptAt":{"type":"string","format":"date-time"}},"required":["state"],"additionalProperties":false},"transferStatus":{"type":"string","enum":["confirmed","settled"]}},"required":["contract","schemaVersion","taskId","selectedAgentId","clientRequestId","operation","progress","nextProgressCursor","kind","state","result"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"operation":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false},"progress":{"type":"array","items":{"type":"object","properties":{"cursor":{"type":"integer","minimum":0,"exclusiveMinimum":true},"stage":{"type":"string","enum":["session_bound","authorizing","approval_required","ordinary_field_required","executing","preparing_browser","ready_for_browser","browser_submitted","verifying_result","completed","fulfillment_failed","failed","reconciliation_required"]},"visibility":{"type":"string","enum":["silent","inform","action_required"]},"message":{"type":"string","minLength":1,"maxLength":256},"occurredAt":{"type":"string","format":"date-time"}},"required":["cursor","stage","visibility","message","occurredAt"],"additionalProperties":false},"maxItems":64},"nextProgressCursor":{"type":"integer","minimum":0},"waitAfterMs":{"type":"integer","minimum":0,"maximum":30000},"fundingGate":{"type":"object","properties":{"requiredAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,37})$/u"},"availableAtomic":{"type":"string","pattern":"^(?:0|-?[1-9][0-9]{0,38})$/u"},"shortfallAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,38})$/u"},"status":{"type":"string","enum":["insufficient","funded"]},"checkedAt":{"type":"string"}},"required":["requiredAtomic","availableAtomic","shortfallAtomic","status","checkedAt"],"additionalProperties":false},"fundingGateError":{"type":"object","properties":{"errorCode":{"type":"string","enum":["payment_funding_unavailable"]},"retryable":{"type":"boolean","enum":[true]}},"required":["errorCode","retryable"],"additionalProperties":false},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false},"kind":{"type":"string","enum":["browser_payment"]},"state":{"type":"string","enum":["input_required","running","ordinary_field_required","waiting_for_user","preparing_browser","ready_for_browser","external_pending","completed","failed","reconciliation_required"]},"result":{"nullable":true},"browserExecution":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.browser-payment/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"executionAttemptId":{"type":"string","format":"uuid"},"authorization":{"type":"object","properties":{"status":{"type":"string","enum":["approved","auto_approved"]},"merchantDomain":{"type":"string","minLength":1,"maxLength":253},"pageUrl":{"type":"string","maxLength":2048,"format":"uri"},"recipient":{"type":"string","minLength":1,"maxLength":300},"amount":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"maximumDebit":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"paymentType":{"type":"string","enum":["one_time","subscription"]},"finalAction":{"type":"object","properties":{"role":{"type":"string","enum":["pay","place_order","donate","book","subscribe"]},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["role","label"],"additionalProperties":false}},"required":["status","merchantDomain","pageUrl","recipient","amount","maximumDebit","paymentType","finalAction"],"additionalProperties":false},"ordinaryFields":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"fieldRef":{"type":"string","minLength":1,"maxLength":200},"value":{"type":"string","maxLength":4000}},"required":["role","fieldRef","value"],"additionalProperties":false},"maxItems":8},"card":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-scoped-card/v1"]},"scope":{"type":"string","enum":["one_time_browser_payment"]},"cardholderName":{"type":"string","minLength":1,"maxLength":200},"number":{"type":"string","pattern":"^[0-9]{12,19}$/u"},"expiryMonth":{"type":"string","pattern":"^(0[1-9]|1[0-2])$/u"},"expiryYear":{"type":"string","pattern":"^[0-9]{4}$/u"},"securityCode":{"type":"string","pattern":"^[0-9]{3,4}$/u"},"billingAddress":{"type":"object","properties":{"street":{"type":"string","minLength":1,"maxLength":500},"city":{"type":"string","minLength":1,"maxLength":500},"postalCode":{"type":"string","minLength":1,"maxLength":500},"country":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"expiresAt":{"type":"string","format":"date-time"}},"required":["contract","scope","cardholderName","number","expiryMonth","expiryYear","securityCode","expiresAt"],"additionalProperties":false},"userActionRequired":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["fill_and_submit_exact_checkout"]}},"required":["contract","schemaVersion","executionAttemptId","authorization","ordinaryFields","card","userActionRequired","nextAction"],"additionalProperties":false},"ordinaryFieldRequest":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"roles":{"type":"array","items":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"minItems":1,"maxItems":8}},"required":["requestId","roles"],"additionalProperties":false},"cardInputRequest":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["choice","card","setup"]}},"required":["requestId","kind"],"additionalProperties":false},"cardGuidance":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.card-method-guidance/v1"]},"state":{"type":"string","enum":["no_card","memory_only","aftercard_available","issuance_pending","unknown"]},"savedCardCount":{"type":"integer","minimum":0},"message":{"type":"string","minLength":1,"maxLength":1000},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["issue_aftercard","add_card","use_saved_card","use_aftercard"]},"label":{"type":"string","minLength":1,"maxLength":100},"recommended":{"type":"boolean"},"available":{"type":"boolean"},"unavailableReason":{"type":"string","maxLength":500},"url":{"type":"string","format":"uri"}},"required":["id","label","recommended","available"],"additionalProperties":false},"maxItems":4}},"required":["contract","state","message","actions"],"additionalProperties":false},"selectedCard":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"summary":{}},"required":["label"],"additionalProperties":false},"fundingSource":{"type":"string","enum":["external_card","aftercard_balance"]},"invoiceFollowUp":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["automatic_email"]},"email":{"type":"string","format":"email"}},"required":["mode","email"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["external_email"]},"email":{"type":"string","format":"email"},"message":{"type":"string","minLength":1,"maxLength":700}},"required":["mode","email","message"],"additionalProperties":false}]}},"required":["contract","schemaVersion","taskId","selectedAgentId","clientRequestId","operation","progress","nextProgressCursor","kind","state","result","browserExecution"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"kind":{"type":"string","enum":["direct_transfer"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128},"operation":{"nullable":true},"result":{"nullable":true},"progress":{"type":"array","items":{"anyOf":[]},"minItems":0,"maxItems":0},"nextProgressCursor":{"type":"number","enum":[0]},"state":{"type":"string","enum":["waiting_for_user","external_pending","completed","failed"]},"requestUrl":{"type":"string","format":"uri"},"topUpUrl":{"type":"string","format":"uri"},"telegramTopUpUrl":{"type":"string","format":"uri"},"walletTransfer":{"type":"object","properties":{"status":{"type":"string","enum":["awaiting_approval","funding_required","pending","confirmed","reverted","expired","canceled"]},"recipient":{"type":"string","pattern":"^0x[0-9a-f]{40}$/iu"},"amountAtomic":{"type":"string"},"transactionHash":{"type":"string","nullable":true,"pattern":"^0x[0-9a-f]{64}$/u"}},"required":["status","recipient","amountAtomic","transactionHash"],"additionalProperties":false}},"required":["contract","schemaVersion","kind","taskId","selectedAgentId","clientRequestId","operation","result","progress","nextProgressCursor","state","walletTransfer"],"additionalProperties":false}]}}}},"400":{"description":"Invalid payment run","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"404":{"description":"Payment run not found","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"409":{"description":"Payment run conflict","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"502":{"description":"Payment evidence invalid","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"503":{"description":"Payment runtime unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}}}}},"/api/payment-runs/{taskId}/wait":{"get":{"operationId":"getPaymentRunsByTaskIdWait","tags":["Payment Runs"],"summary":"Bounded wait on one exact payment run","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"taskId","in":"path"},{"schema":{"type":"integer","nullable":true,"minimum":0,"maximum":12000,"default":12000},"required":false,"name":"timeoutMs","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"progressCursor","in":"query"}],"responses":{"200":{"description":"Current composed payment run state","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"operation":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false},"progress":{"type":"array","items":{"type":"object","properties":{"cursor":{"type":"integer","minimum":0,"exclusiveMinimum":true},"stage":{"type":"string","enum":["session_bound","authorizing","approval_required","ordinary_field_required","executing","preparing_browser","ready_for_browser","browser_submitted","verifying_result","completed","fulfillment_failed","failed","reconciliation_required"]},"visibility":{"type":"string","enum":["silent","inform","action_required"]},"message":{"type":"string","minLength":1,"maxLength":256},"occurredAt":{"type":"string","format":"date-time"}},"required":["cursor","stage","visibility","message","occurredAt"],"additionalProperties":false},"maxItems":64},"nextProgressCursor":{"type":"integer","minimum":0},"waitAfterMs":{"type":"integer","minimum":0,"maximum":30000},"fundingGate":{"type":"object","properties":{"requiredAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,37})$/u"},"availableAtomic":{"type":"string","pattern":"^(?:0|-?[1-9][0-9]{0,38})$/u"},"shortfallAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,38})$/u"},"status":{"type":"string","enum":["insufficient","funded"]},"checkedAt":{"type":"string"}},"required":["requiredAtomic","availableAtomic","shortfallAtomic","status","checkedAt"],"additionalProperties":false},"fundingGateError":{"type":"object","properties":{"errorCode":{"type":"string","enum":["payment_funding_unavailable"]},"retryable":{"type":"boolean","enum":[true]}},"required":["errorCode","retryable"],"additionalProperties":false},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false},"kind":{"type":"string","enum":["x402","direct_transfer"]},"state":{"type":"string","enum":["running","waiting_for_user","completed","fulfillment_failed","failed","reconciliation_required"]},"result":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.x402-result/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"resultRef":{"type":"string","pattern":"^mpx402r_v1_[0-9a-f]{64}$/u"},"mediaType":{"type":"string","minLength":1,"maxLength":128},"encoding":{"type":"string","enum":["base64"]},"byteLength":{"type":"integer","minimum":0,"maximum":2097152},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$/u"},"body":{"type":"string","maxLength":2796204,"pattern":"^[A-Za-z0-9+/]*={0,2}$/u"},"expiresAt":{"type":"string","format":"date-time"},"responseStatus":{"type":"integer","minimum":100,"maximum":599}},"required":["contract","schemaVersion","operationId","resultRef","mediaType","encoding","byteLength","sha256","body","expiresAt"],"additionalProperties":false},"delivery":{"type":"object","properties":{"state":{"type":"string","enum":["available","awaiting_response","recovery_scheduled","unavailable"]},"fulfillment":{"type":"string","enum":["delivered","pending","failed","unverified"]},"reason":{"type":"string","minLength":1,"maxLength":160},"lastAttemptAt":{"type":"string","format":"date-time"},"nextAttemptAt":{"type":"string","format":"date-time"}},"required":["state"],"additionalProperties":false},"transferStatus":{"type":"string","enum":["confirmed","settled"]}},"required":["contract","schemaVersion","taskId","selectedAgentId","clientRequestId","operation","progress","nextProgressCursor","kind","state","result"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"operation":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false},"progress":{"type":"array","items":{"type":"object","properties":{"cursor":{"type":"integer","minimum":0,"exclusiveMinimum":true},"stage":{"type":"string","enum":["session_bound","authorizing","approval_required","ordinary_field_required","executing","preparing_browser","ready_for_browser","browser_submitted","verifying_result","completed","fulfillment_failed","failed","reconciliation_required"]},"visibility":{"type":"string","enum":["silent","inform","action_required"]},"message":{"type":"string","minLength":1,"maxLength":256},"occurredAt":{"type":"string","format":"date-time"}},"required":["cursor","stage","visibility","message","occurredAt"],"additionalProperties":false},"maxItems":64},"nextProgressCursor":{"type":"integer","minimum":0},"waitAfterMs":{"type":"integer","minimum":0,"maximum":30000},"fundingGate":{"type":"object","properties":{"requiredAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,37})$/u"},"availableAtomic":{"type":"string","pattern":"^(?:0|-?[1-9][0-9]{0,38})$/u"},"shortfallAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,38})$/u"},"status":{"type":"string","enum":["insufficient","funded"]},"checkedAt":{"type":"string"}},"required":["requiredAtomic","availableAtomic","shortfallAtomic","status","checkedAt"],"additionalProperties":false},"fundingGateError":{"type":"object","properties":{"errorCode":{"type":"string","enum":["payment_funding_unavailable"]},"retryable":{"type":"boolean","enum":[true]}},"required":["errorCode","retryable"],"additionalProperties":false},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false},"kind":{"type":"string","enum":["browser_payment"]},"state":{"type":"string","enum":["input_required","running","ordinary_field_required","waiting_for_user","preparing_browser","ready_for_browser","external_pending","completed","failed","reconciliation_required"]},"result":{"nullable":true},"browserExecution":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.browser-payment/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"executionAttemptId":{"type":"string","format":"uuid"},"authorization":{"type":"object","properties":{"status":{"type":"string","enum":["approved","auto_approved"]},"merchantDomain":{"type":"string","minLength":1,"maxLength":253},"pageUrl":{"type":"string","maxLength":2048,"format":"uri"},"recipient":{"type":"string","minLength":1,"maxLength":300},"amount":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"maximumDebit":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"paymentType":{"type":"string","enum":["one_time","subscription"]},"finalAction":{"type":"object","properties":{"role":{"type":"string","enum":["pay","place_order","donate","book","subscribe"]},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["role","label"],"additionalProperties":false}},"required":["status","merchantDomain","pageUrl","recipient","amount","maximumDebit","paymentType","finalAction"],"additionalProperties":false},"ordinaryFields":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"fieldRef":{"type":"string","minLength":1,"maxLength":200},"value":{"type":"string","maxLength":4000}},"required":["role","fieldRef","value"],"additionalProperties":false},"maxItems":8},"card":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-scoped-card/v1"]},"scope":{"type":"string","enum":["one_time_browser_payment"]},"cardholderName":{"type":"string","minLength":1,"maxLength":200},"number":{"type":"string","pattern":"^[0-9]{12,19}$/u"},"expiryMonth":{"type":"string","pattern":"^(0[1-9]|1[0-2])$/u"},"expiryYear":{"type":"string","pattern":"^[0-9]{4}$/u"},"securityCode":{"type":"string","pattern":"^[0-9]{3,4}$/u"},"billingAddress":{"type":"object","properties":{"street":{"type":"string","minLength":1,"maxLength":500},"city":{"type":"string","minLength":1,"maxLength":500},"postalCode":{"type":"string","minLength":1,"maxLength":500},"country":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"expiresAt":{"type":"string","format":"date-time"}},"required":["contract","scope","cardholderName","number","expiryMonth","expiryYear","securityCode","expiresAt"],"additionalProperties":false},"userActionRequired":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["fill_and_submit_exact_checkout"]}},"required":["contract","schemaVersion","executionAttemptId","authorization","ordinaryFields","card","userActionRequired","nextAction"],"additionalProperties":false},"ordinaryFieldRequest":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"roles":{"type":"array","items":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"minItems":1,"maxItems":8}},"required":["requestId","roles"],"additionalProperties":false},"cardInputRequest":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["choice","card","setup"]}},"required":["requestId","kind"],"additionalProperties":false},"cardGuidance":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.card-method-guidance/v1"]},"state":{"type":"string","enum":["no_card","memory_only","aftercard_available","issuance_pending","unknown"]},"savedCardCount":{"type":"integer","minimum":0},"message":{"type":"string","minLength":1,"maxLength":1000},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["issue_aftercard","add_card","use_saved_card","use_aftercard"]},"label":{"type":"string","minLength":1,"maxLength":100},"recommended":{"type":"boolean"},"available":{"type":"boolean"},"unavailableReason":{"type":"string","maxLength":500},"url":{"type":"string","format":"uri"}},"required":["id","label","recommended","available"],"additionalProperties":false},"maxItems":4}},"required":["contract","state","message","actions"],"additionalProperties":false},"selectedCard":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"summary":{}},"required":["label"],"additionalProperties":false},"fundingSource":{"type":"string","enum":["external_card","aftercard_balance"]},"invoiceFollowUp":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["automatic_email"]},"email":{"type":"string","format":"email"}},"required":["mode","email"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["external_email"]},"email":{"type":"string","format":"email"},"message":{"type":"string","minLength":1,"maxLength":700}},"required":["mode","email","message"],"additionalProperties":false}]}},"required":["contract","schemaVersion","taskId","selectedAgentId","clientRequestId","operation","progress","nextProgressCursor","kind","state","result","browserExecution"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"kind":{"type":"string","enum":["direct_transfer"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128},"operation":{"nullable":true},"result":{"nullable":true},"progress":{"type":"array","items":{"anyOf":[]},"minItems":0,"maxItems":0},"nextProgressCursor":{"type":"number","enum":[0]},"state":{"type":"string","enum":["waiting_for_user","external_pending","completed","failed"]},"requestUrl":{"type":"string","format":"uri"},"topUpUrl":{"type":"string","format":"uri"},"telegramTopUpUrl":{"type":"string","format":"uri"},"walletTransfer":{"type":"object","properties":{"status":{"type":"string","enum":["awaiting_approval","funding_required","pending","confirmed","reverted","expired","canceled"]},"recipient":{"type":"string","pattern":"^0x[0-9a-f]{40}$/iu"},"amountAtomic":{"type":"string"},"transactionHash":{"type":"string","nullable":true,"pattern":"^0x[0-9a-f]{64}$/u"}},"required":["status","recipient","amountAtomic","transactionHash"],"additionalProperties":false}},"required":["contract","schemaVersion","kind","taskId","selectedAgentId","clientRequestId","operation","result","progress","nextProgressCursor","state","walletTransfer"],"additionalProperties":false}]}}}},"400":{"description":"Invalid payment run","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"404":{"description":"Payment run not found","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"409":{"description":"Payment run conflict","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"502":{"description":"Payment evidence invalid","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"503":{"description":"Payment runtime unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}}}}},"/api/payment-runs/{taskId}/browser-result":{"post":{"operationId":"postPaymentRunsByTaskIdBrowserResult","tags":["Payment Runs"],"summary":"Record one value-free browser payment result","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"taskId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"executionAttemptId":{"type":"string","format":"uuid"},"clientResultId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"result":{"type":"string","enum":["clicked","not_clicked","click_uncertain"]},"submissionState":{"type":"string","enum":["submitted","not_submitted","submission_unknown"]},"merchantOutcome":{"type":"string","enum":["success","failure","pending","unknown"]},"nonSubmissionReason":{"type":"string","enum":["checkout_total_changed"]},"checkoutEmail":{"type":"string","maxLength":320,"format":"email"},"subscriptionDetails":{"nullable":true},"valueFreeEvidence":{"type":"object","additionalProperties":{"nullable":true}}},"required":["executionAttemptId","clientResultId","result","submissionState","merchantOutcome","valueFreeEvidence"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current composed payment run state","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"operation":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false},"progress":{"type":"array","items":{"type":"object","properties":{"cursor":{"type":"integer","minimum":0,"exclusiveMinimum":true},"stage":{"type":"string","enum":["session_bound","authorizing","approval_required","ordinary_field_required","executing","preparing_browser","ready_for_browser","browser_submitted","verifying_result","completed","fulfillment_failed","failed","reconciliation_required"]},"visibility":{"type":"string","enum":["silent","inform","action_required"]},"message":{"type":"string","minLength":1,"maxLength":256},"occurredAt":{"type":"string","format":"date-time"}},"required":["cursor","stage","visibility","message","occurredAt"],"additionalProperties":false},"maxItems":64},"nextProgressCursor":{"type":"integer","minimum":0},"waitAfterMs":{"type":"integer","minimum":0,"maximum":30000},"fundingGate":{"type":"object","properties":{"requiredAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,37})$/u"},"availableAtomic":{"type":"string","pattern":"^(?:0|-?[1-9][0-9]{0,38})$/u"},"shortfallAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,38})$/u"},"status":{"type":"string","enum":["insufficient","funded"]},"checkedAt":{"type":"string"}},"required":["requiredAtomic","availableAtomic","shortfallAtomic","status","checkedAt"],"additionalProperties":false},"fundingGateError":{"type":"object","properties":{"errorCode":{"type":"string","enum":["payment_funding_unavailable"]},"retryable":{"type":"boolean","enum":[true]}},"required":["errorCode","retryable"],"additionalProperties":false},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false},"kind":{"type":"string","enum":["x402","direct_transfer"]},"state":{"type":"string","enum":["running","waiting_for_user","completed","fulfillment_failed","failed","reconciliation_required"]},"result":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.x402-result/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"resultRef":{"type":"string","pattern":"^mpx402r_v1_[0-9a-f]{64}$/u"},"mediaType":{"type":"string","minLength":1,"maxLength":128},"encoding":{"type":"string","enum":["base64"]},"byteLength":{"type":"integer","minimum":0,"maximum":2097152},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$/u"},"body":{"type":"string","maxLength":2796204,"pattern":"^[A-Za-z0-9+/]*={0,2}$/u"},"expiresAt":{"type":"string","format":"date-time"},"responseStatus":{"type":"integer","minimum":100,"maximum":599}},"required":["contract","schemaVersion","operationId","resultRef","mediaType","encoding","byteLength","sha256","body","expiresAt"],"additionalProperties":false},"delivery":{"type":"object","properties":{"state":{"type":"string","enum":["available","awaiting_response","recovery_scheduled","unavailable"]},"fulfillment":{"type":"string","enum":["delivered","pending","failed","unverified"]},"reason":{"type":"string","minLength":1,"maxLength":160},"lastAttemptAt":{"type":"string","format":"date-time"},"nextAttemptAt":{"type":"string","format":"date-time"}},"required":["state"],"additionalProperties":false},"transferStatus":{"type":"string","enum":["confirmed","settled"]}},"required":["contract","schemaVersion","taskId","selectedAgentId","clientRequestId","operation","progress","nextProgressCursor","kind","state","result"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$/u"},"operation":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.payment-operation/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["funding","direct_transfer","x402_purchase","card_purchase"]},"state":{"type":"string","enum":["created","awaiting_funds","awaiting_approval","approved","reserved","ready_to_submit","external_not_submitted","external_pending","reconciliation_required","settlement_confirmed","failure_confirmed","write_off_confirmed","written_off","completed","definitively_failed"]},"fingerprint":{"type":"string","pattern":"^mpfp[12]:[0-9a-f]{64}$/u"},"attempt":{"type":"integer","minimum":0,"exclusiveMinimum":true},"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"amounts":{"type":"object","properties":{"principal":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"maximumDebit":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"customerDebit":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"maximum":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"actual":{"type":"string","pattern":"^(0|[1-9][0-9]*)$/u"}},"required":["asset","maximum"],"additionalProperties":false},"checkout":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"maxLength":128},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["amount","currency"],"additionalProperties":false},"settlement":{"type":"object","properties":{"asset":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"assetId":{"type":"string","minLength":1,"maxLength":128},"network":{"type":"string","minLength":1,"maxLength":128}},"required":["namespace","assetId","network"],"additionalProperties":false},"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"}},"required":["asset","quantity"],"additionalProperties":false}},"additionalProperties":false},"approval":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_required"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["required"]},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["approved"]},"reference":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":200},"runtimeRequestId":{"type":"string","format":"uuid"}},"required":["status","reference"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]},"requestId":{"type":"string","minLength":1,"maxLength":200}},"required":["status","requestId"],"additionalProperties":false}]},"ledger":{"type":"object","properties":{"adapterId":{"type":"string","minLength":1,"maxLength":128},"contractVersion":{"type":"string","minLength":1,"maxLength":128},"reservationRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"consequenceCommandRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"required":["adapterId","contractVersion"],"additionalProperties":false},"rail":{"type":"object","properties":{"submission":{"type":"string","enum":["not_submitted","submitted","submission_unknown"]},"outcome":{"type":"string","enum":["pending","succeeded","definitive_failure","unknown"]},"fundingAddress":{"type":"string","minLength":1,"maxLength":512},"offchain":{"type":"boolean"}},"additionalProperties":false},"references":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false}},"resultRef":{"type":"object","properties":{"namespace":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","minLength":1,"maxLength":128},"value":{"type":"string","minLength":1,"maxLength":2048}},"required":["namespace","kind","value"],"additionalProperties":false},"evidence":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_invoice","merchant_receipt"]},"invoiceId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["kind","invoiceId","fileName","mediaType","href","receivedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["chain_transaction"]},"network":{"type":"string","minLength":1,"maxLength":128},"transactionHash":{"type":"string","minLength":1,"maxLength":128},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","network","transactionHash","href"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["x402_result"]},"resultRef":{"type":"string","minLength":1,"maxLength":512},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["kind","resultRef","href"],"additionalProperties":false}]},"maxItems":8},"invoice":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"nextAction":{"type":"string","enum":["none","wait","send_funds","complete_approval","reconcile","retry_same_operation","retry_ledger_consequence"]},"retry":{"type":"object","properties":{"allowed":{"type":"boolean"},"mode":{"type":"string","enum":["none","reconcile_same_operation","retry_same_operation","retry_ledger_consequence"]}},"required":["allowed","mode"],"additionalProperties":false},"failure":{"type":"object","nullable":true,"properties":{"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"}},"required":["code","message","retryable"],"additionalProperties":false}},"required":["contract","schemaVersion","operationId","kind","state","fingerprint","attempt","asset","amounts","approval","ledger","rail","references","nextAction","retry","failure"],"additionalProperties":false},"progress":{"type":"array","items":{"type":"object","properties":{"cursor":{"type":"integer","minimum":0,"exclusiveMinimum":true},"stage":{"type":"string","enum":["session_bound","authorizing","approval_required","ordinary_field_required","executing","preparing_browser","ready_for_browser","browser_submitted","verifying_result","completed","fulfillment_failed","failed","reconciliation_required"]},"visibility":{"type":"string","enum":["silent","inform","action_required"]},"message":{"type":"string","minLength":1,"maxLength":256},"occurredAt":{"type":"string","format":"date-time"}},"required":["cursor","stage","visibility","message","occurredAt"],"additionalProperties":false},"maxItems":64},"nextProgressCursor":{"type":"integer","minimum":0},"waitAfterMs":{"type":"integer","minimum":0,"maximum":30000},"fundingGate":{"type":"object","properties":{"requiredAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,37})$/u"},"availableAtomic":{"type":"string","pattern":"^(?:0|-?[1-9][0-9]{0,38})$/u"},"shortfallAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,38})$/u"},"status":{"type":"string","enum":["insufficient","funded"]},"checkedAt":{"type":"string"}},"required":["requiredAtomic","availableAtomic","shortfallAtomic","status","checkedAt"],"additionalProperties":false},"fundingGateError":{"type":"object","properties":{"errorCode":{"type":"string","enum":["payment_funding_unavailable"]},"retryable":{"type":"boolean","enum":[true]}},"required":["errorCode","retryable"],"additionalProperties":false},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false},"kind":{"type":"string","enum":["browser_payment"]},"state":{"type":"string","enum":["input_required","running","ordinary_field_required","waiting_for_user","preparing_browser","ready_for_browser","external_pending","completed","failed","reconciliation_required"]},"result":{"nullable":true},"browserExecution":{"type":"object","nullable":true,"properties":{"contract":{"type":"string","enum":["aftercard.browser-payment/v1"]},"schemaVersion":{"type":"string","enum":["1.0"]},"executionAttemptId":{"type":"string","format":"uuid"},"authorization":{"type":"object","properties":{"status":{"type":"string","enum":["approved","auto_approved"]},"merchantDomain":{"type":"string","minLength":1,"maxLength":253},"pageUrl":{"type":"string","maxLength":2048,"format":"uri"},"recipient":{"type":"string","minLength":1,"maxLength":300},"amount":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"maximumDebit":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^[1-9][0-9]*$/u"},"scale":{"type":"integer","minimum":0,"maximum":18},"currency":{"type":"string","pattern":"^[A-Z]{3}$/u"}},"required":["quantity","scale","currency"],"additionalProperties":false},"paymentType":{"type":"string","enum":["one_time","subscription"]},"finalAction":{"type":"object","properties":{"role":{"type":"string","enum":["pay","place_order","donate","book","subscribe"]},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["role","label"],"additionalProperties":false}},"required":["status","merchantDomain","pageUrl","recipient","amount","maximumDebit","paymentType","finalAction"],"additionalProperties":false},"ordinaryFields":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"fieldRef":{"type":"string","minLength":1,"maxLength":200},"value":{"type":"string","maxLength":4000}},"required":["role","fieldRef","value"],"additionalProperties":false},"maxItems":8},"card":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-scoped-card/v1"]},"scope":{"type":"string","enum":["one_time_browser_payment"]},"cardholderName":{"type":"string","minLength":1,"maxLength":200},"number":{"type":"string","pattern":"^[0-9]{12,19}$/u"},"expiryMonth":{"type":"string","pattern":"^(0[1-9]|1[0-2])$/u"},"expiryYear":{"type":"string","pattern":"^[0-9]{4}$/u"},"securityCode":{"type":"string","pattern":"^[0-9]{3,4}$/u"},"billingAddress":{"type":"object","properties":{"street":{"type":"string","minLength":1,"maxLength":500},"city":{"type":"string","minLength":1,"maxLength":500},"postalCode":{"type":"string","minLength":1,"maxLength":500},"country":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"expiresAt":{"type":"string","format":"date-time"}},"required":["contract","scope","cardholderName","number","expiryMonth","expiryYear","securityCode","expiresAt"],"additionalProperties":false},"userActionRequired":{"type":"boolean","enum":[false]},"nextAction":{"type":"string","enum":["fill_and_submit_exact_checkout"]}},"required":["contract","schemaVersion","executionAttemptId","authorization","ordinaryFields","card","userActionRequired","nextAction"],"additionalProperties":false},"ordinaryFieldRequest":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"roles":{"type":"array","items":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"minItems":1,"maxItems":8}},"required":["requestId","roles"],"additionalProperties":false},"cardInputRequest":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["choice","card","setup"]}},"required":["requestId","kind"],"additionalProperties":false},"cardGuidance":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.card-method-guidance/v1"]},"state":{"type":"string","enum":["no_card","memory_only","aftercard_available","issuance_pending","unknown"]},"savedCardCount":{"type":"integer","minimum":0},"message":{"type":"string","minLength":1,"maxLength":1000},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["issue_aftercard","add_card","use_saved_card","use_aftercard"]},"label":{"type":"string","minLength":1,"maxLength":100},"recommended":{"type":"boolean"},"available":{"type":"boolean"},"unavailableReason":{"type":"string","maxLength":500},"url":{"type":"string","format":"uri"}},"required":["id","label","recommended","available"],"additionalProperties":false},"maxItems":4}},"required":["contract","state","message","actions"],"additionalProperties":false},"selectedCard":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"summary":{}},"required":["label"],"additionalProperties":false},"fundingSource":{"type":"string","enum":["external_card","aftercard_balance"]},"invoiceFollowUp":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["automatic_email"]},"email":{"type":"string","format":"email"}},"required":["mode","email"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["external_email"]},"email":{"type":"string","format":"email"},"message":{"type":"string","minLength":1,"maxLength":700}},"required":["mode","email","message"],"additionalProperties":false}]}},"required":["contract","schemaVersion","taskId","selectedAgentId","clientRequestId","operation","progress","nextProgressCursor","kind","state","result","browserExecution"],"additionalProperties":false},{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"kind":{"type":"string","enum":["direct_transfer"]},"taskId":{"type":"string","format":"uuid"},"selectedAgentId":{"type":"string","format":"uuid"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128},"operation":{"nullable":true},"result":{"nullable":true},"progress":{"type":"array","items":{"anyOf":[]},"minItems":0,"maxItems":0},"nextProgressCursor":{"type":"number","enum":[0]},"state":{"type":"string","enum":["waiting_for_user","external_pending","completed","failed"]},"requestUrl":{"type":"string","format":"uri"},"topUpUrl":{"type":"string","format":"uri"},"telegramTopUpUrl":{"type":"string","format":"uri"},"walletTransfer":{"type":"object","properties":{"status":{"type":"string","enum":["awaiting_approval","funding_required","pending","confirmed","reverted","expired","canceled"]},"recipient":{"type":"string","pattern":"^0x[0-9a-f]{40}$/iu"},"amountAtomic":{"type":"string"},"transactionHash":{"type":"string","nullable":true,"pattern":"^0x[0-9a-f]{64}$/u"}},"required":["status","recipient","amountAtomic","transactionHash"],"additionalProperties":false}},"required":["contract","schemaVersion","kind","taskId","selectedAgentId","clientRequestId","operation","result","progress","nextProgressCursor","state","walletTransfer"],"additionalProperties":false}]}}}},"400":{"description":"Invalid payment run","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"404":{"description":"Payment run not found","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"409":{"description":"Payment run conflict","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"502":{"description":"Payment evidence invalid","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}},"503":{"description":"Payment runtime unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.payment-run/v2"]},"schemaVersion":{"type":"string","enum":["2.0"]},"taskId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":1,"maxLength":128},"message":{"type":"string","minLength":1,"maxLength":512},"retryable":{"type":"boolean"},"action":{"type":"string","minLength":1,"maxLength":128},"operationCreated":{"type":"boolean","nullable":true},"operationId":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"fallbackAllowed":{"type":"boolean"},"requirementDiagnostic":{"type":"object","properties":{"reason":{"type":"string","enum":["invalid_header","invalid_body","unsupported_version","unsupported_transport","unsupported_transfer","required_capability_missing","conflicting_requirements","policy_rejected"]},"version":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"nullable":true}]},"transport":{"type":"string","enum":["payment-required","body"]},"field":{"type":"string","enum":["status","JSON","body","body.size","paymentRequired","paymentRequiredHeader","x402Version","resource","resource.url","resource.size","resource.description","resource.mimeType","resource.serviceName","resource.iconUrl","resource.tags","expiresAt","accepts","accepts.supported","accepts.extra.signingDomain","extensions","extensions.size","extensions.required","header_body.conflict"]}},"required":["reason","version","transport"],"additionalProperties":false},"nextAction":{"type":"string","enum":["fix_authentication","select_owned_agent","upgrade_aftercard","fund_account","wait_same_run","reconcile_same_operation","retry_same_run","none"]},"diagnosticId":{"type":"string","minLength":1,"maxLength":200},"ordinaryFieldRole":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"recovery":{"type":"object","properties":{"kind":{"type":"string","enum":["funding_required","service_unavailable","spend_policy_blocked","approval_required","approval_invalid","authentication_required","compatibility_required","retry_same_operation","reconciliation_required","merchant_declined","terminal_failure"]},"userTitle":{"type":"string","minLength":1,"maxLength":200},"userMessage":{"type":"string","minLength":1,"maxLength":1000},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["top_up"]},"href":{"type":"string","enum":["/top-up"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["email_support"]},"href":{"type":"string","enum":["mailto:support@nuncio.one"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_approval"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["review_limits"]},"href":{"type":"string","enum":["/settings/limits"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["view_status"]},"href":{"type":"string","enum":["/activity"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["reconnect_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["update_aftercard"]},"href":{"type":"string","enum":["/settings"]}},"required":["type","href"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"],"additionalProperties":false}]},"resumability":{"type":"string","enum":["resume_same_operation_after_funding","wait_same_run","reconcile_same_operation","fresh_approval_if_permitted","backend_directed","stop"]},"notificationPolicy":{"type":"string","enum":["none","post_approval_failure"]}},"required":["kind","userTitle","userMessage","action","resumability","notificationPolicy"],"additionalProperties":false}},"required":["contract","schemaVersion","code","message","retryable","action","operationCreated","fallbackAllowed","nextAction"],"additionalProperties":false}}}}}}},"/api/agent/identity":{"get":{"operationId":"getAgentIdentity","tags":["Core"],"summary":"Validate the current agent identity","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Authenticated agent identity","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"403":{"description":"Not an agent-scoped key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agent/me":{"get":{"operationId":"getAgentMe","tags":["Core"],"summary":"Get the current agent","security":[{"bearerAuth":[]}],"description":"Returns the profile and aggregate usage stats for the agent linked to the API key.","responses":{"200":{"description":"Agent info","content":{"application/json":{"example":{"id":"bc6a74cb-6ee7-49f2-a91e-0f5eaa6f3b8d","name":"Finance Automation Agent","description":"Handles recurring SaaS and infra payments.","email":"finance@agents.example","managed_email":{"status":"ready","email":"finance@agents.example","provider":"resend"},"status":"active","budget_limit":1000,"daily_limit":100,"transaction_limit":50,"created_at":"2026-02-20T10:00:00.000Z","stats":{"monthly_spend":312.45,"payment_operation_count_month":16,"active_subscriptions":4}},"schema":{"$ref":"#/components/schemas/AgentResponse"}}}},"403":{"description":"Not an agent-scoped key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Agent not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agent/revoke-key":{"post":{"operationId":"postAgentRevokeKey","tags":["Core"],"summary":"Revoke the calling API key","security":[{"bearerAuth":[]}],"description":"Permanently revokes the API key used to authenticate this request. Subsequent requests with the key fail with 401. An already-revoked key never reaches this handler, so callers should treat a 401 'API key has been revoked' on retry as success.","responses":{"200":{"description":"Key revoked","content":{"application/json":{"example":{"success":true,"status":"revoked"},"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["revoked"]}},"required":["success","status"]}}}},"403":{"description":"Not an API-key-authenticated request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/account/cards":{"get":{"operationId":"getAccountCards","tags":["Account"],"summary":"List MagicCards for the linked account","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Cards available to this Nuncio account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCardsResponse"}}}},"400":{"description":"Account is not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an agent-scoped key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/account/cards/balance":{"get":{"operationId":"getAccountCardsBalance","tags":["Account"],"summary":"Get MagicCard balance","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Optional provider card ID. Blank or omitted selects the default card."},"required":false,"description":"Optional provider card ID. Blank or omitted selects the default card.","name":"card_id","in":"query"}],"responses":{"200":{"description":"Current MagicCard balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCardBalanceResponse"}}}},"400":{"description":"Account is not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an agent-scoped key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/account/balance":{"get":{"operationId":"getAccountBalance","tags":["Account"],"summary":"Get MagicCard balance","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Optional provider card ID. Blank or omitted selects the default card."},"required":false,"description":"Optional provider card ID. Blank or omitted selects the default card.","name":"card_id","in":"query"}],"responses":{"200":{"description":"Current MagicCard balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCardBalanceResponse"}}}},"400":{"description":"Account is not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an agent-scoped key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/account/cards/transactions":{"get":{"operationId":"getAccountCardsTransactions","tags":["Account"],"summary":"List recent MagicCard transactions","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":10000,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"string","description":"Required for a signed-in user session; must match the scope of an agent API key."},"required":false,"description":"Required for a signed-in user session; must match the scope of an agent API key.","name":"agentId","in":"query"},{"schema":{"type":"string","description":"Optional provider card ID. Blank or omitted selects the default card."},"required":false,"description":"Optional provider card ID. Blank or omitted selects the default card.","name":"card_id","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Read transactions for the card bound to this owned payment task."},"required":false,"description":"Read transactions for the card bound to this owned payment task.","name":"taskId","in":"query"}],"responses":{"200":{"description":"Recent provider card transactions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCardTransactionsResponse"}}}},"400":{"description":"Invalid pagination or account is not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an agent-scoped key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/account/transactions":{"get":{"operationId":"getAccountTransactions","tags":["Account"],"summary":"List recent agent payment workflow transactions","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":10000,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"string","description":"Required for a signed-in user session; must match the scope of an agent API key."},"required":false,"description":"Required for a signed-in user session; must match the scope of an agent API key.","name":"agentId","in":"query"}],"responses":{"200":{"description":"Recent workflow transactions for the current agent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountTransactionsResponse"}}}},"400":{"description":"Invalid pagination","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Requested agent is unavailable to the authenticated caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/telegram/link-codes":{"post":{"operationId":"postTelegramLinkCodes","tags":["Account"],"summary":"Create a one-time Telegram link code for the signed-in user","description":"Returns a `start_param` for `https://t.me/<bot>?start=<start_param>`. The bot links the chat to this user without asking for the email OTP. Signed-in user sessions only.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramLinkCodeBody"}}}},"responses":{"200":{"description":"Telegram link code issued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramLinkCodeResponse"}}}},"403":{"description":"Agent API keys cannot link Telegram accounts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/chat/completions":{"post":{"operationId":"postV1ChatCompletions","tags":["LLM"],"summary":"Create a chat completion","security":[{"bearerAuth":[]}],"description":"OpenAI-compatible chat completions subset backed by the Nuncio LLM gateway.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}}},"responses":{"200":{"description":"Chat completion response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Provider rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Provider configuration error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Provider gateway error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tools/captcha/tasks":{"post":{"operationId":"postToolsCaptchaTasks","tags":["Tools"],"summary":"Create a CAPTCHA solving task","security":[{"bearerAuth":[]}],"description":"Starts a CAPTCHA task on the backend. Poll the returned `task_id` until the task becomes ready.","requestBody":{"required":true,"content":{"application/json":{"example":{"type":"hcaptcha","site_key":"10000000-ffff-ffff-ffff-000000000001","page_url":"https://checkout.example.com/pay"},"schema":{"$ref":"#/components/schemas/CaptchaTaskCreateRequest"}}}},"responses":{"200":{"description":"Captcha task created","content":{"application/json":{"example":{"provider":"capsolver","task_id":"task-123456","status":"pending"},"schema":{"$ref":"#/components/schemas/CaptchaTaskCreateResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Provider gateway error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tools/captcha/tasks/{id}":{"get":{"operationId":"getToolsCaptchaTasksById","tags":["Tools"],"summary":"Get a CAPTCHA task result","security":[{"bearerAuth":[]}],"description":"Polls the status of a previously created CAPTCHA task. When `status=ready`, use the returned token on the target site.","parameters":[{"schema":{"type":"string","minLength":1,"description":"Task identifier returned by POST /tools/captcha/tasks.","example":"task-123456"},"required":true,"description":"Task identifier returned by POST /tools/captcha/tasks.","name":"id","in":"path"}],"responses":{"200":{"description":"Captcha task status","content":{"application/json":{"examples":{"pending":{"value":{"provider":"capsolver","task_id":"task-123456","status":"pending"}},"ready":{"value":{"provider":"capsolver","task_id":"task-123456","status":"ready","token":"03AFcWeA7..."}}},"schema":{"$ref":"#/components/schemas/CaptchaTaskStatusResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Provider gateway error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/marketmap/search":{"post":{"operationId":"postMarketmapSearch","tags":["Tools"],"summary":"Find provider-method instructions by name or meaning","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketmapRequest"}}}},"responses":{"200":{"description":"Up to three provider-method instructions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketmapResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Provider-method search is temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tools/web-search":{"post":{"operationId":"postToolsWebSearch","tags":["Tools"],"summary":"Search the public web with Exa","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":2048,"description":"Specific natural-language public-web query."},"objective":{"type":"string","minLength":1,"maxLength":4096,"description":"Goal for this search turn: preferred sources, exclusions, and specific facts to retrieve. Use only public task details, never credentials or personal data."},"type":{"type":"string","enum":["auto","lite"],"default":"auto","description":"Use auto normally; lite serves cached content and cannot request freshness."},"numResults":{"type":"integer","minimum":1,"maximum":10,"default":5},"includeDomains":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"pattern":"^(?:\\*\\.)?[a-zA-Z0-9.-]+(?:\\/[^\\s?#]*)?$"},"minItems":1,"maxItems":20},"excludeDomains":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"pattern":"^(?:\\*\\.)?[a-zA-Z0-9.-]+(?:\\/[^\\s?#]*)?$"},"minItems":1,"maxItems":20},"startPublishedDate":{"type":"string","format":"date-time"},"endPublishedDate":{"type":"string","format":"date-time"},"category":{"type":"string","enum":["company","people","publication","news","personal site","financial report"]},"maxAgeHours":{"type":"integer","minimum":-1,"maximum":720}},"required":["query","objective"],"additionalProperties":false}}}},"responses":{"200":{"description":"Bounded source evidence and provider metadata","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["exa"]},"requestId":{"type":"string","maxLength":256},"results":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri"},"title":{"type":"string","maxLength":512},"publishedDate":{"type":"string","maxLength":64},"highlights":{"type":"array","items":{"type":"string"},"maxItems":20},"text":{"type":"string"},"truncated":{"type":"boolean"}},"required":["url","title","truncated"],"additionalProperties":false},"maxItems":10},"costDollars":{"type":"object","properties":{"total":{"type":"number","minimum":0}},"required":["total"],"additionalProperties":false},"searchTime":{"type":"number","minimum":0},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","maxLength":128},"path":{"type":"string","maxLength":256}},"required":["code","path"],"additionalProperties":false},"maxItems":10},"notices":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","maxLength":128},"path":{"type":"string","maxLength":256},"message":{"type":"string","maxLength":1024}},"required":["code","path","message"],"additionalProperties":false},"maxItems":10},"statuses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":2048},"status":{"type":"string","enum":["success","error"]},"source":{"type":"string","enum":["cached","crawled"]},"error":{"type":"object","properties":{"tag":{"type":"string","maxLength":128},"httpStatusCode":{"type":"integer","minimum":100,"maximum":599}},"required":["tag"],"additionalProperties":false}},"required":["id","status"],"additionalProperties":false},"maxItems":5}},"required":["provider","results"],"additionalProperties":false}}}},"400":{"description":"Invalid search parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Search allowance reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Search provider unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tools/web-contents":{"post":{"operationId":"postToolsWebContents","tags":["Tools"],"summary":"Read known public pages with Exa","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"urls":{"type":"array","items":{"type":"string","maxLength":2048,"format":"uri"},"minItems":1,"maxItems":5},"objective":{"type":"string","minLength":1,"maxLength":4096,"description":"Goal for this search turn: preferred sources, exclusions, and specific facts to retrieve. Use only public task details, never credentials or personal data."},"mode":{"type":"string","enum":["highlights","text"],"default":"highlights"},"maxAgeHours":{"type":"integer","minimum":-1,"maximum":720}},"required":["urls","objective"],"additionalProperties":false}}}},"responses":{"200":{"description":"Bounded source evidence and provider metadata","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["exa"]},"requestId":{"type":"string","maxLength":256},"results":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri"},"title":{"type":"string","maxLength":512},"publishedDate":{"type":"string","maxLength":64},"highlights":{"type":"array","items":{"type":"string"},"maxItems":20},"text":{"type":"string"},"truncated":{"type":"boolean"}},"required":["url","title","truncated"],"additionalProperties":false},"maxItems":10},"costDollars":{"type":"object","properties":{"total":{"type":"number","minimum":0}},"required":["total"],"additionalProperties":false},"searchTime":{"type":"number","minimum":0},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","maxLength":128},"path":{"type":"string","maxLength":256}},"required":["code","path"],"additionalProperties":false},"maxItems":10},"notices":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","maxLength":128},"path":{"type":"string","maxLength":256},"message":{"type":"string","maxLength":1024}},"required":["code","path","message"],"additionalProperties":false},"maxItems":10},"statuses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":2048},"status":{"type":"string","enum":["success","error"]},"source":{"type":"string","enum":["cached","crawled"]},"error":{"type":"object","properties":{"tag":{"type":"string","maxLength":128},"httpStatusCode":{"type":"integer","minimum":100,"maximum":599}},"required":["tag"],"additionalProperties":false}},"required":["id","status"],"additionalProperties":false},"maxItems":5}},"required":["provider","results"],"additionalProperties":false}}}},"400":{"description":"Invalid search parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Search allowance reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Search provider unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/public/v1/services":{"get":{"operationId":"getPublicV1Services","tags":["Directory"],"summary":"List or search sellers","description":"Open and key-less. Without `q`, the full enabled directory with filters and category facets. With `q`, the same natural-language search the signed-in tool runs, joined to each seller’s trust record. List items omit `guidance`; fetch a slug for it.","parameters":[{"schema":{"type":"string","description":"Natural-language need. Filters narrow candidates before exact-name or semantic ranking. Defaults to three matches; limit can request up to twenty. Search does not take an offset. Rate-limited per caller and by a daily allowance.","example":"find live hotel availability through a paid API"},"required":false,"description":"Natural-language need. Filters narrow candidates before exact-name or semantic ranking. Defaults to three matches; limit can request up to twenty. Search does not take an offset. Rate-limited per caller and by a daily allowance.","name":"q","in":"query"},{"schema":{"type":"string","enum":["inference","data","search","media","social","infrastructure","trading","travel","commerce","utilities"]},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","enum":["unknown","proceed","caution","avoid"]},"required":false,"name":"verdict","in":"query"},{"schema":{"type":"string","maxLength":128,"example":"x402"},"required":false,"name":"kind","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"payable","in":"query"},{"schema":{"type":"string","maxLength":253},"required":false,"name":"hostname","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"maximum":100000},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Reserved. The Verified badge does not exist yet; requests carrying this parameter are rejected. Use `verdict=proceed`."},"required":false,"description":"Reserved. The Verified badge does not exist yet; requests carrying this parameter are rejected. Use `verdict=proceed`.","name":"verified","in":"query"}],"responses":{"200":{"description":"Sellers with trust","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicServicesResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Search rate limit for this caller; retry after the given seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Search allowance exhausted or the directory is unavailable; the plain list may still work","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/public/v1/services/{slug}":{"get":{"operationId":"getPublicV1ServicesBySlug","tags":["Directory"],"summary":"One seller method, with guidance","parameters":[{"schema":{"type":"string","pattern":"^[a-z0-9-]{1,400}$/u","example":"payapi-weather-x402"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"The seller method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicListingDetail"}}}},"404":{"description":"Unknown slug","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"The directory is unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/public/v1/merchants/{hostname}":{"get":{"operationId":"getPublicV1MerchantsByHostname","tags":["Directory"],"summary":"Trust record for a seller hostname","description":"Cached trust only. An unknown hostname answers `unknown`; nothing is probed or written on this path.","parameters":[{"schema":{"type":"string","maxLength":253,"example":"api.example.com"},"required":true,"name":"hostname","in":"path"}],"responses":{"200":{"description":"The trust record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicMerchant"}}}},"400":{"description":"Invalid hostname","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"The directory is unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/merchants/check":{"post":{"operationId":"postMerchantsCheck","tags":["Tools"],"summary":"Check merchant trust by URL before paying","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantCheckRequest"}}}},"responses":{"200":{"description":"One advisory verdict per request. Internal failures yield unknown with check.state unavailable, never an error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantCheckResponse"}}}},"400":{"description":"Invalid request envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks":{"post":{"operationId":"postTasks","tags":["Tasks"],"summary":"Start a workflow task","security":[{"bearerAuth":[]}],"description":"Starts one active workflow task for the current agent. Browser metadata is optional and is attached through the `browser` binding when the runtime is actively connected to a browser.","parameters":[{"schema":{"type":"string"},"required":false,"name":"x-aftercard-capability-protocol","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-aftercard-client-name","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-aftercard-client-version","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-aftercard-client-build-id","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-aftercard-memory-catalog-schema","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-aftercard-memory-value-types","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskBody"}}}},"responses":{"200":{"description":"Existing task replayed with the same create key or hosted browser form binding","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}},"201":{"description":"Workflow task created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Agent scope required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Create key already bound to different task facts or agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/compute":{"get":{"operationId":"getTasksCompute","tags":["Tasks"],"summary":"Get owned task compute subtotals","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","maxLength":7400},"required":true,"name":"taskIds","in":"query"}],"responses":{"200":{"description":"Task compute subtotals and collection state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskComputeResponse"}}}},"400":{"description":"Invalid task ids","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}":{"get":{"operationId":"getTasksById","tags":["Tasks"],"summary":"Get task state","security":[{"bearerAuth":[]}],"description":"Returns the current state of a workflow task, including any active canonical request.","parameters":[{"schema":{"type":"string","format":"uuid","description":"Workflow task id.","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"description":"Workflow task id.","name":"id","in":"path"}],"responses":{"200":{"description":"Workflow task state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/surface":{"get":{"operationId":"getTasksByIdSurface","tags":["Tasks"],"summary":"Get the exact task surface","security":[{"bearerAuth":[]}],"description":"Returns one authenticated workflow task with its canonical runtime requests and ordered event timeline.","parameters":[{"schema":{"type":"string","format":"uuid","description":"Workflow task id.","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"description":"Workflow task id.","name":"id","in":"path"}],"responses":{"200":{"description":"Exact workflow task surface","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskSurface"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/payment-result":{"get":{"operationId":"getTasksByIdPaymentResult","tags":["Tasks"],"summary":"Get the latest payment attempt result","security":[{"bearerAuth":[]}],"description":"Returns a redacted payment attempt result linked to this workflow task from durable backend-owned evidence.","parameters":[{"schema":{"type":"string","format":"uuid","description":"Workflow task id.","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"description":"Workflow task id.","name":"id","in":"path"}],"responses":{"200":{"description":"Latest payment attempt result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskPaymentResult"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/subscription-enrollment":{"post":{"operationId":"postTasksByIdSubscriptionEnrollment","tags":["Tasks"],"summary":"Request zero-due subscription approval for user-completed enrollment","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Workflow task id.","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"description":"Workflow task id.","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionEnrollmentInput"}}}},"responses":{"200":{"description":"Exact subscription terms request; no payment or card grant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestEnvelope"}}}},"400":{"description":"Invalid enrollment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/complete":{"post":{"operationId":"postTasksByIdComplete","tags":["Tasks"],"summary":"Finish a task","security":[{"bearerAuth":[]}],"description":"Closes a task with a final status such as `completed`, `canceled`, or `error`. Use this when the run is over. The request is idempotent and fails if the task is still waiting for an unresolved canonical request.","parameters":[{"schema":{"type":"string","format":"uuid","description":"Workflow task id.","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"description":"Workflow task id.","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteTaskBody"}}}},"responses":{"200":{"description":"Workflow task closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEventResponse"}}}},"400":{"description":"Invalid task completion request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/events":{"post":{"operationId":"postTasksByIdEvents","tags":["Tasks"],"summary":"Send a task event","security":[{"bearerAuth":[]}],"description":"Use this endpoint to report progress updates, observations, actions, or errors for an active task. It records timeline entries and updates task state, but it does not finish the task.","parameters":[{"schema":{"type":"string","format":"uuid","description":"Workflow task id.","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"description":"Workflow task id.","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskEventBody"}}}},"responses":{"200":{"description":"Event accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEventResponse"}}}},"400":{"description":"Invalid task event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/protected-execution":{"get":{"operationId":"getTasksByIdProtectedExecution","tags":["Protected Execution"],"summary":"Read the value-free session-scoped protected execution state","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Current backend-owned protected execution state","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["snapshot"]},"sessionId":{"type":"string","format":"uuid"},"revision":{"type":"integer","minimum":0},"closeState":{"type":"string","enum":["open","closing","closed"]},"sessionStatus":{"type":"string","enum":["in_progress","waiting_for_user","error","canceled","completed"]},"latestFillGrant":{"type":"object","nullable":true,"properties":{"fillGrantRef":{"type":"string","format":"uuid"},"state":{"type":"string","enum":["prepared","envelope_issued","filled","fill_unknown","failed","expired","invalidated"]},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["fillGrantRef","state","expiresAt","createdAt"]},"latestFillReceipt":{"type":"object","nullable":true,"properties":{"fillReceiptRef":{"type":"string","format":"uuid"},"state":{"type":"string","enum":["active","consumed","failed","expired"]},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["fillReceiptRef","state","expiresAt","createdAt"]},"latestCommitAttempt":{"type":"object","nullable":true,"properties":{"commitAttemptRef":{"type":"string","format":"uuid"},"state":{"type":"string","enum":["staged","not_dispatched","dispatched","uncertain","cancel_requested","non_submission_confirmed","reconciled"]},"result":{"type":"string","nullable":true,"enum":["clicked","not_clicked","click_uncertain",null]},"stagedAt":{"type":"string","format":"date-time"},"browserResultAt":{"type":"string","nullable":true,"format":"date-time"},"reconciledAt":{"type":"string","nullable":true,"format":"date-time"},"valueFreeEvidence":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}}},"required":["commitAttemptRef","state","result","stagedAt","browserResultAt","reconciledAt","valueFreeEvidence"]}},"required":["kind","sessionId","revision","closeState","sessionStatus","latestFillGrant","latestFillReceipt","latestCommitAttempt"]}}}},"403":{"description":"Agent-scoped caller required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Protected-execution state unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/protected-fill-grants":{"post":{"operationId":"postTasksByIdProtectedFillGrants","tags":["Protected Execution"],"summary":"Prepare one backend-owned protected fill grant","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"},"pageIdentity":{"type":"object","additionalProperties":{"nullable":true}},"targetContract":{"type":"object","additionalProperties":{"nullable":true}},"contractDigest":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$/u"},"executorRef":{"type":"string","minLength":1,"maxLength":500},"executorPublicKey":{"type":"object","additionalProperties":{"nullable":true}}},"required":["expectedRevision","idempotencyKey","requestId","pageIdentity","targetContract","contractDigest","executorRef","executorPublicKey"],"additionalProperties":false},{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"approvalRequestId":{"type":"string","pattern":"^mpr_[0-9a-f]{64}$/u"},"paymentFactsDigest":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$/u"},"pageIdentity":{"type":"object","additionalProperties":{"nullable":true}},"targetContract":{"type":"object","additionalProperties":{"nullable":true}},"contractDigest":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$/u"},"executorRef":{"type":"string","minLength":1,"maxLength":500},"executorPublicKey":{"type":"object","additionalProperties":{"nullable":true}}},"required":["expectedRevision","idempotencyKey","approvalRequestId","paymentFactsDigest","pageIdentity","targetContract","contractDigest","executorRef","executorPublicKey"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Closed protected-execution transition result","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["prepared","envelope_issued","filled","staged","recorded","ready","reconciled","not_found","forbidden","session_not_active","revision_conflict","idempotency_conflict","approval_unavailable","reservation_unavailable","fill_recovery_required","state_conflict","expired","fill_unknown","proof_mismatch","facts_mismatch"]}},"required":["kind"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Invalid protected-execution contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Agent-scoped caller required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Protected-execution state unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/secret-fill-grants":{"post":{"operationId":"postTasksByIdSecretFillGrants","tags":["Protected Execution"],"summary":"Prepare one backend-owned sealed general-Secrets fill grant","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"itemRefs":{"type":"array","items":{"type":"object","properties":{"itemRef":{"type":"string","minLength":1,"maxLength":200},"contentRevision":{"type":"string","minLength":1,"maxLength":200},"fieldRefs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"minItems":1,"maxItems":32}},"required":["itemRef","contentRevision","fieldRefs"],"additionalProperties":false},"minItems":1,"maxItems":16},"pageIdentity":{"type":"object","additionalProperties":{"nullable":true}},"targetContract":{"type":"object","additionalProperties":{"nullable":true}},"contractDigest":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$/u"},"executorRef":{"type":"string","minLength":1,"maxLength":500},"executorPublicKey":{"type":"object","additionalProperties":{"nullable":true}},"requestId":{"type":"string","format":"uuid"}},"required":["expectedRevision","idempotencyKey","itemRefs","pageIdentity","targetContract","contractDigest","executorRef","executorPublicKey"]}}}},"responses":{"200":{"description":"Closed protected-execution transition result","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["prepared","envelope_issued","filled","staged","recorded","ready","reconciled","not_found","forbidden","session_not_active","revision_conflict","idempotency_conflict","approval_unavailable","reservation_unavailable","fill_recovery_required","state_conflict","expired","fill_unknown","proof_mismatch","facts_mismatch"]}},"required":["kind"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Invalid protected-execution contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Agent-scoped caller required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Protected-execution state unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/protected-fill-grants/{grantId}/receipts":{"post":{"operationId":"postTasksByIdProtectedFillGrantsByGrantIdReceipts","tags":["Protected Execution"],"summary":"Finalize one protected fill into a one-use receipt","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"grantId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"executionProof":{"type":"string","pattern":"^[A-Za-z0-9_-]{32,200}$/u"},"filledTargetIds":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"minItems":1,"maxItems":32},"verification":{"type":"object","additionalProperties":{"nullable":true}}},"required":["expectedRevision","idempotencyKey","executionProof","filledTargetIds","verification"]}}}},"responses":{"200":{"description":"Closed protected-execution transition result","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["prepared","envelope_issued","filled","staged","recorded","ready","reconciled","not_found","forbidden","session_not_active","revision_conflict","idempotency_conflict","approval_unavailable","reservation_unavailable","fill_recovery_required","state_conflict","expired","fill_unknown","proof_mismatch","facts_mismatch"]}},"required":["kind"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Invalid protected-execution contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Agent-scoped caller required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Protected-execution state unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/protected-commit-attempts":{"post":{"operationId":"postTasksByIdProtectedCommitAttempts","tags":["Protected Execution"],"summary":"Consume a fill receipt and stage one exact checkout commitment","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"fillReceiptRef":{"type":"string","format":"uuid"},"requestId":{"type":"string","format":"uuid"},"finalTargetContract":{"type":"object","additionalProperties":{"nullable":true}},"finalTargetDigest":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$/u"}},"required":["expectedRevision","idempotencyKey","fillReceiptRef","requestId","finalTargetContract","finalTargetDigest"],"additionalProperties":false},{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"fillReceiptRef":{"type":"string","format":"uuid"},"paymentFactsDigest":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$/u"},"finalTargetContract":{"type":"object","additionalProperties":{"nullable":true}},"finalTargetDigest":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$/u"}},"required":["expectedRevision","idempotencyKey","fillReceiptRef","paymentFactsDigest","finalTargetContract","finalTargetDigest"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Closed protected-execution transition result","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["prepared","envelope_issued","filled","staged","recorded","ready","reconciled","not_found","forbidden","session_not_active","revision_conflict","idempotency_conflict","approval_unavailable","reservation_unavailable","fill_recovery_required","state_conflict","expired","fill_unknown","proof_mismatch","facts_mismatch"]}},"required":["kind"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Invalid protected-execution contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Agent-scoped caller required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Protected-execution state unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/protected-commit-attempts/{attemptId}/result":{"post":{"operationId":"postTasksByIdProtectedCommitAttemptsByAttemptIdResult","tags":["Protected Execution"],"summary":"Record the value-free browser result for one staged commitment","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"attemptId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"result":{"type":"string","enum":["clicked","not_clicked","click_uncertain"]},"valueFreeEvidence":{"type":"object","additionalProperties":{"nullable":true}}},"required":["expectedRevision","idempotencyKey","result","valueFreeEvidence"]}}}},"responses":{"200":{"description":"Closed protected-execution transition result","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["prepared","envelope_issued","filled","staged","recorded","ready","reconciled","not_found","forbidden","session_not_active","revision_conflict","idempotency_conflict","approval_unavailable","reservation_unavailable","fill_recovery_required","state_conflict","expired","fill_unknown","proof_mismatch","facts_mismatch"]}},"required":["kind"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Invalid protected-execution contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Agent-scoped caller required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Protected-execution state unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/protected-commit-attempts/{attemptId}/non-submission":{"post":{"operationId":"postTasksByIdProtectedCommitAttemptsByAttemptIdNonSubmission","tags":["Protected Execution"],"summary":"Record visible merchant validation that prevented checkout submission","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"attemptId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"blocker":{"type":"object","properties":{"kind":{"type":"string","enum":["merchant_field_validation"]},"fieldRole":{"type":"string","enum":["email","billing_name","billing_address","phone","postal_code"]},"visibility":{"type":"string","enum":["visible"]}},"required":["kind","fieldRole","visibility"],"additionalProperties":false}},"required":["expectedRevision","idempotencyKey","blocker"]}}}},"responses":{"200":{"description":"Closed protected-execution transition result","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["prepared","envelope_issued","filled","staged","recorded","ready","reconciled","not_found","forbidden","session_not_active","revision_conflict","idempotency_conflict","approval_unavailable","reservation_unavailable","fill_recovery_required","state_conflict","expired","fill_unknown","proof_mismatch","facts_mismatch"]}},"required":["kind"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Invalid protected-execution contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Agent-scoped caller required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Protected-execution state unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/activity":{"get":{"operationId":"getActivity","tags":["Activity"],"summary":"List recent user activity","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["true"]},"required":false,"name":"page","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"beforeAt","in":"query"},{"schema":{"type":"string","pattern":"^(session|top_up|agent_usage):[A-Za-z0-9_-]{1,128}$"},"required":false,"name":"beforeId","in":"query"}],"responses":{"200":{"description":"Recent tasks, completed top-ups and settled chat usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Activity query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/transactions":{"get":{"operationId":"listTransactions","tags":["Activity"],"summary":"List every recorded movement of the user’s money, newest first","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"beforeAt","in":"query"},{"schema":{"type":"string","pattern":"^[a-z_0-9]{1,24}:[A-Za-z0-9_-]{1,128}$"},"required":false,"name":"beforeId","in":"query"}],"responses":{"200":{"description":"Top-ups, compute, x402, crypto sends and card charges","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WalletTransaction"}},"nextCursor":{"type":"object","nullable":true,"properties":{"occurredAt":{"type":"string"},"id":{"type":"string"}},"required":["occurredAt","id"]}},"required":["items","nextCursor"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Transactions query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/requests":{"post":{"operationId":"postTasksByIdRequests","tags":["Tasks"],"summary":"Create a canonical runtime request","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["classification_v1"]},"required":false,"name":"memory_response","in":"query"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRuntimeRequestBody"}}}},"responses":{"200":{"description":"Request created or reused","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RuntimeRequestEnvelope"},{"type":"object","properties":{"kind":{"type":"string","enum":["ready"]},"sessionId":{"type":"string","format":"uuid"},"requestId":{"type":"string","format":"uuid"},"valueVisibility":{"type":"string","enum":["model_visible_form"]},"containsProtected":{"type":"boolean"},"values":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","enum":["saved_memory"]},"itemId":{"type":"string","format":"uuid"},"fieldId":{"type":"string","format":"uuid"},"fieldKey":{"type":"string","minLength":1},"groupRef":{"type":"string","minLength":1},"targetRef":{"type":"string","minLength":1},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"phoneTargets":{"type":"array","items":{"type":"object","properties":{"targetRef":{"type":"string","minLength":1},"projection":{"type":"string","enum":["full","national","calling_code","country"]},"value":{"type":"string","minLength":1},"mappingRequired":{"type":"boolean","enum":[true]}},"required":["targetRef","projection"],"additionalProperties":false},"maxItems":4},"phoneParts":{"type":"object","properties":{"fullPhone":{"type":"string","maxLength":32},"countryCode":{"type":"string","maxLength":5},"phone":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2}},"required":["fullPhone","countryCode","phone"],"additionalProperties":false}},"required":["source","itemId","fieldId","fieldKey","value"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","enum":["provided_for_request"]},"targetRef":{"type":"string","minLength":1},"groupRef":{"type":"string","minLength":1},"templateKey":{"type":"string","minLength":1},"templateFieldKey":{"type":"string","minLength":1},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"phoneTargets":{"type":"array","items":{"type":"object","properties":{"targetRef":{"type":"string","minLength":1},"projection":{"type":"string","enum":["full","national","calling_code","country"]},"value":{"type":"string","minLength":1},"mappingRequired":{"type":"boolean","enum":[true]}},"required":["targetRef","projection"],"additionalProperties":false},"maxItems":4},"phoneParts":{"type":"object","properties":{"fullPhone":{"type":"string","maxLength":32},"countryCode":{"type":"string","maxLength":5},"phone":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2}},"required":["fullPhone","countryCode","phone"],"additionalProperties":false}},"required":["source","targetRef","groupRef","templateKey","templateFieldKey","value"],"additionalProperties":false}]}},"targetBindings":{"type":"array","items":{"type":"object","properties":{"targetRef":{"type":"string","minLength":1},"itemId":{"type":"string","format":"uuid"},"fieldId":{"type":"string","format":"uuid"},"groupRef":{"type":"string","minLength":1}},"required":["targetRef","itemId","fieldId"],"additionalProperties":false}}},"required":["kind","sessionId","requestId","valueVisibility","values"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["request_required","protected_fill_required","fallback_required","stale_footprint"]},"sessionId":{"type":"string","format":"uuid"},"requestId":{"type":"string","format":"uuid"},"reason":{"type":"string","minLength":1},"choices":{"type":"array","items":{"type":"object","properties":{"choiceId":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"description":{"type":"string"}},"required":["choiceId","label"],"additionalProperties":false}},"saveGuidance":{"type":"string","minLength":1},"missingFields":{"type":"array","items":{"type":"object","properties":{"fieldKey":{"type":"string","minLength":1,"maxLength":512},"label":{"type":"string","minLength":1,"maxLength":512},"groupRef":{"type":"string","minLength":1,"maxLength":512}},"required":["fieldKey","label"],"additionalProperties":false},"minItems":1,"maxItems":100}},"required":["kind","sessionId"],"additionalProperties":false}]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"get":{"operationId":"getTasksByIdRequests","tags":["Tasks"],"summary":"List canonical requests for a session","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Session requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestList"}}}}}}},"/api/tasks/{id}/requests/{requestId}":{"get":{"operationId":"getTasksByIdRequestsByRequestId","tags":["Tasks"],"summary":"Get a canonical runtime request snapshot","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"responses":{"200":{"description":"Request snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestEnvelope"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/requests/{requestId}/resume-authorization":{"post":{"operationId":"postTasksByIdRequestsByRequestIdResumeAuthorization","tags":["Tasks"],"summary":"Resume the exact approved payment-card authorization when due","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"responses":{"200":{"description":"Current request snapshot after one bounded recovery attempt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestEnvelope"}}}},"400":{"description":"Request is not eligible for payment-card recovery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Request or session not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/requests/{requestId}/decisions":{"post":{"operationId":"postTasksByIdRequestsByRequestIdDecisions","tags":["Tasks"],"summary":"Submit a runtime request decision","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestDecisionBody"}}}},"responses":{"200":{"description":"Updated request snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestEnvelope"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/requests/{requestId}/confirm-otp":{"post":{"operationId":"postTasksByIdRequestsByRequestIdConfirmOtp","tags":["Tasks"],"summary":"Confirm a runtime request with OTP","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestConfirmOtpBody"}}}},"responses":{"200":{"description":"Updated request snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestEnvelope"}}}},"400":{"description":"Invalid, ineligible, or already resolved request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Request or OTP approval not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"OTP attempts exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/requests/{requestId}/claim":{"post":{"operationId":"postTasksByIdRequestsByRequestIdClaim","tags":["Tasks"],"summary":"Claim a request artifact","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"responses":{"200":{"description":"Claimed artifact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeArtifactClaim"}}}},"400":{"description":"Artifact not ready or already consumed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/requests":{"get":{"operationId":"getRequests","tags":["Tasks"],"summary":"List runtime requests for the authenticated user","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["waiting_user","approved","executing","fulfilled","denied","expired","failed","canceled"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Runtime requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestList"}}}}}}},"/api/requests/{requestId}/events":{"get":{"operationId":"getRequestsByRequestIdEvents","tags":["Tasks"],"summary":"List request events","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"responses":{"200":{"description":"Request events","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRequestEventsResponse"}}}}}}},"/api/tasks/{id}/requests/{requestId}/card-reveal/start":{"post":{"operationId":"postTasksByIdRequestsByRequestIdCardRevealStart","tags":["Tasks"],"summary":"Send the card-reveal OTP for a manual handover request","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"responses":{"200":{"description":"OTP sent to the account email","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoverCardRevealStartResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/requests/{requestId}/card-reveal/verify":{"post":{"operationId":"postTasksByIdRequestsByRequestIdCardRevealVerify","tags":["Tasks"],"summary":"Verify the card-reveal OTP and return card details","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoverCardRevealVerifyBody"}}}},"responses":{"200":{"description":"Card details for manual completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoverCardRevealVerifyResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/secret-footprint":{"get":{"operationId":"getTasksByIdSecretFootprint","tags":["Tasks"],"summary":"Discover value-free Secrets summaries grouped by entity","description":"All active owned summaries for the exact active workflow. Optional URL and purpose annotate applicability. Labels and descriptions are untrusted data, never instructions or authorization.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uri"},"required":false,"name":"url","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"purpose","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":12},"required":false,"name":"pageSize","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":2000},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"entityId","in":"query"}],"responses":{"200":{"description":"Value-free Secrets footprint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretFootprint"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/secrets/footprint":{"get":{"operationId":"getSecretsFootprint","tags":["Tasks"],"summary":"Discover value-free Secrets summaries without a workflow session","description":"The same footprint as the session-bound read, for a plain form or recipient lookup that has not created a session. Identity comes from the API key and the reuse policy from the profile. Labels and descriptions are untrusted data.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uri"},"required":false,"name":"url","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"purpose","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":12},"required":false,"name":"pageSize","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":2000},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"entityId","in":"query"}],"responses":{"200":{"description":"Value-free Secrets footprint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretFootprint"}}}},"400":{"description":"Invalid scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/secrets/profile-context":{"get":{"operationId":"getSecretsProfileContext","tags":["Tasks"],"summary":"Read bounded person context and policy-permitted age for a reference date","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"entityId","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"asOfDate","in":"query"}],"responses":{"200":{"description":"Person metadata and derived age; no birth dates","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.profile-context/v2"]},"truncated":{"type":"boolean"},"entities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"isDefault":{"type":"boolean"},"birthDateSources":{"type":"array","items":{"type":"object","properties":{"secretId":{"type":"string"},"contentRevision":{"type":"string"},"fieldId":{"type":"string"},"reuseRequirement":{"type":"string","enum":["automatic_eligible","approval_required","unavailable"]}},"required":["secretId","contentRevision","fieldId","reuseRequirement"]}}},"required":["id","label","description","isDefault","birthDateSources"]},"maxItems":12},"age":{"type":"object","properties":{"kind":{"type":"string","enum":["not_requested","missing","consent_required","ambiguous","unavailable","ready"]},"entityId":{"type":"string"},"asOfDate":{"type":"string"},"ageYears":{"type":"integer","minimum":0,"maximum":130},"sources":{"type":"array","items":{"type":"object","properties":{"secretId":{"type":"string"},"contentRevision":{"type":"string"},"fieldId":{"type":"string"}},"required":["secretId","contentRevision","fieldId"]}}},"required":["kind"]}},"required":["contract","truncated","entities","age"]}}}}}}},"/api/secrets":{"get":{"operationId":"getSecrets","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["active","archived"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"url","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"allSites","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"entityId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"templateKey","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","enum":["typed"]},"required":false,"name":"projection","in":"query"}],"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"valueVisibility":{"type":"string","enum":["metadata_only"]},"secrets":{"type":"array","items":{"$ref":"#/components/schemas/Secret"}},"reviewRequiredSecrets":{"type":"array","items":{"$ref":"#/components/schemas/SecretReviewSummary"}},"reviewRequiredCount":{"type":"number"}},"required":["valueVisibility","secrets","reviewRequiredSecrets"],"additionalProperties":false}}}}}},"post":{"operationId":"postSecrets","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSecretBody"}}}},"responses":{"201":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"anyOf":[{"$ref":"#/components/schemas/Secret"},{"$ref":"#/components/schemas/SecretReviewSummary"}]}},"required":["secret"],"additionalProperties":false}}}}}}},"/api/secrets/save":{"post":{"operationId":"postSecretsSave","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entityId":{"type":"string","nullable":true},"templateKey":{"type":"string","minLength":1},"templateVersion":{"type":"integer","minimum":0,"exclusiveMinimum":true},"expectedRevision":{"type":"string","minLength":1},"label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"resource":{"type":"object","nullable":true,"properties":{"kind":{"type":"string","enum":["site","service"]},"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}},"required":["kind","key","label"],"additionalProperties":false},"askBeforeUse":{"type":"boolean"},"status":{"type":"string","enum":["active","archived"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/SecretFieldInput"},"minItems":1,"maxItems":64},"entityResolutionVersion":{"type":"number","enum":[1]},"newEntity":{"nullable":true},"clientRequestId":{"type":"string","minLength":1,"maxLength":128},"secretId":{"type":"string","format":"uuid"}},"required":["fields","clientRequestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"type":"string","enum":["aftercard.memory-save/v2"]},"outcome":{"type":"string","enum":["created","updated","replayed"]},"secretId":{"type":"string","format":"uuid"},"entityId":{"type":"string","format":"uuid"},"label":{"type":"string"},"entityLabel":{"type":"string"},"entityResolution":{"type":"string","enum":["requested","created","default","secret"]},"revision":{"type":"string","minLength":1},"savedFields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"}},"required":["key","label"],"additionalProperties":false}}},"required":["contract","outcome","secretId","entityId","label","entityLabel","revision","savedFields"],"additionalProperties":false}}}},"400":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}},"required":["code"],"additionalProperties":{"nullable":true}}},"required":["error"]}}}},"409":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}},"required":["code"],"additionalProperties":{"nullable":true}}},"required":["error"]}}}},"422":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}},"required":["code"],"additionalProperties":{"nullable":true}}},"required":["error"]}}}}}}},"/api/secrets/{secretId}/for-edit":{"get":{"operationId":"getSecretsBySecretIdForEdit","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"secretId","in":"path"}],"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"valueVisibility":{"type":"string","enum":["editor_values"]},"secret":{"anyOf":[{"$ref":"#/components/schemas/Secret"},{"$ref":"#/components/schemas/SecretReviewSummary"}]},"fields":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true}]}},"phoneParts":{"type":"object","additionalProperties":{"nullable":true}}},"required":["valueVisibility","secret","fields"],"additionalProperties":false}}}}}}},"/api/secrets/{secretId}":{"get":{"operationId":"getSecretsBySecretId","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"secretId","in":"path"}],"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"anyOf":[{"$ref":"#/components/schemas/Secret"},{"$ref":"#/components/schemas/SecretReviewSummary"}]}},"required":["secret"],"additionalProperties":false}}}}}},"patch":{"operationId":"patchSecretsBySecretId","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"secretId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entityId":{"type":"string","format":"uuid"},"templateKey":{"type":"string","minLength":1},"templateVersion":{"type":"integer","minimum":0,"exclusiveMinimum":true},"expectedRevision":{"type":"string","minLength":1},"label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"resource":{"type":"object","nullable":true,"properties":{"kind":{"type":"string","enum":["site","service"]},"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}},"required":["kind","key","label"],"additionalProperties":false},"askBeforeUse":{"type":"boolean"},"status":{"type":"string","enum":["active","archived"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/SecretFieldInput"},"maxItems":64}},"required":["expectedRevision"],"additionalProperties":false}}}},"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"anyOf":[{"$ref":"#/components/schemas/Secret"},{"$ref":"#/components/schemas/SecretReviewSummary"}]},"createdNewSecret":{"type":"boolean","enum":[false]}},"required":["secret","createdNewSecret"],"additionalProperties":false}}}}}},"delete":{"operationId":"deleteSecretsBySecretId","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"secretId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"expectedRevision","in":"query"}],"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"anyOf":[{"$ref":"#/components/schemas/Secret"},{"$ref":"#/components/schemas/SecretReviewSummary"}]}},"required":["secret"],"additionalProperties":false}}}}}}},"/api/secret-policy/evaluate":{"post":{"operationId":"postSecretPolicyEvaluate","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"secretRef":{"type":"string"},"overrides":{"type":"object","additionalProperties":{"nullable":true}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"policyLevel":{"type":"string"},"askBeforeUse":{"type":"boolean"},"createdRuntimeRequest":{"type":"boolean","enum":[false]},"evaluationOrder":{"type":"array","items":{"type":"string"}}},"required":["policyLevel","askBeforeUse","createdRuntimeRequest","evaluationOrder"],"additionalProperties":false}}}}}}},"/api/secret-entities":{"get":{"operationId":"getSecretEntities","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["true"]},"required":false,"name":"includeArchived","in":"query"}],"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"entities":{"type":"array","items":{"$ref":"#/components/schemas/SecretEntity"}}},"required":["entities"]}}}}}},"post":{"operationId":"postSecretEntities","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["person","organization"]},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["type","name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"entity":{"$ref":"#/components/schemas/SecretEntity"}},"required":["entity"]}}}}}}},"/api/secret-entities/{id}":{"get":{"operationId":"getSecretEntitiesById","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"entity":{"$ref":"#/components/schemas/SecretEntity"}},"required":["entity"]}}}}}},"patch":{"operationId":"patchSecretEntitiesById","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"status":{"type":"string","enum":["archived","deleted"]}},"required":["expectedRevision"],"additionalProperties":false}}}},"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"entity":{"$ref":"#/components/schemas/SecretEntity"}},"required":["entity"]}}}}}}},"/api/secret-templates":{"get":{"operationId":"getSecretTemplates","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Value-free Secrets metadata","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"version":{"type":"number"},"label":{"type":"string"},"defaultDescription":{"type":"string"},"allowedEntityTypes":{"type":"array","items":{"type":"string","enum":["person","organization"]}},"resource":{"type":"string","enum":["required","optional","forbidden"]},"userCreatable":{"type":"boolean"},"countryField":{"type":"string"},"countryLayouts":{"type":"object","properties":{"generic":{"type":"object","properties":{"label":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"label":{"type":"string"},"hint":{"type":"string"}},"required":["key"]}}},"required":["label","fields"]},"variants":{"type":"object","additionalProperties":{"type":"object","properties":{"label":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"label":{"type":"string"},"hint":{"type":"string"}},"required":["key"]}}},"required":["label","fields"]}}},"required":["generic","variants"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"valueType":{"type":"string"},"control":{"type":"string"},"required":{"type":"boolean"},"sensitivity":{"type":"string","enum":["ordinary","protected","provider_managed"]},"autocomplete":{"type":"string"},"hint":{"type":"string"},"countries":{"type":"array","items":{"type":"string","minLength":2,"maxLength":2}},"options":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"}},"required":["key","label"]}}},"required":["key","label","valueType","control","required","sensitivity"]}},"type":{"type":"string"}},"required":["key","version","label","defaultDescription","allowedEntityTypes","resource","userCreatable","fields","type"]}}},"required":["templates"]}}}}}}},"/api/tasks/{id}/secret-catalog":{"get":{"operationId":"getTasksByIdSecretCatalog","tags":["Tasks"],"summary":"List value-free Nuncio Secrets handles for a session","description":"Returns handles-only Secrets descriptors for an active workflow session. Provider-backed payment cards are advertised as `unavailable` with `availability.status: \"authorization_required\"` until `authorize_payment` succeeds for that session; card field handles are returned only after that approval.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"url","in":"query"},{"schema":{"type":"string"},"required":false,"name":"purpose","in":"query"},{"schema":{"type":"string"},"required":false,"name":"subjectHint","in":"query"}],"responses":{"200":{"description":"Value-free Secrets catalog","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretCatalogResponse"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/secret-materializations":{"post":{"operationId":"postTasksByIdSecretMaterializations","tags":["Tasks"],"summary":"Materialize exact revision-bound ordinary Secrets fields","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["classification_v1"]},"required":false,"name":"memory_response","in":"query"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clientRequestId":{"type":"string","minLength":1,"maxLength":4096},"footprintRevision":{"type":"string","minLength":1,"maxLength":512},"url":{"type":"string","maxLength":8192,"format":"uri"},"purpose":{"type":"string","minLength":1,"maxLength":2048},"selections":{"type":"array","items":{"type":"object","properties":{"expectedRevision":{"type":"string","minLength":1,"maxLength":512},"requestedFields":{"type":"array","items":{"type":"object","properties":{"fieldId":{"type":"string","format":"uuid"},"fieldKey":{"type":"string","minLength":1,"maxLength":120}},"required":["fieldId","fieldKey"],"additionalProperties":false},"minItems":1,"maxItems":100},"groupRef":{"type":"string","minLength":1,"maxLength":512},"secretId":{"type":"string","format":"uuid"}},"required":["expectedRevision","requestedFields","secretId"],"additionalProperties":false},"minItems":1,"maxItems":100},"entityBindings":{"type":"array","items":{"type":"object","properties":{"groupRef":{"type":"string","minLength":1,"maxLength":512},"entityId":{"type":"string","format":"uuid"}},"required":["groupRef","entityId"],"additionalProperties":false},"maxItems":100}},"required":["clientRequestId","footprintRevision","url","purpose","selections","entityBindings"],"additionalProperties":false}}}},"responses":{"200":{"description":"Exact batch outcome","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}}}}},"/api/tasks/{id}/secret-value-materializations":{"post":{"operationId":"postTasksByIdSecretValueMaterializations","tags":["Tasks"],"summary":"Materialize Nuncio Secrets handles for trusted apply-fill","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretMaterializationBody"}}}},"responses":{"200":{"description":"Runtime-only materialized values for trusted executors","content":{"application/json":{"schema":{"type":"object","properties":{"valueVisibility":{"type":"string","enum":["runtime_only"]},"values":{"type":"array","items":{"type":"object","properties":{"handle":{"type":"string"},"status":{"type":"string","enum":["ready","missing","conflict","provider_unavailable","provider_needs_reauth","not_materializable"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true}]},"text":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true}]},"reason":{"type":"string"}},"required":["handle","status"],"additionalProperties":{"nullable":true}}}},"required":["valueVisibility","values"],"additionalProperties":false}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/requests/{requestId}/approved-checkout-values":{"get":{"operationId":"getTasksByIdRequestsByRequestIdApprovedCheckoutValues","tags":["Tasks"],"summary":"Return approval-bound ordinary checkout values to the agent model","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"requestId","in":"path"}],"responses":{"200":{"description":"Approved model-visible ordinary checkout values","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["approved_checkout_values"]},"sessionId":{"type":"string","format":"uuid"},"requestId":{"type":"string","format":"uuid"},"valueVisibility":{"type":"string","enum":["model_visible_checkout"]},"values":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["email","billing_name","country","billing_address","billing_city","billing_region","phone","postal_code"]},"value":{"type":"string"}},"required":["role","value"],"additionalProperties":false}}},"required":["kind","sessionId","requestId","valueVisibility","values"]}}}},"404":{"description":"Session or request not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/trust-rules":{"get":{"operationId":"getTrustRules","tags":["Tasks"],"summary":"List canonical trust rules","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Visible trust rules","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustRuleList"}}}}}},"post":{"operationId":"postTrustRules","tags":["Tasks"],"summary":"Create a trust rule","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTrustRuleBody"}}}},"responses":{"200":{"description":"Created trust rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustRule"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/trust-rules/{id}":{"patch":{"operationId":"patchTrustRulesById","tags":["Tasks"],"summary":"Patch a trust rule","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchTrustRuleBody"}}}},"responses":{"200":{"description":"Updated trust rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustRule"}}}}}}},"/api/trust-rules/{id}/pause":{"post":{"operationId":"postTrustRulesByIdPause","tags":["Tasks"],"summary":"Pause a trust rule","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Paused trust rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustRule"}}}}}}},"/api/trust-rules/{id}/activate":{"post":{"operationId":"postTrustRulesByIdActivate","tags":["Tasks"],"summary":"Activate a trust rule","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Activated trust rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustRule"}}}}}}},"/api/auto-approves":{"get":{"operationId":"getAutoApproves","tags":["Tasks"],"summary":"List an Agent’s active Auto-Approves","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"agent_id","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"forceFunctionRegion","in":"query"}],"responses":{"200":{"description":"Active Auto-Approves","content":{"application/json":{"schema":{"type":"object","properties":{"auto_approves":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agent_id":{"type":"string","format":"uuid"},"counterparty_label":{"type":"string","minLength":1},"source_rail":{"type":"string","enum":["x402","card","direct_transfer"]},"budgetAtomic":{"type":"string","pattern":"^(0|[1-9][0-9]{0,37})$/u"},"usedAtomic":{"type":"string","pattern":"^(0|[1-9][0-9]{0,37})$/u"},"scale":{"type":"number","enum":[6]},"status":{"type":"string","enum":["active","exhausted"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","agent_id","counterparty_label","source_rail","budgetAtomic","usedAtomic","scale","status","created_at","updated_at"],"additionalProperties":false}}},"required":["auto_approves"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/auto-approves/{id}":{"patch":{"operationId":"patchAutoApprovesById","tags":["Tasks"],"summary":"Change an Auto-Approve budget cap","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"budgetAtomic":{"type":"string","pattern":"^(0|[1-9][0-9]{0,37})$/u"}},"required":["budgetAtomic"],"additionalProperties":false}}}},"responses":{"200":{"description":"Updated Auto-Approve","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"budgetAtomic":{"type":"string","pattern":"^(0|[1-9][0-9]{0,37})$/u"},"usedAtomic":{"type":"string","pattern":"^(0|[1-9][0-9]{0,37})$/u"},"status":{"type":"string","enum":["active","exhausted"]}},"required":["id","budgetAtomic","usedAtomic","status"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"operationId":"deleteAutoApprovesById","tags":["Tasks"],"summary":"Delete an Auto-Approve","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted Auto-Approve","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/observability/telemetry/traces":{"post":{"operationId":"postObservabilityTelemetryTraces","tags":["Observability"],"summary":"Ingest OTLP traces","security":[{"bearerAuth":[]}],"description":"Accepts OTLP/HTTP JSON traces for workflow observability. This route uses the same bearer API key model as other agent-facing API routes. Product session routes do not accept raw telemetry payloads.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelemetryTraceIngestBody"}}}},"responses":{"202":{"description":"Telemetry payload accepted for ingest","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelemetryTraceIngestResponse"}}}},"400":{"description":"Invalid OTLP payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelemetryTraceIngestError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelemetryTraceIngestError"}}}},"500":{"description":"Failed to write telemetry index rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelemetryTraceIngestError"}}}},"502":{"description":"Failed to forward traces to downstream OTLP sink","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelemetryTraceIngestError"}}}}}}},"/api/notification-preferences":{"get":{"operationId":"getNotificationPreferences","tags":["Core"],"summary":"Get notification preferences","security":[{"bearerAuth":[]}],"description":"Returns effective notification delivery preferences and channel availability for every supported event.","responses":{"200":{"description":"Notification preferences","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationPreferencesResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"operationId":"putNotificationPreferences","tags":["Core"],"summary":"Update a notification preference","security":[{"bearerAuth":[]}],"description":"Toggle one external delivery channel for one notification event.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNotificationPreferenceBody"}}}},"responses":{"200":{"description":"Preference updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNotificationPreferenceResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tasks/{id}/hosted-links":{"post":{"operationId":"postTasksByIdHostedLinks","tags":["Tasks"],"summary":"Create a hosted Nuncio action link","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostedLinkCreateBody"}}}},"responses":{"200":{"description":"Hosted link created or reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostedLinkCreateResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Session ownership or agent scope mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Session or request not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/hosted-links/exchange":{"post":{"operationId":"postHostedLinksExchange","tags":["Tasks"],"summary":"Exchange a hosted Nuncio action link","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostedLinkExchangeBody"}}}},"responses":{"200":{"description":"Hosted link exchange result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostedLinkExchangeResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid hosted link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Link belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many exchange attempts from this caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/subscriptions/{id}/details":{"patch":{"operationId":"patchSubscriptionsByIdDetails","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"summary":"Update current observed subscription details","parameters":[{"schema":{"type":"string","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedUpdatedAt":{"type":"string","format":"date-time"},"serviceName":{"type":"string","minLength":1,"maxLength":300},"serviceUrl":{"type":"string","nullable":true,"maxLength":2048,"format":"uri"},"planLabel":{"type":"string","nullable":true,"minLength":1,"maxLength":300},"billingTerms":{"type":"array","nullable":true,"items":{"type":"string","minLength":1,"maxLength":4000},"maxItems":50},"subscriptionDetails":{"type":"object","properties":{"recurringAmount":{"type":"number","nullable":true,"minimum":0},"recurringCurrency":{"type":"string","nullable":true,"pattern":"^[A-Za-z]{3}$"},"recurringAmountKind":{"type":"string","enum":["fixed","variable","unknown"]},"interval":{"type":"string","nullable":true,"minLength":1,"maxLength":100},"intervalUnit":{"type":"string","nullable":true,"enum":["day","week","month","year",null]},"intervalCount":{"type":"integer","nullable":true,"minimum":1,"maximum":1200},"trialEndAt":{"type":"string","nullable":true,"format":"date-time"},"introductoryPeriod":{"type":"object","nullable":true,"properties":{"count":{"type":"integer","minimum":1,"maximum":1200},"unit":{"type":"string","enum":["day","week","month","year"]}},"required":["count","unit"],"additionalProperties":false},"nextRenewalAt":{"type":"string","nullable":true,"format":"date-time"},"expiresAt":{"type":"string","nullable":true,"format":"date-time"},"serviceLogoUrl":{"type":"string","nullable":true},"cancellationUrl":{"type":"string","nullable":true,"maxLength":2048,"format":"uri"},"cancellationHint":{"type":"string","nullable":true,"minLength":1,"maxLength":4000},"estimatedRenewalUsd":{"type":"number","nullable":true,"minimum":0}},"additionalProperties":false}},"required":["expectedUpdatedAt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Updated subscription observation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionEnvelope"}}}},"404":{"description":"Subscription not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Subscription changed; reread before updating","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/subscriptions/{id}/cancellation-history":{"get":{"operationId":"getSubscriptionsByIdCancellationHistory","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"summary":"Read cancellation history and current support-mail references","parameters":[{"schema":{"type":"string","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","pattern":"^[1-9][0-9]*$"},"required":false,"name":"before","in":"query"}],"responses":{"200":{"description":"Cancellation history","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sequence":{"type":"string"},"source":{"type":"string","enum":["agent","email","system"]},"progress":{"type":"string"},"details":{"type":"object","properties":{"url":{"type":"string"},"hint":{"type":"string"},"progress":{"type":"string","enum":["pending","cancelled","already_cancelled","needs_user","unsuccessful","awaiting_provider","reply_received"]},"note":{"type":"string"},"evidence":{"type":"string","maxLength":4000},"observedAt":{"type":"string","format":"date-time"},"sourceUrl":{"type":"string","maxLength":2000,"format":"uri"},"nextAction":{"type":"string","maxLength":1000},"nextCheckAt":{"type":"string","nullable":true,"format":"date-time"},"supportContact":{"type":"string","maxLength":500},"supportDraft":{"type":"string","maxLength":4000},"supportSendId":{"type":"string","nullable":true,"format":"uuid"},"supportMessageId":{"type":"string","nullable":true,"format":"uuid"},"revision":{"type":"integer"},"updatedAt":{"type":"string"},"startedAt":{"type":"string"},"renewalUnconfirmed":{"type":"boolean"},"followUpStopped":{"type":"boolean"}}},"createdAt":{"type":"string"}},"required":["id","sequence","source","progress","details","createdAt"]}},"nextCursor":{"type":"string","nullable":true},"emailThreadId":{"type":"string","nullable":true},"sendState":{"type":"string","nullable":true},"deliveryStatus":{"type":"string","nullable":true}},"required":["events","nextCursor","emailThreadId","sendState","deliveryStatus"]}}}}}}},"/api/subscriptions/{id}/support-email":{"get":{"operationId":"getSubscriptionsByIdSupportEmail","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"summary":"Read the linked merchant support correspondence","parameters":[{"schema":{"type":"string","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":2000},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Existing mailbox conversation","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"threadId":{"type":"string","format":"uuid"},"direction":{"type":"string","enum":["inbound","outbound"]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"type":"string","nullable":true},"truncated":{"type":"boolean"},"hydrationState":{"type":"string","enum":["pending","processing","ready","unavailable"]},"createdAt":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","properties":{"documentId":{"type":"string","format":"uuid"},"filename":{"type":"string"},"byteSize":{"type":"integer"},"mediaType":{"type":"string","enum":["application/pdf"]}},"required":["documentId","filename","byteSize","mediaType"]}},"inReplyToEmailMessageId":{"type":"string","nullable":true}},"required":["id","threadId","direction","from","to","cc","bcc","subject","text","truncated","hydrationState","createdAt","attachments","inReplyToEmailMessageId"]}},"nextCursor":{"type":"string","nullable":true}},"required":["id","messages","nextCursor"]}}}}}}},"/api/subscriptions/{id}/invoices":{"get":{"operationId":"getSubscriptionsByIdInvoices","tags":["Subscriptions"],"summary":"Read original invoices and hosted links associated with an owned subscription","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stored invoice evidence, independent of settlement","content":{"application/json":{"schema":{"type":"object","properties":{"subscriptionId":{"type":"string","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"taskId":{"type":"string","nullable":true,"format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"invoices":{"type":"array","items":{"type":"object","properties":{"receiptUrl":{"type":"string","maxLength":4096},"documentId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["resend","agentmail","chat_upload"]},"original":{"type":"object","properties":{"status":{"type":"string","enum":["pending","stored","unavailable","failed"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","enum":["application/pdf"]},"href":{"type":"string","minLength":1,"maxLength":512}},"required":["status"],"additionalProperties":false},"extraction":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","ready","partial","failed","unsupported"]},"facts":{"type":"object","properties":{"documentKind":{"type":"string","enum":["invoice","receipt","other","unknown"]},"merchantName":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"merchantDomain":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"invoiceNumber":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"orderReference":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"issuedAt":{"type":"string","nullable":true,"minLength":1,"maxLength":64},"currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$/u"},"subtotal":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"tax":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":512},"quantity":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"unitPrice":{"type":"string","nullable":true,"minLength":1,"maxLength":128},"total":{"type":"string","nullable":true,"minLength":1,"maxLength":128}},"required":["description","quantity","unitPrice","total"],"additionalProperties":false},"maxItems":100},"summary":{"type":"string","nullable":true,"minLength":1,"maxLength":2000},"partial":{"type":"boolean"},"truncated":{"type":"boolean"},"provenance":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":128},"page":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"maximum":1000},"source":{"type":"string","enum":["pdf","email"]}},"required":["field","page","source"],"additionalProperties":false},"maxItems":500}},"required":["documentKind","merchantName","merchantDomain","invoiceNumber","orderReference","issuedAt","currency","subtotal","total","tax","lineItems","summary","partial","truncated","provenance"],"additionalProperties":false},"model":{"type":"string","minLength":1,"maxLength":255},"processedAt":{"type":"string","format":"date-time"}},"required":["status"],"additionalProperties":false},"associationStatus":{"type":"string","enum":["awaiting","bound","conflict"]},"conflict":{"type":"string","minLength":1,"maxLength":512},"receivedAt":{"type":"string","format":"date-time"}},"required":["original","extraction","associationStatus"],"additionalProperties":false},"maxItems":101},"truncated":{"type":"boolean"}},"required":["subscriptionId","taskId","invoices","truncated"],"additionalProperties":false}}}},"404":{"description":"Subscription unavailable"},"503":{"description":"Invoice evidence temporarily unavailable"}}}},"/api/subscriptions":{"get":{"operationId":"getSubscriptions","tags":["Subscriptions"],"summary":"List managed subscriptions","security":[{"bearerAuth":[]}],"description":"Returns managed subscription records visible to the current API key scope, including lifecycle status, source links, terms evidence, versioned terms hash, and backend capability flags.","parameters":[{"schema":{"$ref":"#/components/schemas/SubscriptionLifecycleStatus"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"agentId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"subscriptionId","in":"query"}],"responses":{"200":{"description":"Managed subscription list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionListResponse"}}}}}}},"/api/subscriptions/{id}":{"get":{"operationId":"getSubscriptionsById","tags":["Subscriptions"],"summary":"Get one managed subscription","security":[{"bearerAuth":[]}],"description":"Returns one managed subscription visible to the current API key scope.","parameters":[{"schema":{"type":"string","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Managed subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionEnvelope"}}}},"404":{"description":"Subscription not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/subscriptions/{id}/cancel":{"post":{"operationId":"postSubscriptionsByIdCancel","tags":["Subscriptions"],"summary":"Prepare cancellation or record the agent result","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"outcome":{"type":"string","enum":["pending","cancelled","already_cancelled","needs_user","unsuccessful","awaiting_provider","reply_received"]},"expiresAt":{"nullable":true},"note":{"type":"string","maxLength":4000},"evidence":{"type":"string","maxLength":4000},"observedAt":{"type":"string","format":"date-time"},"sourceUrl":{"type":"string","maxLength":2000,"format":"uri"},"nextAction":{"type":"string","maxLength":1000},"nextCheckAt":{"type":"string","nullable":true,"format":"date-time"},"supportContact":{"type":"string","maxLength":500},"supportDraft":{"type":"string","maxLength":4000},"supportSendId":{"type":"string","nullable":true,"format":"uuid"},"supportMessageId":{"type":"string","nullable":true,"format":"uuid"},"autoRenews":{"type":"boolean"},"expectedRevision":{"type":"integer","minimum":0},"clientRequestId":{"type":"string","minLength":1,"maxLength":200},"stopFollowUp":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Cancellation instructions or recorded result","content":{"application/json":{"schema":{"type":"object","properties":{"subscription":{"$ref":"#/components/schemas/ManagedSubscription"},"nextAction":{"type":"string","enum":["unsubscribe_in_browser","done","needs_user","unsuccessful","await_provider","read_provider_reply"]},"instruction":{"type":"string"}},"required":["subscription","nextAction","instruction"]}}}},"404":{"description":"Subscription not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/setup/start":{"post":{"operationId":"postSetupStart","tags":["Setup"],"summary":"Start agentic Nuncio setup","description":"Starts a public email OTP challenge for agent-driven Nuncio onboarding. Verification is required before a user, agent, or API key is created.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupStartBody"}}}},"responses":{"200":{"description":"Setup challenge created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupStartResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many setup attempts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/setup/verify":{"post":{"operationId":"postSetupVerify","tags":["Setup"],"summary":"Verify agentic Nuncio setup","description":"Verifies the setup OTP, creates or reuses the user bootstrap agent, and returns one Nuncio API key for the agent to persist locally.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupVerifyBody"}}}},"responses":{"200":{"description":"Setup verified","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupVerifyResponse"}}}},"400":{"description":"Invalid or expired challenge","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid OTP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/dashboard/overview":{"get":{"operationId":"getDashboardOverview","tags":["Account"],"summary":"Read the canonical Nuncio overview","description":"Returns balance and effective spend derived only from ULC V1, plus non-accounting dashboard labels.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Canonical ULC V1 dashboard overview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardOverview"}}}},"500":{"description":"Dashboard projection failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}