{"openapi":"3.0.3","info":{"title":"AffixIO v1 API","description":"The payment and trust layer for autonomous systems.","version":"1.0.0","contact":{"name":"AffixIO","url":"https://affix-io.com"}},"servers":[{"url":"https://api.affix-io.com/v1","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key or Authorization: Bearer <key>"}},"schemas":{"Agent":{"type":"object","properties":{"id":{"type":"string","example":"agt_xxx"},"name":{"type":"string"},"type":{"type":"string","enum":["llm","workflow","robot-controller","service"]},"status":{"type":"string","enum":["active","suspended","revoked"]},"createdAt":{"type":"string","format":"date-time"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}},"VerifyRequest":{"type":"object","required":["circuit_id","identifier"],"properties":{"circuit_id":{"type":"string","example":"agentic-payment-permission"},"identifier":{"type":"string","description":"Subject identifier, such as agent:abc123 or account id"},"context":{"type":"object","additionalProperties":true}}},"VerifyResponse":{"type":"object","properties":{"eligible":{"type":"boolean"},"proof":{"type":"string","description":"Stable proof identifier or hash for audit"},"circuit_id":{"type":"string"},"latency_ms":{"type":"number"},"logged":{"type":"boolean"},"meta":{"type":"object","additionalProperties":true}}}}},"paths":{"/health":{"get":{"summary":"Health check","security":[],"responses":{"200":{"description":"OK"},"503":{"description":"Service degraded"}}}},"/agents":{"post":{"summary":"Create agent","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","type","ownerOrgId"],"properties":{"name":{"type":"string"},"type":{"type":"string","enum":["llm","workflow","robot-controller","service"]},"ownerOrgId":{"type":"string"},"metadata":{"type":"object"}}}}}},"responses":{"201":{"description":"Created"},"400":{"description":"Bad request"}}}},"/agents/{agentId}":{"get":{"summary":"Get agent","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}},"patch":{"summary":"Update agent","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/devices":{"post":{"summary":"Create device","responses":{"201":{"description":"Created"},"400":{"description":"Bad request"}}}},"/devices/{deviceId}":{"get":{"summary":"Get device","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/delegations":{"post":{"summary":"Create delegation","responses":{"201":{"description":"Created"},"422":{"description":"Validation error"}}}},"/delegations/{delegationId}":{"get":{"summary":"Get delegation","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/delegations/{delegationId}/revoke":{"post":{"summary":"Revoke delegation","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/delegations/{delegationId}/verify":{"post":{"summary":"Verify delegation","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/trust/check":{"post":{"summary":"Trust decision","responses":{"200":{"description":"OK"}}}},"/trust/policies":{"post":{"summary":"Create trust policy","responses":{"201":{"description":"Created"}}}},"/trust/policies/{policyId}":{"get":{"summary":"Get trust policy","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/trust/policies/{policyId}/evaluate":{"post":{"summary":"Evaluate policy","responses":{"200":{"description":"OK"}}}},"/payment-intents":{"post":{"summary":"Create payment intent","responses":{"201":{"description":"Created"},"400":{"description":"Bad request"}}}},"/payment-intents/{paymentIntentId}":{"get":{"summary":"Get payment intent","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/payment-intents/{paymentIntentId}/authorise":{"post":{"summary":"Authorise intent","responses":{"200":{"description":"OK"},"404":{"description":"Not found"},"409":{"description":"Wrong state"}}}},"/payment-intents/{paymentIntentId}/capture":{"post":{"summary":"Capture intent","responses":{"200":{"description":"OK"},"404":{"description":"Not found"},"409":{"description":"Wrong state"}}}},"/payment-intents/{paymentIntentId}/cancel":{"post":{"summary":"Cancel intent","responses":{"200":{"description":"OK"},"404":{"description":"Not found"},"409":{"description":"Wrong state"}}}},"/payments":{"post":{"summary":"Create payment","responses":{"201":{"description":"Created"},"409":{"description":"Trust check failed"}}}},"/payments/{paymentId}":{"get":{"summary":"Get payment","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/payments/{paymentId}/refund":{"post":{"summary":"Refund payment","responses":{"200":{"description":"OK"},"404":{"description":"Not found"},"409":{"description":"Wrong state"}}}},"/payments/{paymentId}/reverse":{"post":{"summary":"Reverse payment","responses":{"200":{"description":"OK"},"404":{"description":"Not found"},"409":{"description":"Wrong state"}}}},"/orgs":{"post":{"summary":"Create organisation","responses":{"201":{"description":"Created"}}}},"/api-keys":{"post":{"summary":"Create API key","responses":{"201":{"description":"Created"}}}},"/api-keys/{keyId}/revoke":{"post":{"summary":"Revoke API key","responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/metrics":{"get":{"summary":"Platform metrics","responses":{"200":{"description":"OK"}}}},"/rate-limits":{"get":{"summary":"Rate limit info","responses":{"200":{"description":"OK"}}}},"/nior/policy/decide":{"post":{"summary":"Policy Engine (PDP)","description":"Policy decision point: location, device, merchant rule, user eligibility, spending limits. Returns allow/deny/review; merchant makes final decision.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"attemptId":{"type":"string"},"location":{"type":"object"},"device":{"type":"object"},"merchantRuleId":{"type":"string"},"userEligibility":{"type":"object"},"spendingLimits":{"type":"object"},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"Policy result (allow/deny/review)","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"enum":["allow","deny","review"]},"reasons":{"type":"array","items":{"type":"string"}},"decisionId":{"type":"string"},"timestamp":{"type":"string"}}}}}}}}},"/nior/offline-trust/score":{"post":{"summary":"Offline Trust Scoring","description":"Terminal risk, device integrity, pattern anomaly, offline fraud signals. Returns safeToProceed and score.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string"},"terminalId":{"type":"string"},"transaction":{"type":"object"},"signals":{"type":"object"},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"Trust score and safeToProceed","content":{"application/json":{"schema":{"type":"object","properties":{"safeToProceed":{"type":"boolean"},"score":{"type":"number"},"reasons":{"type":"array","items":{"type":"string"}},"evaluationId":{"type":"string"},"timestamp":{"type":"string"}}}}}}}}},"/nior/proofs/query":{"post":{"summary":"Privacy-Preserving Proofs","description":"Yes/No only: over_18, eligible_benefit, belongs_to_group, verified_previously. No personal data returned.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["proofType"],"properties":{"proofType":{"enum":["over_18","eligible_benefit","belongs_to_group","verified_previously","age_range","residency","custom"]},"subjectId":{"type":"string"},"claimRef":{"type":"string"},"threshold":{"type":"number"},"groupId":{"type":"string"},"customPredicate":{"type":"string"},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"Result (true/false), claim, proofId","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"boolean"},"proofType":{"type":"string"},"claim":{"type":"string"},"proofId":{"type":"string"},"timestamp":{"type":"string"}}}}}}}}},"/nior/terminal/capabilities":{"get":{"summary":"List terminal capabilities","description":"Eligibility checks, offline rules, merchant policy, secure device verification.","responses":{"200":{"description":"List of capability definitions"}}}},"/nior/terminal/capabilities/check":{"post":{"summary":"Terminal Capability Check","description":"Check if device supports requested capabilities.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["deviceId"],"properties":{"deviceId":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"merchantId":{"type":"string"},"action":{"type":"string"},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"supported, capabilities map","content":{"application/json":{"schema":{"type":"object","properties":{"supported":{"type":"boolean"},"capabilities":{"type":"object"},"deviceId":{"type":"string"},"message":{"type":"string"},"timestamp":{"type":"string"}}}}}}}}},"/nior/agent/permission":{"post":{"summary":"Agent Permission Layer","description":"Permission gate for agents: is payment allowed? merchant trusted? user eligible? rule satisfied? Returns YES/NO.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["agentId","action"],"properties":{"agentId":{"type":"string"},"action":{"enum":["payment","refund","subscription","eligibility_check","custom"]},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"allowed (YES/NO), checks, reasons","content":{"application/json":{"schema":{"type":"object","properties":{"allowed":{"enum":["YES","NO"]},"checks":{"type":"object"},"reasons":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string"}}}}}}}}},"/nior/rules":{"get":{"summary":"List merchant rules","description":"Installable eligibility modules (org + platform).","responses":{"200":{"description":"rules array"}}},"post":{"summary":"Create merchant rule","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","slug"],"properties":{"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"config":{"type":"object"}}}}}},"responses":{"201":{"description":"Created rule"}}}},"/nior/rules/{ruleId}/evaluate":{"post":{"summary":"Evaluate merchant rule","description":"Run rule module (student_discount, benefits_acceptance, location_based, loyalty_eligibility).","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["context"],"properties":{"context":{"type":"object"},"subjectId":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"},"location":{"type":"object"}}}}}},"responses":{"200":{"description":"eligible/not_eligible, reasons","content":{"application/json":{"schema":{"type":"object","properties":{"eligible":{"enum":["eligible","not_eligible"]},"ruleId":{"type":"string"},"reasons":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string"}}}}}}}}},"/nior/compliance/check":{"post":{"summary":"Offline Compliance Check","description":"Merchant-run: age restricted, sanctions, region, device trust. Returns eligible/not_eligible only.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string"},"checks":{"type":"object"},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"eligible/not_eligible, checks, reasons","content":{"application/json":{"schema":{"type":"object","properties":{"eligible":{"enum":["eligible","not_eligible"]},"checks":{"type":"object"},"reasons":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string"}}}}}}}}},"/circuits":{"get":{"summary":"List available circuits","description":"Returns all registered circuits with metadata and pricing, suitable for UI discovery.","responses":{"200":{"description":"List of circuits","content":{"application/json":{"schema":{"type":"object","properties":{"circuits":{"type":"array","items":{"type":"object"}},"count":{"type":"number"},"timestamp":{"type":"string"}}}}}}}}},"/circuits/{circuitId}":{"get":{"summary":"Get a single circuit definition","description":"Returns metadata and pricing for a specific circuit id.","parameters":[{"name":"circuitId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Circuit definition"},"404":{"description":"Circuit not found"}}}},"/verify":{"post":{"summary":"Generic verification endpoint","description":"Evaluate a verification request against a named circuit (for example agentic-payment-permission, finance-account-standing, finance-fraud-indicator, cross-mfa-verification). Returns a binary eligible decision and proof reference.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResponse"}}}},"400":{"description":"Validation error"}}}}}}