{"openapi":"3.1.0","info":{"title":"Octoriq Router API","version":"0.1.0"},"servers":[{"url":"https://api.octoriq.ai"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API key: ax_test_... (development) or ax_live_... (production)."}},"schemas":{"Health":{"type":"object","properties":{"status":{"type":"string","const":"ok"}},"required":["status"],"additionalProperties":false},"ListJobsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","classifying","planning","routing","executing","waiting_approval","verifying","rerouting","completed","failed","cancelled"]},"capability":{"type":["string","null"]},"goal":{"type":"string"},"route":{"anyOf":[{"type":"object","properties":{"steps":{"type":"array","items":{"type":"string"}},"reroute_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rerouted_from":{"type":"array","items":{"type":"string"}}},"required":["steps","reroute_count","rerouted_from"],"additionalProperties":false},{"type":"null"}]},"customer_cost_usd":{"type":"number"},"duration_ms":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["id","status","capability","goal","route","customer_cost_usd","duration_ms","created_at"],"additionalProperties":false}},"next_cursor":{"type":["string","null"]}},"required":["data","next_cursor"],"additionalProperties":false},"Problem":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"code":{"type":"string","enum":["invalid_request","unauthorized","forbidden","not_found","rate_limited","budget_exceeded","insufficient_credits","capability_unavailable","provider_error","verification_failed","job_not_cancellable","job_not_completed","conflict","internal_error"]},"detail":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"],"additionalProperties":false}}},"required":["type","title","status","code","request_id"],"additionalProperties":false},"CreateJobRequest":{"type":"object","properties":{"goal":{"type":"string"},"capability":{"type":"string","maxLength":100,"pattern":"^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"},"constraints":{"default":{},"type":"object","properties":{"max_cost_usd":{"type":"number","exclusiveMinimum":0,"maximum":100},"max_latency_seconds":{"type":"integer","minimum":5,"maximum":900},"quality":{"type":"string","enum":["fast","balanced","high"]},"privacy":{"type":"string","enum":["standard","restricted"]},"region":{"type":"string","enum":["eu","us"]}},"additionalProperties":false},"output":{"default":{"type":"json"},"type":"object","properties":{"type":{"type":"string","const":"json"},"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type"],"additionalProperties":false},"context":{"type":"object","properties":{"refs":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":2048}}},"additionalProperties":false},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["goal"],"additionalProperties":false},"JobAccepted":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","classifying","planning","routing","executing","waiting_approval","verifying","rerouting","completed","failed","cancelled"]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"links":{"type":"object","properties":{"self":{"type":"string"},"events":{"type":"string"}},"required":["self","events"],"additionalProperties":false}},"required":["id","status","created_at","links"],"additionalProperties":false},"JobStats":{"type":"object","properties":{"window":{"type":"string","enum":["24h","7d","all"]},"counts":{"type":"object","properties":{"all":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"running":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"waiting_approval":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rerouted":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"completed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"cancelled":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["all","running","waiting_approval","rerouted","completed","failed","cancelled"],"additionalProperties":false},"success_rate":{"type":["number","null"]},"verification_pass_rate":{"type":["number","null"]},"avg_customer_cost_usd":{"type":["number","null"]},"p95_duration_ms":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["window","counts","success_rate","verification_pass_rate","avg_customer_cost_usd","p95_duration_ms"],"additionalProperties":false},"ListJobExecutionsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"step":{"type":"string"},"executor":{"type":"string"},"provider":{"type":"string"},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string","enum":["succeeded","failed","cancelled"]},"latency_ms":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"provider_request_id":{"type":["string","null"]},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"retryable":{"type":"boolean"}},"required":["code","retryable"],"additionalProperties":false},{"type":"null"}]},"provider_cost_usd":{"type":["number","null"]},"output":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["id","step","executor","provider","attempt","status","latency_ms","provider_request_id","error","provider_cost_usd","output","created_at"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false},"Job":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","classifying","planning","routing","executing","waiting_approval","verifying","rerouting","completed","failed","cancelled"]},"capability":{"type":["string","null"]},"goal":{"type":"string"},"constraints":{"type":"object","properties":{"max_cost_usd":{"type":["number","null"]},"max_latency_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"quality":{"type":"string","enum":["fast","balanced","high"]},"privacy":{"type":"string","enum":["standard","restricted"]},"region":{"anyOf":[{"type":"string","enum":["eu","us"]},{"type":"null"}]}},"required":["max_cost_usd","max_latency_seconds","quality","privacy","region"],"additionalProperties":false},"output":{"type":"object","properties":{"type":{"type":"string","const":"json"},"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type"],"additionalProperties":false},"input":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"approval":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"job_id":{"type":"string"},"capability":{"type":"string"},"risk_class":{"type":"string","enum":["read","write","destructive","financial"]},"status":{"type":"string","enum":["pending","approved","rejected","expired"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payload_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"requested_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"decided_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},{"type":"null"}]},"decision_reason":{"type":["string","null"]}},"required":["id","job_id","capability","risk_class","status","payload","payload_hash","version","requested_at","expires_at","decided_at","decision_reason"],"additionalProperties":false},{"type":"null"}]},"result":{"anyOf":[{},{"type":"null"}]},"citations":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"}},"required":["url"],"additionalProperties":false}},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false},{"type":"null"}]},"route":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"strategy":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}},"reroute_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reroutes":{"type":"array","items":{"type":"object","properties":{"reason":{"type":"string"},"from_executor":{"type":"string"},"to_executor":{"type":"string"},"failed_checks":{"type":"array","items":{"type":"string"}},"detail":{"type":"string"},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["reason","from_executor","to_executor","at"],"additionalProperties":false}}},"required":["id","strategy","steps","reroute_count","reroutes"],"additionalProperties":false},{"type":"null"}]},"usage":{"type":"object","properties":{"provider_cost_usd":{"type":"number"},"platform_fee_usd":{"type":"number"},"customer_cost_usd":{"type":"number"},"cost_complete":{"type":"boolean"},"duration_ms":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["provider_cost_usd","platform_fee_usd","customer_cost_usd","cost_complete","duration_ms"],"additionalProperties":false},"verification":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["passed","failed"]},"verifier":{"type":"string"},"version":{"type":"string"},"checks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["passed","failed","skipped"]},"detail":{"type":"string"}},"required":["id","status","detail"],"additionalProperties":false}}},"required":["status","verifier","version","checks"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"completed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},{"type":"null"}]},"links":{"type":"object","properties":{"self":{"type":"string"},"events":{"type":"string"}},"required":["self","events"],"additionalProperties":false}},"required":["id","status","capability","goal","constraints","output","input","approval","result","citations","error","route","usage","verification","created_at","updated_at","completed_at","links"],"additionalProperties":false},"JobEvent":{"type":"object","properties":{"id":{"type":"string"},"job_id":{"type":"string"},"seq":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"type":{"type":"string","enum":["job.created","job.status","route.selected","execution.started","execution.completed","execution.failed","job.rerouted","verification.completed","cost.recorded","job.completed","job.failed","job.cancelled","approval.requested"]},"status":{"type":"string","enum":["queued","classifying","planning","routing","executing","waiting_approval","verifying","rerouting","completed","failed","cancelled"]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["id","job_id","seq","type","status","data","created_at"],"additionalProperties":false},"JobFeedbackRequest":{"type":"object","properties":{"outcome":{"type":"string","enum":["accepted","partially_accepted","rejected"]},"reason":{"type":"string","minLength":1,"maxLength":1000}},"required":["outcome"],"additionalProperties":false},"JobFeedback":{"type":"object","properties":{"job_id":{"type":"string"},"outcome":{"type":"string","enum":["accepted","partially_accepted","rejected"]},"reason":{"type":["string","null"]},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["job_id","outcome","reason","updated_at"],"additionalProperties":false},"RouteExperimentsResponse":{"type":"object","properties":{"thresholds":{"type":"object","properties":{"min_samples":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"min_success_rate":{"type":"number"},"max_success_drop":{"type":"number"}},"required":["min_samples","min_success_rate","max_success_drop"],"additionalProperties":false},"data":{"type":"array","items":{"type":"object","properties":{"shadow_route_id":{"type":"string"},"samples":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"primary_success_rate":{"type":["number","null"]},"shadow_success_rate":{"type":["number","null"]},"avg_shadow_provider_cost_usd":{"type":["number","null"]},"avg_primary_provider_cost_usd":{"type":["number","null"]},"shadow_latency_p50_ms":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"promotion":{"type":"object","properties":{"eligible":{"type":"boolean"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["eligible","reasons"],"additionalProperties":false}},"required":["shadow_route_id","samples","primary_success_rate","shadow_success_rate","avg_shadow_provider_cost_usd","avg_primary_provider_cost_usd","shadow_latency_p50_ms","promotion"],"additionalProperties":false}}},"required":["thresholds","data"],"additionalProperties":false},"BillingResponse":{"type":"object","properties":{"balance_usd":{"type":"number"},"reserved_usd":{"type":"number"},"available_usd":{"type":"number"},"enforced":{"type":"boolean"},"purchasable":{"type":"boolean"},"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["topup","debit","refund","dispute","dispute_reversal"]},"amount_usd":{"type":"number"},"job_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["id","kind","amount_usd","job_id","created_at"],"additionalProperties":false}}},"required":["balance_usd","reserved_usd","available_usd","enforced","purchasable","entries"],"additionalProperties":false},"ReconciliationResponse":{"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"totals":{"type":"object","properties":{"topups_usd":{"type":"number"},"clawbacks_usd":{"type":"number"},"provider_cost_usd":{"type":"number"},"customer_cost_usd":{"type":"number"},"debited_usd":{"type":"number"},"margin_usd":{"type":"number"},"unreconciled_jobs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["topups_usd","clawbacks_usd","provider_cost_usd","customer_cost_usd","debited_usd","margin_usd","unreconciled_jobs"],"additionalProperties":false},"jobs":{"type":"array","items":{"type":"object","properties":{"job_id":{"type":"string"},"environment":{"type":"string"},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"provider_cost_usd":{"type":"number"},"billable_provider_usd":{"type":"number"},"platform_fee_usd":{"type":"number"},"customer_cost_usd":{"type":"number"},"debited_usd":{"type":"number"},"unknown_cost_events":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reconciled":{"type":"boolean"}},"required":["job_id","environment","completed_at","provider_cost_usd","billable_provider_usd","platform_fee_usd","customer_cost_usd","debited_usd","unknown_cost_events","reconciled"],"additionalProperties":false}},"truncated":{"type":"boolean"}},"required":["from","to","totals","jobs","truncated"],"additionalProperties":false},"AgentRankResponse":{"type":"object","properties":{"min_samples":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"data":{"type":"array","items":{"type":"object","properties":{"capability":{"type":"string"},"step":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"executor_id":{"type":"string"},"rank":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"score":{"type":"number"},"uncertain":{"type":"boolean"},"samples":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"success_rate":{"type":["number","null"]},"success_basis":{"type":"string","enum":["verification","execution"]},"jobs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"attempts_succeeded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"verifications":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"verifications_passed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reroutes_from":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reroutes_recovered":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"jobs_completed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"feedback":{"type":"object","properties":{"accepted":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"partially_accepted":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rejected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["accepted","partially_accepted","rejected"],"additionalProperties":false},"latency_ms":{"type":"object","properties":{"p50":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"p95":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["p50","p95"],"additionalProperties":false},"avg_provider_cost_usd":{"type":["number","null"]}},"required":["executor_id","rank","score","uncertain","samples","success_rate","success_basis","jobs","attempts","attempts_succeeded","verifications","verifications_passed","reroutes_from","reroutes_recovered","jobs_completed","feedback","latency_ms","avg_provider_cost_usd"],"additionalProperties":false}}},"required":["capability","step","candidates"],"additionalProperties":false}}},"required":["min_samples","data"],"additionalProperties":false}}},"paths":{"/health":{"get":{"summary":"Liveness","security":[],"responses":{"200":{"description":"Process is up","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/v1/jobs":{"get":{"summary":"List jobs (newest first)","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"parameters":[{"name":"filter","in":"query","required":false,"schema":{"type":"string","enum":["all","running","waiting_approval","rerouted","completed","failed","cancelled"],"default":"all"}},{"name":"capability","in":"query","required":false,"schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor from the previous page","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"One page of jobs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListJobsResponse"}}}},"400":{"description":"invalid_request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"forbidden (missing scope)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"summary":"Submit a goal","security":[{"apiKey":[]}],"x-required-scopes":["jobs:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Repeating a request with the same key returns the original job; reusing it with a different body is 409.","schema":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateJobRequest"}}}},"responses":{"202":{"description":"Job accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobAccepted"}}}},"400":{"description":"invalid_request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"insufficient_credits (BILLING_MODE=credits)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"forbidden (missing scope)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"conflict (Idempotency-Key reused with a different body)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"capability_unavailable","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/jobs/stats":{"get":{"summary":"Job aggregates over a window","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"parameters":[{"name":"window","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","all"],"default":"24h"}}],"responses":{"200":{"description":"Counts, success and verification rates, cost, P95 latency","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStats"}}}},"400":{"description":"invalid_request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/jobs/{id}/executions":{"get":{"summary":"Executor calls of a job (steps, attempts, cost, normalized errors)","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Job id (job_...)","schema":{"type":"string"}}],"responses":{"200":{"description":"Executions, oldest first","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListJobExecutionsResponse"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"not_found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/jobs/{id}":{"get":{"summary":"Get a job","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Job id (job_...)","schema":{"type":"string"}}],"responses":{"200":{"description":"Job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"forbidden (missing scope)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"not_found (including other tenants and other environments)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/jobs/{id}/events":{"get":{"summary":"Stream job events (Server-Sent Events)","description":"Each message: `id` = seq, `event` = type, `data` = JobEvent JSON. Replays every event with seq > Last-Event-ID exactly once, then streams live; the server ends the stream after job.completed, job.failed or job.cancelled.","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Job id (job_...)","schema":{"type":"string"}},{"name":"Last-Event-ID","in":"header","required":false,"description":"Last seq the client received; omit to start from the beginning.","schema":{"type":"string","pattern":"^\\d{1,9}$"}}],"responses":{"200":{"description":"Event stream","content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/JobEvent"}}}},"400":{"description":"invalid_request (bad Last-Event-ID)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"forbidden (missing scope)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"not_found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/jobs/{id}/cancel":{"post":{"summary":"Request cancellation (idempotent; job reaches cancelled asynchronously)","security":[{"apiKey":[]}],"x-required-scopes":["jobs:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Job id (job_...)","schema":{"type":"string"}}],"responses":{"202":{"description":"Cancellation requested; current job representation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"forbidden (missing scope)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"not_found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"job_not_cancellable (job already completed or failed)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/jobs/{id}/feedback":{"post":{"summary":"Accept or reject a completed job result (replaces earlier feedback)","security":[{"apiKey":[]}],"x-required-scopes":["jobs:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Job id (job_...)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobFeedbackRequest"}}}},"responses":{"200":{"description":"Feedback recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobFeedback"}}}},"400":{"description":"invalid_request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"forbidden (missing scope)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"not_found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"job_not_completed","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/route-experiments":{"get":{"summary":"Shadow routes compared with their primaries, with the promotion verdict","description":"Platform-wide. Compares each shadow route with the primary on the same sampled jobs (finished jobs only). Shadow output is never returned or billed; promotion is a reviewed route-policy change gated by the configured thresholds.","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"responses":{"200":{"description":"Experiments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteExperimentsResponse"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/billing":{"get":{"summary":"Prepaid credit balance and the latest ledger entries","description":"Workspace-wide (all environments). Completed, verified jobs are debited their customer cost; failed or cancelled jobs never are.","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"responses":{"200":{"description":"Balance and entries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingResponse"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/billing/reconciliation":{"get":{"summary":"Provider cost vs customer charge vs credit debit per completed job","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Reconciliation report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconciliationResponse"}}}},"400":{"description":"invalid_request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agentrank":{"get":{"summary":"Executor rankings per capability and route step, from verified outcomes","description":"Platform-wide, recomputed from stored history on every call. Scores compare executors only within one capability + step; there is no global score.","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read"],"parameters":[{"name":"capability","in":"query","required":false,"schema":{"type":"string","example":"research.web"}}],"responses":{"200":{"description":"Rankings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRankResponse"}}}},"400":{"description":"invalid_request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/.well-known/agent-card.json":{"get":{"summary":"A2A Agent Card (protocol v1.0): skills = capabilities, JSON-RPC at /a2a","security":[],"responses":{"200":{"description":"Agent Card (A2A protocol JSON)"}}}},"/a2a":{"post":{"summary":"A2A JSON-RPC 2.0 (A2A-Version: 1.0): SendMessage, SendStreamingMessage, GetTask, CancelTask, SubscribeToTask. A task is a job (task id = job id).","security":[{"apiKey":[]}],"x-required-scopes":["jobs:read","jobs:write"],"responses":{"200":{"description":"JSON-RPC response, or text/event-stream for streaming methods"},"401":{"description":"unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"rate_limited","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}}}