{"openapi":"3.1.0","info":{"title":"Kash Public API","version":"540a065b5919f63c","description":"Public REST API for SDKs, CLI, AI agents, and market makers.\n\nAPI-key authenticated only — keys are issued via the webapp Settings page (self-service `free` tier; higher tiers by request) or via `kash-admin api-keys issue` (admin / MM tier).\n\n## Tier-differentiated limits\n\nEvery key belongs to one of four tiers (`free`, `developer`, `enterprise`, `mm`) which determine four independent limits: daily spending cap, per-trade cap, requests per minute, and high-value confirmation threshold. See [`docs/api-tiers.md`](https://docs.kash.bot/developer-docs/rest-api/rate-limits) for the full matrix, the rationale for the caps, and how to upgrade. Most rate-limited or spending-capped error responses (`RATE_LIMIT_EXCEEDED`, `SPENDING_LIMIT_EXCEEDED`) link back to that page from their per-code documentation in `docs/api-errors/`.\n\nSee https://github.com/kashdao for source-of-truth architecture decisions.","contact":{"name":"Kash","url":"https://kash.bot"}},"servers":[{"url":"https://api.kash.bot/v1","description":"API server"}],"components":{"securitySchemes":{"XApiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Public API key, format kash_{live|test}_<32-base62>. HMAC-SHA256 with server-side pepper. Used by the SDK / CLI / agents for every authenticated route."}},"schemas":{"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","description":"URI of the per-code documentation page. RFC 7807 §3.1 defines `type` as the canonical link to human-readable docs for the problem type — every code in our catalogue has a stable page.","example":"https://docs.kash.bot/developer-docs/api-errors/API_KEY_MISSING"},"title":{"type":"string","example":"Authentication required"},"status":{"type":"integer","example":401},"code":{"type":"string","example":"API_KEY_MISSING"},"detail":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string"}},"required":["type","title","status","code"]},"ResponseMeta":{"type":"object","properties":{"requestId":{"type":"string","example":"01HQGY8K2N3X4Z5C6D7E8F9G0H"},"timestamp":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56.789Z"}},"required":["requestId","timestamp"]},"WriteResponseMeta":{"allOf":[{"$ref":"#/components/schemas/ResponseMeta"},{"type":"object","properties":{"idempotent":{"type":"boolean","example":false}},"required":["idempotent"]}]},"TradeResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"CreateTradeBody":{"type":"object","properties":{"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409.","example":"cli-2026-04-30-001"},"metadata":{"type":"object","additionalProperties":{"type":"string","maxLength":500},"example":{"orderId":"order_123","strategy":"mm-v2","tenantId":"acme-corp"}},"ambassadorToken":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","description":"Optional Market Ambassadors share-link token for last-touch trade attribution.","example":"aZ9-x_2Kq"}},"required":["marketId","outcomeIndex","amount","side"]},"CreateTradeCreatedResponse":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["trade","data","_meta"]},"CreateTradeAcceptedResponse":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"confirmation":{"type":"object","properties":{"token":{"type":"string","minLength":40,"maxLength":64},"expiresAt":{"type":"string","format":"date-time"}},"required":["token","expiresAt"]},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["trade","data","confirmation","_meta"]},"ConfirmTradeBody":{"type":"object","properties":{"token":{"type":"string","minLength":40,"maxLength":64,"example":"kVAa4iL_xQyP8jHqM7nF2tR3wL5vY9zX1bN0gK6cE8hJqWmZ7sR"}},"required":["token"]},"ConfirmTradeResponse":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["trade","data","_meta"]},"ListTradesResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]},"GetTradeResponse":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["trade","data","_meta"]},"TraceEventData":{"type":"object","properties":{"tradeId":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0},"side":{"type":"string","enum":["buy","sell"]},"amount":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"txHash":{"type":"string"},"tokensOut":{"type":"string"},"errorCode":{"type":"string"},"errorMessage":{"type":"string"},"reason":{"type":"string"}},"additionalProperties":false},"TraceEvent":{"type":"object","properties":{"type":{"type":"string","minLength":1,"example":"com.kash.trade.executed.v1"},"occurredAt":{"type":"string","format":"date-time","example":"2026-05-02T12:00:03.000Z"},"sequenceNumber":{"type":"integer","minimum":0},"data":{"$ref":"#/components/schemas/TraceEventData"}},"required":["type","occurredAt","sequenceNumber","data"]},"TraceRetention":{"type":"object","properties":{"windowDays":{"type":"integer","exclusiveMinimum":0,"example":90},"expired":{"type":"boolean","example":false}},"required":["windowDays","expired"],"additionalProperties":false},"TraceResource":{"type":"object","properties":{"correlationId":{"type":"string","format":"uuid"},"events":{"type":"array","items":{"$ref":"#/components/schemas/TraceEvent"}},"retention":{"$ref":"#/components/schemas/TraceRetention"}},"required":["correlationId","events","retention"]},"GetTraceResponse":{"type":"object","properties":{"trace":{"$ref":"#/components/schemas/TraceResource"},"data":{"$ref":"#/components/schemas/TraceResource"},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["trace","data","_meta"]},"MarketResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"outcomeCount":{"type":"integer","exclusiveMinimum":0},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"imageUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"freezeAt":{"type":["string","null"],"format":"date-time"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"resolution":{"type":["object","null"],"properties":{"proposedOutcomeIndex":{"type":"integer","minimum":0},"proposedAt":{"type":["string","null"],"format":"date-time"},"finalizableAt":{"type":["string","null"],"format":"date-time"},"settlementStatus":{"type":"string","enum":["proposed","disputed","finalized","cancelled"]},"disputeOpen":{"type":"boolean"}},"required":["proposedOutcomeIndex","proposedAt","finalizableAt","settlementStatus","disputeOpen"]},"resolutionState":{"type":["string","null"],"enum":["resolving","proposed","settling","resolved","cancelled",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","title","description","status","outcomeCount","outcomes","imageUrl","createdAt","expiresAt","freezeAt","resolvedAt","resolution","resolutionState","tradeable","notTradeableReason"]},"ListMarketsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"outcomeCount":{"type":"integer","exclusiveMinimum":0},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"imageUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"freezeAt":{"type":["string","null"],"format":"date-time"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"resolution":{"type":["object","null"],"properties":{"proposedOutcomeIndex":{"type":"integer","minimum":0},"proposedAt":{"type":["string","null"],"format":"date-time"},"finalizableAt":{"type":["string","null"],"format":"date-time"},"settlementStatus":{"type":"string","enum":["proposed","disputed","finalized","cancelled"]},"disputeOpen":{"type":"boolean"}},"required":["proposedOutcomeIndex","proposedAt","finalizableAt","settlementStatus","disputeOpen"]},"resolutionState":{"type":["string","null"],"enum":["resolving","proposed","settling","resolved","cancelled",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","title","description","status","outcomeCount","outcomes","imageUrl","createdAt","expiresAt","freezeAt","resolvedAt","resolution","resolutionState","tradeable","notTradeableReason"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]},"GetMarketResponse":{"type":"object","properties":{"market":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"outcomeCount":{"type":"integer","exclusiveMinimum":0},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"imageUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"freezeAt":{"type":["string","null"],"format":"date-time"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"resolution":{"type":["object","null"],"properties":{"proposedOutcomeIndex":{"type":"integer","minimum":0},"proposedAt":{"type":["string","null"],"format":"date-time"},"finalizableAt":{"type":["string","null"],"format":"date-time"},"settlementStatus":{"type":"string","enum":["proposed","disputed","finalized","cancelled"]},"disputeOpen":{"type":"boolean"}},"required":["proposedOutcomeIndex","proposedAt","finalizableAt","settlementStatus","disputeOpen"]},"resolutionState":{"type":["string","null"],"enum":["resolving","proposed","settling","resolved","cancelled",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","title","description","status","outcomeCount","outcomes","imageUrl","createdAt","expiresAt","freezeAt","resolvedAt","resolution","resolutionState","tradeable","notTradeableReason"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"outcomeCount":{"type":"integer","exclusiveMinimum":0},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"imageUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"freezeAt":{"type":["string","null"],"format":"date-time"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"resolution":{"type":["object","null"],"properties":{"proposedOutcomeIndex":{"type":"integer","minimum":0},"proposedAt":{"type":["string","null"],"format":"date-time"},"finalizableAt":{"type":["string","null"],"format":"date-time"},"settlementStatus":{"type":"string","enum":["proposed","disputed","finalized","cancelled"]},"disputeOpen":{"type":"boolean"}},"required":["proposedOutcomeIndex","proposedAt","finalizableAt","settlementStatus","disputeOpen"]},"resolutionState":{"type":["string","null"],"enum":["resolving","proposed","settling","resolved","cancelled",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","title","description","status","outcomeCount","outcomes","imageUrl","createdAt","expiresAt","freezeAt","resolvedAt","resolution","resolutionState","tradeable","notTradeableReason"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["market","data","_meta"]},"PredictionResource":{"type":"object","properties":{"id":{"type":"string"},"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0},"side":{"type":"string","enum":["buy","sell"]},"usdcIn":{"type":["string","null"]},"usdcOut":{"type":["string","null"]},"tokensIn":{"type":["string","null"]},"tokensOut":{"type":["string","null"]},"price":{"type":"string"},"probability":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"blockNumber":{"type":"string"},"transactionHash":{"type":"string"},"logIndex":{"type":["integer","null"],"minimum":0}},"required":["id","marketId","outcomeIndex","side","usdcIn","usdcOut","tokensIn","tokensOut","price","probability","timestamp","blockNumber","transactionHash","logIndex"]},"ListPredictionsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0},"side":{"type":"string","enum":["buy","sell"]},"usdcIn":{"type":["string","null"]},"usdcOut":{"type":["string","null"]},"tokensIn":{"type":["string","null"]},"tokensOut":{"type":["string","null"]},"price":{"type":"string"},"probability":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"blockNumber":{"type":"string"},"transactionHash":{"type":"string"},"logIndex":{"type":["integer","null"],"minimum":0}},"required":["id","marketId","outcomeIndex","side","usdcIn","usdcOut","tokensIn","tokensOut","price","probability","timestamp","blockNumber","transactionHash","logIndex"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]},"MarketDisputeResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"FileMarketDisputeBody":{"type":"object","properties":{"reason":{"type":"string","minLength":10,"maxLength":2000}},"required":["reason"]},"FileMarketDisputeResponse":{"type":"object","properties":{"dispute":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["dispute","data","_meta"]},"GetMarketDisputeResponse":{"type":"object","properties":{"dispute":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["dispute","data","_meta"]},"PositionResource":{"type":"object","properties":{"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0},"shares":{"type":"string","pattern":"^\\d+$"},"costBasisAtomic":{"type":"string","pattern":"^\\d+$"},"tradeCount":{"type":"integer","minimum":0},"firstTradeAt":{"type":"string","format":"date-time"},"lastTradeAt":{"type":"string","format":"date-time"}},"required":["marketId","outcomeIndex","shares","costBasisAtomic","tradeCount","firstTradeAt","lastTradeAt"]},"PositionsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0},"shares":{"type":"string","pattern":"^\\d+$"},"costBasisAtomic":{"type":"string","pattern":"^\\d+$"},"tradeCount":{"type":"integer","minimum":0},"firstTradeAt":{"type":"string","format":"date-time"},"lastTradeAt":{"type":"string","format":"date-time"}},"required":["marketId","outcomeIndex","shares","costBasisAtomic","tradeCount","firstTradeAt","lastTradeAt"]}},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","_meta"]},"PortfolioSummaryResponse":{"type":"object","properties":{"portfolio":{"type":"object","properties":{"smartAccountAddress":{"type":"string"},"activePositions":{"type":"integer","minimum":0},"totalCostBasisAtomic":{"type":"string","pattern":"^\\d+$"}},"required":["smartAccountAddress","activePositions","totalCostBasisAtomic"]},"data":{"type":"object","properties":{"smartAccountAddress":{"type":"string"},"activePositions":{"type":"integer","minimum":0},"totalCostBasisAtomic":{"type":"string","pattern":"^\\d+$"}},"required":["smartAccountAddress","activePositions","totalCostBasisAtomic"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["portfolio","data","_meta"]},"AccountUsage":{"type":"object","properties":{"apiKeyId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"trades":{"type":"object","properties":{"24h":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1},"latencyMs":{"type":"object","properties":{"p50":{"type":["integer","null"]},"p99":{"type":["integer","null"]}},"required":["p50","p99"]}},"required":["total","completed","failed","successRate","latencyMs"]},"7d":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["total","completed","failed","successRate"]},"30d":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["total","completed","failed","successRate"]}},"required":["24h","7d","30d"]},"webhooks":{"type":"object","properties":{"7d":{"type":"object","properties":{"emitted":{"type":"integer","minimum":0},"delivered":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["emitted","delivered","failed","successRate"]}},"required":["7d"]},"auth":{"type":"object","properties":{"24h":{"type":"object","properties":{"failures":{"type":"integer","minimum":0},"rateLimitRejections":{"type":"integer","minimum":0}},"required":["failures","rateLimitRejections"]}},"required":["24h"]}},"required":["apiKeyId","generatedAt","trades","webhooks","auth"]},"AccountUsageResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"apiKeyId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"trades":{"type":"object","properties":{"24h":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1},"latencyMs":{"type":"object","properties":{"p50":{"type":["integer","null"]},"p99":{"type":["integer","null"]}},"required":["p50","p99"]}},"required":["total","completed","failed","successRate","latencyMs"]},"7d":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["total","completed","failed","successRate"]},"30d":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["total","completed","failed","successRate"]}},"required":["24h","7d","30d"]},"webhooks":{"type":"object","properties":{"7d":{"type":"object","properties":{"emitted":{"type":"integer","minimum":0},"delivered":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["emitted","delivered","failed","successRate"]}},"required":["7d"]},"auth":{"type":"object","properties":{"24h":{"type":"object","properties":{"failures":{"type":"integer","minimum":0},"rateLimitRejections":{"type":"integer","minimum":0}},"required":["failures","rateLimitRejections"]}},"required":["24h"]}},"required":["apiKeyId","generatedAt","trades","webhooks","auth"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","_meta"]},"WebhookEventResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"tradeRequestId":{"type":["string","null"],"format":"uuid"},"emittedAt":{"type":"string","format":"date-time"},"outboxEmittedAt":{"type":["string","null"],"format":"date-time"},"replayCount":{"type":"integer","minimum":0},"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"delivery":{"type":"object","properties":{"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastDeliveredAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"lastErrorMessage":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["attempts","lastAttemptedAt","lastDeliveredAt","lastStatusCode","lastFailureCode","lastErrorMessage","terminalFailureAt"]}},"required":["id","eventType","tradeRequestId","emittedAt","outboxEmittedAt","replayCount","status","delivery"]},"ListWebhookEventsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"tradeRequestId":{"type":["string","null"],"format":"uuid"},"emittedAt":{"type":"string","format":"date-time"},"outboxEmittedAt":{"type":["string","null"],"format":"date-time"},"replayCount":{"type":"integer","minimum":0},"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"delivery":{"type":"object","properties":{"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastDeliveredAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"lastErrorMessage":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["attempts","lastAttemptedAt","lastDeliveredAt","lastStatusCode","lastFailureCode","lastErrorMessage","terminalFailureAt"]}},"required":["id","eventType","tradeRequestId","emittedAt","outboxEmittedAt","replayCount","status","delivery"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]},"RedeliverWebhookResponse":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"apiKeyId":{"type":"string","format":"uuid"},"tradeRequestId":{"type":["string","null"],"format":"uuid"},"emittedAt":{"type":"string","format":"date-time"},"lastDeliveredAt":{"type":["string","null"],"format":"date-time"},"deliveryAttempts":{"type":"integer","minimum":0}},"required":["id","eventType","apiKeyId","tradeRequestId","emittedAt","lastDeliveredAt","deliveryAttempts"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"apiKeyId":{"type":"string","format":"uuid"},"tradeRequestId":{"type":["string","null"],"format":"uuid"},"emittedAt":{"type":"string","format":"date-time"},"lastDeliveredAt":{"type":["string","null"],"format":"date-time"},"deliveryAttempts":{"type":"integer","minimum":0}},"required":["id","eventType","apiKeyId","tradeRequestId","emittedAt","lastDeliveredAt","deliveryAttempts"]},"_meta":{"allOf":[{"$ref":"#/components/schemas/ResponseMeta"},{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}]}},"required":["event","data","_meta"]},"RotateWebhookSecretResponse":{"type":"object","properties":{"webhookSecret":{"type":"object","properties":{"secret":{"type":"string"},"rotatedAt":{"type":"string","format":"date-time"},"previousRetainedUntil":{"type":"string","format":"date-time"}},"required":["secret","rotatedAt","previousRetainedUntil"]},"data":{"type":"object","properties":{"secret":{"type":"string"},"rotatedAt":{"type":"string","format":"date-time"},"previousRetainedUntil":{"type":"string","format":"date-time"}},"required":["secret","rotatedAt","previousRetainedUntil"]},"_meta":{"allOf":[{"$ref":"#/components/schemas/ResponseMeta"},{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}]}},"required":["webhookSecret","data","_meta"]},"TradeWebhookCommon":{"type":"object","properties":{"tradeId":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"chainRef":{"type":"string","example":"evm:8453"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^\\d+(\\.\\d{1,6})?$","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"metadata":{"type":"object","additionalProperties":{"type":"string"},"example":{"strategy":"momentum-v2","cohort":"beta"}}},"required":["tradeId","marketId","outcomeIndex","amount","side","metadata"]},"TradeConfirmationRequiredPayload":{"allOf":[{"$ref":"#/components/schemas/TradeWebhookCommon"},{"type":"object","properties":{"status":{"type":"string","enum":["pending_confirmation"]},"confirmationExpiresAt":{"type":"string","format":"date-time"}},"required":["status","confirmationExpiresAt"]}]},"TradeConfirmationRequiredEnvelope":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["trade.confirmation-required"]},"apiVersion":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/TradeConfirmationRequiredPayload"}},"required":["id","type","apiVersion","createdAt","data"]},"TradeCompletedPayload":{"allOf":[{"$ref":"#/components/schemas/TradeWebhookCommon"},{"type":"object","properties":{"status":{"type":"string","enum":["completed"]},"txHash":{"type":"string","description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":"string","pattern":"^\\d+$","example":"105420000000000000000"}},"required":["status","txHash","tokensOut"]}]},"TradeCompletedEnvelope":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["trade.completed"]},"apiVersion":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/TradeCompletedPayload"}},"required":["id","type","apiVersion","createdAt","data"]},"TradeFailedPayload":{"allOf":[{"$ref":"#/components/schemas/TradeWebhookCommon"},{"type":"object","properties":{"status":{"type":"string","enum":["failed"]},"errorCode":{"type":"string","minLength":1},"errorMessage":{"type":"string","minLength":1}},"required":["status","errorCode","errorMessage"]}]},"TradeFailedEnvelope":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["trade.failed"]},"apiVersion":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/TradeFailedPayload"}},"required":["id","type","apiVersion","createdAt","data"]},"TradeRejectedPayload":{"allOf":[{"$ref":"#/components/schemas/TradeWebhookCommon"},{"type":"object","properties":{"status":{"type":"string","enum":["rejected"]},"errorCode":{"type":"string","minLength":1},"errorMessage":{"type":"string","minLength":1}},"required":["status","errorCode","errorMessage"]}]},"TradeRejectedEnvelope":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["trade.rejected"]},"apiVersion":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/TradeRejectedPayload"}},"required":["id","type","apiVersion","createdAt","data"]},"RedemptionResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0,"maximum":255},"kind":{"type":"string","enum":["resolved","cancelled"]},"sharesWad":{"type":"string"},"status":{"type":"string"}},"required":["id","marketId","outcomeIndex","kind","sharesWad","status"]},"CreateRedemptionBody":{"type":"object","properties":{"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0,"maximum":255}},"required":["marketId","outcomeIndex"],"additionalProperties":false},"CreateRedemptionResponse":{"type":"object","properties":{"redemption":{"$ref":"#/components/schemas/RedemptionResource"},"data":{"$ref":"#/components/schemas/RedemptionResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["redemption","data","_meta"]},"RevenueShareClaimResource":{"type":"object","properties":{"outcome":{"type":"string","enum":["created","topped_up"],"description":"`created`: a new claim now holds every claimable share. `topped_up`: the caller already had an open claim and every newly claimable share was added to it (`addedAtomic` may be `0`)."},"claimId":{"type":"string","format":"uuid"},"addedAtomic":{"type":"string","pattern":"^\\d+$","description":"USDC atomic units this request added to the claim.","example":"1500000"},"grossAtomic":{"type":"string","pattern":"^\\d+$","description":"USDC atomic units the claim now holds in total, before the payout deducts its network fee share.","example":"1500000"}},"required":["outcome","claimId","addedAtomic","grossAtomic"]},"RevenueShareUnlock":{"type":"object","properties":{"unlocksBy":{"type":"string","format":"date-time","description":"An instant by which every share in this group has left its hold (the UTC hour, rounded up)."},"amountAtomic":{"type":"string","pattern":"^\\d+$","description":"USDC atomic units unlocking by `unlocksBy`.","example":"1500000"},"itemCount":{"type":"integer","minimum":1}},"required":["unlocksBy","amountAtomic","itemCount"]},"RevenueShareSummaryResource":{"type":"object","properties":{"claimableAtomic":{"type":"string","pattern":"^\\d+$","description":"Approved, past its hold and ready to claim now.","example":"1500000"},"claimableCount":{"type":"integer","minimum":0},"claimingAtomic":{"type":"string","pattern":"^\\d+$","description":"Already in an open claim or a payout on its way.","example":"1500000"},"awaitingApprovalAtomic":{"type":"string","pattern":"^\\d+$","description":"Past its payout hold and not yet approved for payout. A share still inside its hold is counted in `inHoldAtomic` instead, whether or not it has been approved.","example":"1500000"},"inHoldAtomic":{"type":"string","pattern":"^\\d+$","description":"Still inside its payout hold, approved or not. `unlockSchedule` says when it unlocks.","example":"1500000"},"heldUntil":{"type":["string","null"],"format":"date-time","description":"When the earliest share in `inHoldAtomic` leaves its hold, or null when nothing is in hold. The hold comes from the database policy and may change if the policy does."},"unlockSchedule":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShareUnlock"},"description":"When `inHoldAtomic` unlocks: the held shares grouped by the UTC hour each leaves its hold, rounded up, soonest first. Read in the same statement as the buckets, so the amounts sum to `inHoldAtomic`. Empty when nothing is in hold."},"underReviewAtomic":{"type":"string","pattern":"^\\d+$","description":"USDC atomic units (6 dp) as a decimal string.","example":"1500000"},"rejectedAtomic":{"type":"string","pattern":"^\\d+$","description":"USDC atomic units (6 dp) as a decimal string.","example":"1500000"},"qualifyingAtomic":{"type":"string","pattern":"^\\d+$","description":"Waiting on the ambassador volume threshold.","example":"1500000"},"needsSupportAtomic":{"type":"string","pattern":"^\\d+$","description":"Cannot be claimed without support: the wallet changed since approval, the share is blocked, or it exceeds the payout ceiling.","example":"1500000"},"paidAtomic":{"type":"string","pattern":"^\\d+$","description":"USDC atomic units (6 dp) as a decimal string.","example":"1500000"},"openClaimId":{"type":["string","null"],"format":"uuid"},"openClaimStatus":{"type":["string","null"],"enum":["queued","paying",null]},"openClaimWaitReason":{"type":["string","null"],"enum":["allowance","escrow","below_minimum","lane_busy",null]},"openClaimNextWindowAt":{"type":["string","null"],"format":"date-time"},"payoutOwner":{"type":["string","null"],"description":"The Solana wallet a claim pays, or null when none is bound."},"claimsEnabled":{"type":"boolean","description":"Whether claims are open right now (false while paused)."},"estimatedFeeAtomic":{"type":["string","null"],"pattern":"^\\d+$","description":"An ESTIMATE of what a payout deducts (network fee share, any fee margin and first-time account rent), from recent payouts. Null before any payout has run.","example":"1500000"}},"required":["claimableAtomic","claimableCount","claimingAtomic","awaitingApprovalAtomic","inHoldAtomic","heldUntil","unlockSchedule","underReviewAtomic","rejectedAtomic","qualifyingAtomic","needsSupportAtomic","paidAtomic","openClaimId","openClaimStatus","openClaimWaitReason","openClaimNextWindowAt","payoutOwner","claimsEnabled","estimatedFeeAtomic"]},"RevenueShareItemResource":{"type":"object","properties":{"accrualId":{"type":"string","format":"uuid","description":"The share’s own id."},"marketId":{"type":"string","format":"uuid"},"marketTitle":{"type":["string","null"]},"recipientKind":{"type":"string","enum":["user","affiliate","ambassador"],"description":"The role the share was earned in."},"amountAtomic":{"type":"string","pattern":"^\\d+$","description":"USDC atomic units (6 dp) as a decimal string.","example":"1500000"},"bucket":{"type":"string","enum":["claimable","claiming","awaiting_approval","in_hold","under_review","rejected","qualifying","needs_support"],"description":"The ONE bucket the share is in, the same definition `GET /v1/revenue-share` totals, so the items of a bucket sum to its total."},"eligibleAt":{"type":["string","null"],"format":"date-time","description":"When the share leaves its payout hold, from the database’s hold policy (it may change if the policy changes). Null while the share is under review."},"claimable":{"type":"boolean","description":"Whether the share is claimable now, judged on the database clock."},"claimId":{"type":["string","null"],"format":"uuid","description":"The claim this share is in, or null when it is in none."},"earnedAt":{"type":"string","format":"date-time","description":"When the share was earned."}},"required":["accrualId","marketId","marketTitle","recipientKind","amountAtomic","bucket","eligibleAt","claimable","claimId","earnedAt"]},"CreateRevenueShareClaimBody":{"type":"object","properties":{},"additionalProperties":false,"description":"Always empty. The claim is for the API key’s own user, for everything currently claimable, paid to the wallet each share was approved to."},"CreateRevenueShareClaimResponse":{"type":"object","properties":{"claim":{"$ref":"#/components/schemas/RevenueShareClaimResource"},"data":{"$ref":"#/components/schemas/RevenueShareClaimResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["claim","data","_meta"]},"GetRevenueShareResponse":{"type":"object","properties":{"revenueShare":{"$ref":"#/components/schemas/RevenueShareSummaryResource"},"data":{"$ref":"#/components/schemas/RevenueShareSummaryResource"},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["revenueShare","data","_meta"]},"ListRevenueShareItemsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShareItemResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"asOf":{"type":["string","null"],"format":"date-time","description":"The database clock `claimable` and the buckets were judged on. Null when the page is empty."},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","asOf","_meta"]},"CompetitionClaimResource":{"type":"object","properties":{"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"entrantId":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"amountAtomic":{"type":"string","pattern":"^\\d+$","example":"5000000"},"kind":{"type":"string","enum":["prize","airdrop"],"example":"prize"},"round":{"type":"integer","minimum":0,"example":0},"claimedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"}},"required":["competitionId","entrantId","amountAtomic","kind","round","claimedAt"]},"CompetitionSummaryResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"organizationId":{"type":"string","format":"uuid","example":"6b617368-6277-6864-7800-000000000001"},"slug":{"type":"string","example":"autumn-alpha-cup"},"name":{"type":"string","example":"Autumn Alpha Cup"},"summary":{"type":"string","example":"Four weeks. Best realised PnL takes the pot."},"rules":{"type":"string","example":"Markets in the Politics category only."},"bannerUrl":{"type":["string","null"],"example":null},"state":{"type":"string","enum":["published","registration","running","claim_window","cancelled","scoring_frozen","settled","paid_out","closed"],"example":"running"},"settlementMode":{"type":"string","enum":["onchain_escrow","sponsored","offchain_airdrop","none"],"example":"onchain_escrow"},"isVerified":{"type":"boolean","example":true},"chain":{"type":"string","enum":["evm","solana","none"],"example":"solana"},"solanaCompetitionId":{"type":["string","null"],"pattern":"^[1-9][0-9]*$","example":"42"},"advertisedPotAtomic":{"type":"string","example":"10000000"},"potFundedAtomic":{"type":["string","null"],"example":"9900000"},"potAvailableAtomic":{"type":["string","null"],"example":"9900000"},"entryTargetAtomic":{"type":["string","null"],"example":"1000000"},"submissionOpensAt":{"type":"string","format":"date-time"},"joinDeadline":{"type":"string","format":"date-time"},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"claimDeadline":{"type":["string","null"],"format":"date-time"},"publishedAt":{"type":["string","null"],"format":"date-time"},"cancelledAt":{"type":["string","null"],"format":"date-time"},"settledAt":{"type":["string","null"],"format":"date-time"}},"required":["id","organizationId","slug","name","summary","rules","bannerUrl","state","settlementMode","isVerified","chain","solanaCompetitionId","advertisedPotAtomic","potFundedAtomic","potAvailableAtomic","entryTargetAtomic","submissionOpensAt","joinDeadline","startsAt","endsAt","claimDeadline","publishedAt","cancelledAt","settledAt"]},"CompetitionEntrantResource":{"type":"object","properties":{"entrantId":{"type":"string","format":"uuid","example":"3b1f0e5c-6a2d-4f88-9c1e-77a0b4d9e210"},"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"subjectType":{"type":"string","enum":["group","user"],"example":"group"},"groupId":{"type":["string","null"],"format":"uuid"},"userId":{"type":["string","null"],"format":"uuid","description":"The caller's own user id on the caller's own `user` entry; `null` on every other row. Other users' internal ids are never disclosed — use `entrantId` to identify a row and `subjectType` to tell a user from a group."},"isCaller":{"type":"boolean","description":"`true` on the caller's own `user` entry.","example":false},"subjectName":{"type":["string","null"],"example":"The Cartographers"},"subjectSlug":{"type":["string","null"],"example":"the-cartographers"},"subjectAvatarUrl":{"type":["string","null"]},"entryState":{"type":"string","enum":["applied","funding","joined","accepted","withdrawn","rejected","refunded","disqualified"],"example":"funding"},"onBoard":{"type":"boolean","example":false},"chain":{"type":"string","enum":["evm","solana","none"],"example":"solana"},"fundedGrossAtomic":{"type":["string","null"],"example":"400000"},"entryTargetAtomic":{"type":["string","null"],"example":"1000000"},"remainingAtomic":{"type":["string","null"],"example":"600000"},"rosterCapturedAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"required":["entrantId","competitionId","subjectType","groupId","userId","isCaller","subjectName","subjectSlug","subjectAvatarUrl","entryState","onBoard","chain","fundedGrossAtomic","entryTargetAtomic","remainingAtomic","rosterCapturedAt","updatedAt"]},"CompetitionLeaderboardEntryResource":{"type":"object","properties":{"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"entrantId":{"type":"string","format":"uuid","example":"3b1f0e5c-6a2d-4f88-9c1e-77a0b4d9e210"},"subjectType":{"type":"string","enum":["group","user"],"example":"group"},"groupId":{"type":["string","null"],"format":"uuid"},"userId":{"type":["string","null"],"format":"uuid","description":"The caller's own user id on the caller's own `user` entry; `null` on every other row. Other users' internal ids are never disclosed — use `entrantId` to identify a row and `subjectType` to tell a user from a group."},"isCaller":{"type":"boolean","description":"`true` on the caller's own `user` entry.","example":false},"subjectName":{"type":["string","null"],"example":"The Cartographers"},"rank":{"type":"integer","exclusiveMinimum":0,"example":1},"realizedPnlAtomic":{"type":"string","example":"-1090074"},"accuracyBps":{"type":["integer","null"],"example":6667},"totalVolumeAtomic":{"type":"string","example":"25000000"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"required":["competitionId","entrantId","subjectType","groupId","userId","isCaller","subjectName","rank","realizedPnlAtomic","accuracyBps","totalVolumeAtomic","updatedAt"]},"ListCompetitionsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionSummaryResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]},"GetCompetitionResponse":{"type":"object","properties":{"competition":{"$ref":"#/components/schemas/CompetitionSummaryResource"},"data":{"$ref":"#/components/schemas/CompetitionSummaryResource"},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["competition","data","_meta"]},"ListCompetitionEntrantsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionEntrantResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]},"GetCompetitionLeaderboardResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionLeaderboardEntryResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]},"ClaimCompetitionBody":{"type":"object","properties":{}},"ClaimCompetitionResponse":{"type":"object","properties":{"claim":{"$ref":"#/components/schemas/CompetitionClaimResource"},"data":{"$ref":"#/components/schemas/CompetitionClaimResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["claim","data","_meta"]},"CompetitionEntryResource":{"type":"object","properties":{"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"entrantId":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"subjectType":{"type":"string","enum":["group","user"],"example":"group"},"entryState":{"type":"string","enum":["funding"],"example":"funding"},"joinedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"}},"required":["competitionId","entrantId","subjectType","entryState","joinedAt"]},"CompetitionContributionResource":{"type":"object","properties":{"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"entrantId":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"memberContributionAtomic":{"type":"string","pattern":"^\\d+$","example":"40000000"},"entryFundedAtomic":{"type":"string","pattern":"^\\d+$","example":"110000000"},"entryState":{"type":"string","enum":["funding","joined"],"example":"joined"},"contributedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"}},"required":["competitionId","entrantId","memberContributionAtomic","entryFundedAtomic","entryState","contributedAt"]},"CompetitionSponsorshipResource":{"type":"object","properties":{"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"organizationId":{"type":"string","format":"uuid","example":"6b617368-6277-6864-7800-000000000001"},"amountAtomic":{"type":"string","pattern":"^\\d+$","example":"1000000000"},"sponsoredAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"}},"required":["competitionId","organizationId","amountAtomic","sponsoredAt"]}},"parameters":{}},"paths":{"/v1/health":{"get":{"summary":"Liveness probe","description":"Returns 200 with a small JSON body when the process is up. No auth.","responses":{"200":{"description":"Service is up.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"version":{"type":"string"},"uptime_seconds":{"type":"integer"},"timestamp":{"type":"string","format":"date-time"}},"required":["status","version","uptime_seconds","timestamp"]}}}}}}},"/v1/ready":{"get":{"summary":"Readiness probe","description":"Returns 200 when every downstream dependency (Postgres, Redis, Supabase PostgREST, HMAC pepper) is reachable; 503 with a per-dependency status object otherwise. No auth. Use this for orchestrator readiness gates and external monitors. For plain liveness without dep checks, use `/v1/health`.","responses":{"200":{"description":"All downstream dependencies are healthy.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ready"]},"checks":{"type":"object","additionalProperties":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded","fail"]},"latencyMs":{"type":"integer"},"detail":{"type":"string"}},"required":["status"]}},"timestamp":{"type":"string","format":"date-time"}},"required":["status","checks","timestamp"]}}}},"503":{"description":"One or more downstream dependencies are unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["not_ready"]},"checks":{"type":"object","additionalProperties":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded","fail"]},"latencyMs":{"type":"integer"},"detail":{"type":"string"}},"required":["status"]}},"timestamp":{"type":"string","format":"date-time"}},"required":["status","checks","timestamp"]}}}}}}},"/v1/openapi.json":{"get":{"summary":"OpenAPI 3.1 specification","description":"The contract of record for this API (per AD-15). Live, generated from Zod.","responses":{"200":{"description":"OpenAPI 3.1 document.","content":{"application/json":{"schema":{}}}}}}},"/v1/trades":{"post":{"summary":"Create a trade request","description":"Creates a new trade request. For high-value trades (≥ `api_keys.high_value_trade_threshold_usdc`) returns 202 Accepted with a one-time confirmation token; otherwise returns 201 Created and the trade enters the risk-engine pipeline immediately. Honors the `Idempotency-Key` HTTP header and the body-level `clientRequestId`. Subject to the per-key spending caps (`per_trade_limit_usdc`, `daily_spend_limit_usdc`) and rate limit set by the key's tier — see [docs/api-tiers.md](https://docs.kash.bot/developer-docs/rest-api/rate-limits) for the matrix and upgrade paths. Admission control refuses a trade before anything is written, with a retryable answer: 429 `TRADE_IN_FLIGHT_LIMIT_EXCEEDED` when the account already has its tier's maximum of unfinished trades, 503 `TRADE_ADMISSION_BUSY` while the trade pipeline works through a backlog. Both carry `Retry-After`. A market that cannot trade is refused at admission with 409 `MARKET_NOT_TRADEABLE`, the reason in `detail`: resolved, cancelled on chain, not `ACTIVE`, or past its freeze deadline (the same definition the trade pipeline applies; a cancelled or frozen market used to be accepted and then fail). Every market resource carries `tradeable` and `notTradeableReason`, computed by this same rule, so a caller can check before submitting. A sell is refused with 422 `NO_POSITION`, nothing recorded, when this key's previous sell of the same market and outcome failed `no_position` in the last hour and no buy of that outcome by the account has landed since, from any channel.","security":[{"XApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"clientRequestId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409.","example":"cli-2026-04-30-001"},"metadata":{"type":"object","additionalProperties":{"type":"string","maxLength":500},"example":{"orderId":"order_123","strategy":"mm-v2","tenantId":"acme-corp"}},"ambassadorToken":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","description":"Optional Market Ambassadors share-link token for last-touch trade attribution.","example":"aZ9-x_2Kq"}},"required":["marketId","outcomeIndex","amount","side"]}}}},"responses":{"201":{"description":"Trade accepted into the pipeline.","content":{"application/json":{"schema":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["trade","data","_meta"]}}}},"202":{"description":"High-value trade waiting on confirmation (AD-10).","content":{"application/json":{"schema":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"confirmation":{"type":"object","properties":{"token":{"type":"string","minLength":40,"maxLength":64},"expiresAt":{"type":"string","format":"date-time"}},"required":["token","expiresAt"]},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["trade","data","confirmation","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"get":{"summary":"List trades (cursor pagination)","description":"Lists the authenticated user's trades, newest first. Cursor pagination per AD-15. `status` filter accepts a comma-separated list (e.g. `pending,completed`).","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"marketId","in":"query"}],"responses":{"200":{"description":"Page of trades.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/redemptions":{"post":{"summary":"Claim a settled position","description":"Redeems the caller's tokens for the resolved outcome in a resolved market, or refunds a held outcome in a cancelled market, converting them back to USDC. Inserts the same claim the webapp \"Claim\" button does; the payout pipeline (orchestrator → executor) performs the on-chain call asynchronously — this route makes no contract call itself. One `(marketId, outcomeIndex)` per request. Claimability is decided by the same `claimable_rewards` authority the webapp uses (the outcome must have won or carry a non-zero cancel price, self-service must be live for the market, and the position must not already be redeemed); a non-claimable position returns `409 POSITION_NOT_CLAIMABLE`. Idempotent by construction (the `UNIQUE(user_id, market_id, outcome_index)` constraint): a repeat claim returns the original request with `200` and `_meta.idempotent: true`; the `Idempotency-Key` HTTP header is also honoured. Requires the `trades:write` scope. Returns `404 REDEMPTIONS_NOT_ENABLED` when self-service redemption is not enabled on the platform.","security":[{"XApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0,"maximum":255}},"required":["marketId","outcomeIndex"],"additionalProperties":false}}}},"responses":{"200":{"description":"Position was already claimed — the original request is returned unchanged (`_meta.idempotent: true`).","content":{"application/json":{"schema":{"type":"object","properties":{"redemption":{"$ref":"#/components/schemas/RedemptionResource"},"data":{"$ref":"#/components/schemas/RedemptionResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["redemption","data","_meta"]}}}},"201":{"description":"Redemption request created and queued for payout.","content":{"application/json":{"schema":{"type":"object","properties":{"redemption":{"$ref":"#/components/schemas/RedemptionResource"},"data":{"$ref":"#/components/schemas/RedemptionResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["redemption","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/revenue-share":{"get":{"summary":"Get the authenticated user's revenue-share balance","description":"Returns the API key's user's revenue share on Solana, split into buckets that never overlap: claimable now, already claiming (in an open claim or a payout on its way), in hold (still inside its payout hold, approved or not; `heldUntil` is the earliest release and `unlockSchedule` groups the held total by the UTC hour it unlocks), awaiting approval (past its hold, not yet approved), under review, rejected, qualifying (ambassador volume threshold), needs support, and paid. The hold comes from the database's policy and may change if the policy changes. Also returns the open claim, the wallet a claim pays, whether claims are open right now, and an ESTIMATE of what a payout deducts. Every amount is a decimal string of USDC atomic units. Requires the `portfolio:read` scope; organization smart-account keys are refused with `409 WALLET_DELEGATION_NOT_ENABLED`.","security":[{"XApiKey":[]}],"responses":{"200":{"description":"Revenue-share balance by bucket.","content":{"application/json":{"schema":{"type":"object","properties":{"revenueShare":{"$ref":"#/components/schemas/RevenueShareSummaryResource"},"data":{"$ref":"#/components/schemas/RevenueShareSummaryResource"},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["revenueShare","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/revenue-share/items":{"get":{"summary":"List the authenticated user's pending revenue-share line items","description":"Returns every PENDING share of the API key's user's revenue share on Solana, one row each (paid shares are not listed), including shares still inside their payout hold. Line items are sorted soonest-unlock first (`eligibleAt` ascending), with shares under review (`eligibleAt: null`) last. Each carries its `bucket`, the same definition `GET /v1/revenue-share` totals. `eligibleAt` comes from the database’s hold policy and may change if the policy changes. `claimable` is judged on the database clock, reported as `asOf`. A claim (`POST /v1/revenue-share/claims`) always claims every claimable share at once; there is no per-item claim. Narrow with `?bucket=` (comma-separated). Cursor-paginated: pass `pagination.cursor` back as `?cursor=` while `hasMore` is true. Cursors are opaque and per-list: one from another endpoint is a `400 VALIDATION_FAILED`. Every amount is a decimal string of USDC atomic units. Requires the `portfolio:read` scope; organization smart-account keys are refused with `409 WALLET_DELEGATION_NOT_ENABLED`.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","description":"Opaque; pass back `pagination.cursor` from the previous page."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Comma-separated subset of: claimable, claiming, awaiting_approval, in_hold, under_review, rejected, qualifying, needs_support.","example":"in_hold,claimable"},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Pending revenue-share line items, soonest unlock first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShareItemResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"asOf":{"type":["string","null"],"format":"date-time","description":"The database clock `claimable` and the buckets were judged on. Null when the page is empty."},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","asOf","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/revenue-share/claims":{"post":{"summary":"Claim your revenue share","description":"Claims everything currently claimable for the API key's user. The body is always an empty object: there is no amount, destination or user to name, and a body that carries one is refused with `400 VALIDATION_FAILED`. Each share is paid to the Solana wallet it was approved to; the payout itself happens asynchronously and deducts its network fee share. Returns `201` with `outcome: created` for a new claim, or `200` with `outcome: topped_up` when an open claim already existed and newly claimable shares were added to it (`addedAtomic` may be `0`). The `Idempotency-Key` header is REQUIRED (at most 200 characters): the outcome is stored against it, so a retry with the same key returns the original outcome with `_meta.idempotent: true`, even while claims are paused. Refusals: `409 REVENUE_SHARE_NOTHING_CLAIMABLE` (stored like any outcome; use a new key to ask again), `409 REVENUE_SHARE_CLAIMS_PAUSED`, `503 REVENUE_SHARE_CLAIMS_NOT_READY` with `Retry-After`. Requires the `trades:write` scope; organization smart-account keys are refused with `409 WALLET_DELEGATION_NOT_ENABLED`.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"Required. The claim outcome is stored against this key.","example":"claim-2026-10-20-01"},"required":true,"name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRevenueShareClaimBody"}}}},"responses":{"200":{"description":"Newly claimable shares were added to the open claim.","content":{"application/json":{"schema":{"type":"object","properties":{"claim":{"$ref":"#/components/schemas/RevenueShareClaimResource"},"data":{"$ref":"#/components/schemas/RevenueShareClaimResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["claim","data","_meta"]}}}},"201":{"description":"A new claim holds every claimable share.","content":{"application/json":{"schema":{"type":"object","properties":{"claim":{"$ref":"#/components/schemas/RevenueShareClaimResource"},"data":{"$ref":"#/components/schemas/RevenueShareClaimResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["claim","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions":{"get":{"summary":"List competitions","description":"Lists competitions, newest first, cursor-paginated. Drafts are never returned — `state` accepts every published state and refuses `draft` with `400 VALIDATION_FAILED`, because a filter that can only ever match nothing reads as a fact about the data rather than about the API. **Two pot figures are published and they are different numbers:** `advertisedPotAtomic` is the editorial amount the CREATOR promised, which governs no solvency and is never checked against custody, while `potFundedAtomic` is what escrow actually HOLDS — **NET** of on-chain fees — and `potAvailableAtomic` is that same NET figure less what has been paid out or refunded. Pay a prize from the funded figure, never the advertised one. `entryTargetAtomic` is a **GROSS** per-entry buy-in target, in the same units as an entrant's `fundedGrossAtomic`, and is NOT comparable with either NET pot figure. All three are `null` — never `\"0\"` — unless the competition is an on-chain escrow on Solana (`settlementMode: onchain_escrow` AND `chain: solana`): any other competition, including an `onchain_escrow` one on `chain: none`, holds no escrowed pot and runs no funding race, so read `null` as \"does not apply\" rather than as zero. Every atomic-USDC field is a decimal STRING, as is `solanaCompetitionId` (a u64 on chain) — both exceed 2^53 long before they exceed their own column. Requires `markets:read` scope (granted by default on every tier).","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["published","registration","running","claim_window","cancelled","scoring_frozen","settled","paid_out","closed"]},"required":false,"name":"state","in":"query"},{"schema":{"type":"string","enum":["evm","solana","none"]},"required":false,"name":"chain","in":"query"}],"responses":{"200":{"description":"Page of competitions.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionSummaryResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}":{"get":{"summary":"Get a single competition","description":"Returns one competition summary. A DRAFT competition and a competition that does not exist are the same answer, `404 COMPETITION_NOT_FOUND` — distinguishing them would confirm the existence of an unpublished object. See `GET /v1/competitions` for the difference between the editorial `advertisedPotAtomic`, the NET `potFundedAtomic`/`potAvailableAtomic` and the GROSS `entryTargetAtomic`, and for why all three of the latter are `null` on a competition that is not an on-chain escrow on Solana. Requires `markets:read` scope.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"}],"responses":{"200":{"description":"Competition resource.","content":{"application/json":{"schema":{"type":"object","properties":{"competition":{"$ref":"#/components/schemas/CompetitionSummaryResource"},"data":{"$ref":"#/components/schemas/CompetitionSummaryResource"},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["competition","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}/entrants":{"get":{"summary":"List a competition's entrants and their funding progress","description":"Returns every entry, INCLUDING entries still collecting their buy-in. Each row carries `entryState` and `onBoard`: `onBoard` is true only for entries the scoreable-board view admits (`joined`/`accepted`), so a consumer wanting the board alone filters on it, while `funding` entries carry `fundedGrossAtomic`, `entryTargetAtomic` and `remainingAtomic` — the race to the buy-in, which on a `solana` competition is already world-readable on chain. All three are **GROSS** and in the same units as one another, so `remainingAtomic` is their difference; none is comparable with the competition's NET pot figures. **Those three money fields are `null` together — never `\"0\"` — on a competition that runs no Solana funding race**, i.e. anything other than `settlementMode: onchain_escrow` on `chain: solana`: a sponsored, airdrop, EVM or simulated (`chain: none`) competition has real entrants and no buy-in to collect, so read `null` as \"does not apply\" rather than as zero. Its entrants are still listed in full, all with `onBoard: true`. Cursor-paginated on `entrant_id`, so a roster of any size can be walked in full: pass `pagination.cursor` back as `?cursor=` while `hasMore` is true. Ordered by `entrant_id`, not by funding progress — sort client-side on `onBoard` and `fundedGrossAtomic` if you want the board first. Cursors are opaque and per-list: one from another endpoint is a `400 VALIDATION_FAILED`. Requires `markets:read` scope.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":200,"description":"Rows per page. Larger than the list endpoints (max 500, default 200) on purpose: a roster is one competition's entrants, bounded by that competition rather than by the platform, and a consumer usually wants all of it."},"required":false,"description":"Rows per page. Larger than the list endpoints (max 500, default 200) on purpose: a roster is one competition's entrants, bounded by that competition rather than by the platform, and a consumer usually wants all of it.","name":"limit","in":"query"}],"responses":{"200":{"description":"Entrants with per-entry funding progress.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionEntrantResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}/leaderboard":{"get":{"summary":"Get a competition's standings","description":"Returns the standings. Once scoring is final this serves the FROZEN board — the exact rows that decided prizes — and the live computation until then, so the rank shown is the rank the payout used. `rank` is a dense rank: tied entrants SHARE a rank and the sequence can repeat, so do not treat it as a position index. `accuracyBps` and `updatedAt` stay `null` for an entrant who has never scored, which is distinguishable from a real zero. `realizedPnlAtomic` is SIGNED and negative for a losing entrant. Cursor-paginated on `(rank, entrantId)` — the tuple, because a dense rank ties and a cursor on `rank` alone would skip the entrants tied with the last row of a page: pass `pagination.cursor` back as `?cursor=` while `hasMore` is true. Cursors are opaque and per-list: one from another endpoint is a `400 VALIDATION_FAILED`. Requires `markets:read` scope.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":200,"description":"Rows per page. Larger than the list endpoints (max 500, default 200) on purpose: a roster is one competition's entrants, bounded by that competition rather than by the platform, and a consumer usually wants all of it."},"required":false,"description":"Rows per page. Larger than the list endpoints (max 500, default 200) on purpose: a roster is one competition's entrants, bounded by that competition rather than by the platform, and a consumer usually wants all of it.","name":"limit","in":"query"}],"responses":{"200":{"description":"Competition standings, best rank first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionLeaderboardEntryResource"}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}/claim":{"post":{"summary":"Claim a competition prize","description":"Claims the caller's prize or airdrop for a settled competition. Resolves the caller's prize-eligible entrant in the active settlement (a `user` entrant directly, a `group` entrant via group-owner verification), records the escrow payout (idempotent — a re-claim returns the same recorded payout), and emits `competition.prize-claimed.v1`. Returns `403 COMPETITION_PRIZE_NOT_CLAIMABLE` when the caller owns no prize-eligible entrant OR owns more than one prize-eligible entrant in the active settlement (the endpoint refuses rather than pay an arbitrary one), `409 COMPETITION_PRIZE_AUTO_DISTRIBUTED` when the competition auto-distributes prizes (`offchain_airdrop`/`none`, not pull-claimed here), `409 COMPETITION_NOT_SETTLED` before winners are declared, and `404 COMPETITION_NOT_FOUND` for an unknown competition. Requires the `trades:write` scope; honours the `Idempotency-Key` HTTP header.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"Prize claimed (idempotent — a re-claim returns the same recorded claim).","content":{"application/json":{"schema":{"type":"object","properties":{"claim":{"$ref":"#/components/schemas/CompetitionClaimResource"},"data":{"$ref":"#/components/schemas/CompetitionClaimResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["claim","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}/refund":{"post":{"summary":"Refund your contributions from a cancelled competition","description":"Returns the caller's OWN contributions from a CANCELLED competition. The amount is resolved server-side from the caller's contribution rows, net of refunds already paid to them — there is no request body, because nothing here is the client's to choose. In a pooled group entry each member is refunded their own contribution independently, so a member never pulls the pool. Idempotent by construction rather than by a flag: a repeat call resolves nothing outstanding and returns `404 COMPETITION_NOTHING_TO_REFUND`, which is also what a non-contributor receives. Returns `409 COMPETITION_NOT_CANCELLED` while the competition is still live (a settled competition pays through `/claim` instead), `409 COMPETITION_REFUND_FAILED` when the resolved amount is rejected by the payout bound, and `404 COMPETITION_NOT_FOUND` for an unknown competition. Requires the `trades:write` scope; honours the `Idempotency-Key` HTTP header.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"}],"responses":{"200":{"description":"The caller's refunded contributions and their exact total.","content":{"application/json":{"schema":{"type":"object","properties":{"refund":{"type":"object","properties":{"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"refunds":{"type":"array","items":{"type":"object","properties":{"entrantId":{"type":"string","format":"uuid","example":"3b1f0e5c-6a2d-4f88-9c1e-77a0b4d9e210"},"amountAtomic":{"type":"string","example":"6000000"}},"required":["entrantId","amountAtomic"]}},"totalRefundedAtomic":{"type":"string","example":"6000000"},"partial":{"type":"boolean","example":false},"refundedAt":{"type":"string","example":"2026-09-02T23:59:00.000Z"}},"required":["competitionId","refunds","totalRefundedAtomic","partial","refundedAt"]},"data":{"type":"object","properties":{"competitionId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"refunds":{"type":"array","items":{"type":"object","properties":{"entrantId":{"type":"string","format":"uuid","example":"3b1f0e5c-6a2d-4f88-9c1e-77a0b4d9e210"},"amountAtomic":{"type":"string","example":"6000000"}},"required":["entrantId","amountAtomic"]}},"totalRefundedAtomic":{"type":"string","example":"6000000"},"partial":{"type":"boolean","example":false},"refundedAt":{"type":"string","example":"2026-09-02T23:59:00.000Z"}},"required":["competitionId","refunds","totalRefundedAtomic","partial","refundedAt"]},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["refund","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}/join":{"post":{"summary":"Enter a competition","description":"Creates a competition entry. Joining does NOT pay: the entry is created in `funding` with zero funding and becomes scoreable only once its members have contributed the minimum amount via `POST /v1/competitions/{competitionId}/contribute`. Only a group OWNER may enter a group (`403 COMPETITION_NOT_GROUP_OWNER`); an individual entry is always for the authenticated caller, never a body-supplied user. A second entry for the same group or user is refused with `409 COMPETITION_ALREADY_ENTERED` — fund the existing entry instead, since a second would split the pool across two entries and neither might reach the minimum. Requires the `trades:write` scope; honours the `Idempotency-Key` HTTP header.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["group","user"],"example":"group"},"groupId":{"type":"string","format":"uuid","example":"3f2b1c8e-7d4a-4e9b-9c1a-5d8f2e6b0a71"},"subjectName":{"type":"string","minLength":1,"maxLength":120,"example":"The Contrarians"},"payingAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$|^[1-9A-HJ-NP-Za-km-z]{32,44}$","example":"0x1111111111111111111111111111111111111111"}},"required":["subjectType","subjectName","payingAddress"]}}}},"responses":{"201":{"description":"Entry created, awaiting funding.","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"$ref":"#/components/schemas/CompetitionEntryResource"},"data":{"$ref":"#/components/schemas/CompetitionEntryResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["entry","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}/contribute":{"post":{"summary":"Pay into a pooled competition entry","description":"Records one member's contribution toward an entry's pooled fee. The MEMBER is the authenticated caller and is never taken from the body — contribution decides the payout split, so a body-supplied member would let anyone buy a share of another group's prize. Any member of the entry may contribute (`403 COMPETITION_NOT_ENTRY_MEMBER` otherwise), and each contribution must clear the competition's minimum ticket (`400 COMPETITION_CONTRIBUTION_BELOW_MINIMUM`). The entry is promoted to `joined` — and its roster captured — the moment the pool clears the minimum entry fee. `externalRef` is the on-chain op id and the IDEMPOTENCY key for the money: a retried confirmation of the same transfer credits nothing, while a genuine second transfer carries its own ref. The returned `memberContributionAtomic` is the member's RUNNING TOTAL, read back after the write. Requires the `trades:write` scope.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entrantId":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"amountAtomic":{"type":"string","maxLength":78,"pattern":"^\\d+$","example":"40000000"},"payingAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$|^[1-9A-HJ-NP-Za-km-z]{32,44}$","example":"0x1111111111111111111111111111111111111111"},"externalRef":{"type":"string","minLength":1,"maxLength":200,"example":"0xabc123…"}},"required":["entrantId","amountAtomic","payingAddress","externalRef"]}}}},"responses":{"200":{"description":"Contribution recorded (idempotent on `externalRef`).","content":{"application/json":{"schema":{"type":"object","properties":{"contribution":{"$ref":"#/components/schemas/CompetitionContributionResource"},"data":{"$ref":"#/components/schemas/CompetitionContributionResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["contribution","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/competitions/{competitionId}/sponsor":{"post":{"summary":"Sponsor a competition pot","description":"Adds the calling organization's money to a competition's prize pot. There is deliberately NO sponsor address in the body: a cancelled competition's prefund is reclaimable by whatever address the prefund NAMES, so the attribution decides who can withdraw the money. The address is resolved server-side from the API key's organization, and an organization with no smart account is refused (`409 COMPETITION_SPONSOR_NO_SMART_ACCOUNT`) rather than credited to an empty address nobody could reclaim. Only `onchain_escrow`/`sponsored` competitions hold a sponsorable pot, and only before settlement — adding to a pot already being paid out would change the amount settlement was authorised against. `externalRef` is the on-chain op id and the idempotency key. Requires the `trades:write` scope.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"required":true,"name":"competitionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amountAtomic":{"type":"string","maxLength":78,"pattern":"^\\d+$","example":"1000000000"},"externalRef":{"type":"string","minLength":1,"maxLength":200,"example":"0xabc123…"}},"required":["amountAtomic","externalRef"]}}}},"responses":{"200":{"description":"Sponsorship recorded (idempotent on `externalRef`).","content":{"application/json":{"schema":{"type":"object","properties":{"sponsorship":{"$ref":"#/components/schemas/CompetitionSponsorshipResource"},"data":{"$ref":"#/components/schemas/CompetitionSponsorshipResource"},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["sponsorship","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/trades/{id}/confirm":{"post":{"summary":"Confirm a high-value trade","description":"Releases a trade in `pending_confirmation` (returned via 202 from POST /v1/trades) into the executor pipeline. Single-use token; subsequent attempts return 409 CONFIRMATION_TOKEN_USED. Release is subject to the same admission control as POST /v1/trades (429 `TRADE_IN_FLIGHT_LIMIT_EXCEEDED`, 503 `TRADE_ADMISSION_BUSY`); a refused confirm writes nothing, so the token stays valid for a retry.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":40,"maxLength":64,"example":"kVAa4iL_xQyP8jHqM7nF2tR3wL5vY9zX1bN0gK6cE8hJqWmZ7sR"}},"required":["token"]}}}},"responses":{"200":{"description":"Trade released into the pipeline.","content":{"application/json":{"schema":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["trade","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/trades/{id}":{"get":{"summary":"Get a single trade","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Trade resource.","content":{"application/json":{"schema":{"type":"object","properties":{"trade":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b8c5e3d1-4a7c-4b2e-8f5d-1c9a3e7b6f8d"},"marketId":{"type":"string","format":"uuid","example":"7a6e9c0a-3f4f-4c43-b6ab-1b2f0c8e3c91"},"outcomeIndex":{"type":"integer","minimum":0,"example":0},"amount":{"type":"string","pattern":"^(?:\\d+|\\d+\\.\\d{1,6})$","description":"USDC amount as a decimal string (e.g. \"100\" or \"100.500000\"). Up to 6 decimals.","example":"100"},"side":{"type":"string","enum":["buy","sell"],"example":"buy"},"status":{"type":"string","enum":["pending_confirmation","pending","validating","executing","completed","failed","rejected"],"example":"pending"},"correlationId":{"type":"string","format":"uuid","example":"d5f3e7c2-9b8a-4c1d-8e7f-3a5b9c1d2e4f"},"clientRequestId":{"type":["string","null"],"minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_\\-:.]+$","description":"Optional client-side idempotency token. Same value with same body returns the existing trade; same value with different body returns 409."},"chainRef":{"type":"string","example":"evm:8453"},"txHash":{"type":["string","null"],"description":"Chain transaction id: an EVM hash (`0x` + 64 hex) or a base58 Solana signature.","example":"0x9b3a4c1f8e7d6b5a2f9c8e1d4b7a6f3c2e5d8b9a1f4c7e3d6b5a8f2c1e9b4d7a"},"tokensOut":{"type":["string","null"],"pattern":"^\\d+$","example":"105420000000000000000"},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"webhookDelivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["status","attempts","lastAttemptedAt","lastStatusCode","lastFailureCode","terminalFailureAt"]},"metadata":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"createdAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:56Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-30T12:34:57Z"}},"required":["id","marketId","outcomeIndex","amount","side","status","correlationId","clientRequestId","txHash","tokensOut","errorCode","errorMessage","webhookDelivery","createdAt","updatedAt"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["trade","data","_meta"]}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/traces/{correlationId}":{"get":{"summary":"Get the curated event timeline for a correlation id","description":"Returns the sanitized event timeline for a single trade's correlation id (intent → funding → bridge → execution → webhook delivery). Each event carries a stable, allowlisted subset of the originating event payload — raw event_data is never returned. Returns 404 (not 403) when the correlation id is unknown OR the caller does not own the underlying trade — by design, to prevent enumeration. Retention: events are kept for `retention.windowDays` (90) days and deleted after that (each lives 90 to ~121 days). For a trade created before the window, `retention.expired` is true and `events` may be incomplete or empty because they were deleted, not because nothing happened; only `com.kash.trade.rejected.v1` survives. The trade's own state remains on GET /v1/trades/{id} at any age.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"33333333-3333-3333-3333-333333333333"},"required":true,"name":"correlationId","in":"path"}],"responses":{"200":{"description":"Trace resource with curated event timeline.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTraceResponse"}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/markets":{"get":{"summary":"List markets","description":"Lists all markets, newest first. Requires `markets:read` scope (granted by default on every tier). The `status` filter matches the lifecycle status, which stays `ACTIVE` for a market cancelled on chain or past its freeze deadline; read each market's `tradeable` to know whether it accepts trades.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Page of markets.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"outcomeCount":{"type":"integer","exclusiveMinimum":0},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"imageUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"freezeAt":{"type":["string","null"],"format":"date-time"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"resolution":{"type":["object","null"],"properties":{"proposedOutcomeIndex":{"type":"integer","minimum":0},"proposedAt":{"type":["string","null"],"format":"date-time"},"finalizableAt":{"type":["string","null"],"format":"date-time"},"settlementStatus":{"type":"string","enum":["proposed","disputed","finalized","cancelled"]},"disputeOpen":{"type":"boolean"}},"required":["proposedOutcomeIndex","proposedAt","finalizableAt","settlementStatus","disputeOpen"]},"resolutionState":{"type":["string","null"],"enum":["resolving","proposed","settling","resolved","cancelled",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","title","description","status","outcomeCount","outcomes","imageUrl","createdAt","expiresAt","freezeAt","resolvedAt","resolution","resolutionState","tradeable","notTradeableReason"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/markets/{id}":{"get":{"summary":"Get a single market","description":"Returns the market with its outcome list. Requires `markets:read` scope (granted by default on every tier).","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Market resource.","content":{"application/json":{"schema":{"type":"object","properties":{"market":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"outcomeCount":{"type":"integer","exclusiveMinimum":0},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"imageUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"freezeAt":{"type":["string","null"],"format":"date-time"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"resolution":{"type":["object","null"],"properties":{"proposedOutcomeIndex":{"type":"integer","minimum":0},"proposedAt":{"type":["string","null"],"format":"date-time"},"finalizableAt":{"type":["string","null"],"format":"date-time"},"settlementStatus":{"type":"string","enum":["proposed","disputed","finalized","cancelled"]},"disputeOpen":{"type":"boolean"}},"required":["proposedOutcomeIndex","proposedAt","finalizableAt","settlementStatus","disputeOpen"]},"resolutionState":{"type":["string","null"],"enum":["resolving","proposed","settling","resolved","cancelled",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","title","description","status","outcomeCount","outcomes","imageUrl","createdAt","expiresAt","freezeAt","resolvedAt","resolution","resolutionState","tradeable","notTradeableReason"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"outcomeCount":{"type":"integer","exclusiveMinimum":0},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"imageUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"freezeAt":{"type":["string","null"],"format":"date-time"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"resolution":{"type":["object","null"],"properties":{"proposedOutcomeIndex":{"type":"integer","minimum":0},"proposedAt":{"type":["string","null"],"format":"date-time"},"finalizableAt":{"type":["string","null"],"format":"date-time"},"settlementStatus":{"type":"string","enum":["proposed","disputed","finalized","cancelled"]},"disputeOpen":{"type":"boolean"}},"required":["proposedOutcomeIndex","proposedAt","finalizableAt","settlementStatus","disputeOpen"]},"resolutionState":{"type":["string","null"],"enum":["resolving","proposed","settling","resolved","cancelled",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","title","description","status","outcomeCount","outcomes","imageUrl","createdAt","expiresAt","freezeAt","resolvedAt","resolution","resolutionState","tradeable","notTradeableReason"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["market","data","_meta"]}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/markets/{id}/predictions":{"get":{"summary":"List recent trades (predictions) against a market","description":"Returns recent trades for a market, newest first, cursor-paginated. Backs the `markets.history()` method on the protocol SDK. Requires `markets:read` scope (granted by default on every tier).","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["buy","sell"]},"required":false,"name":"side","in":"query"},{"schema":{"type":["integer","null"],"minimum":0},"required":false,"name":"outcomeIndex","in":"query"}],"responses":{"200":{"description":"Page of predictions (recent trades).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0},"side":{"type":"string","enum":["buy","sell"]},"usdcIn":{"type":["string","null"]},"usdcOut":{"type":["string","null"]},"tokensIn":{"type":["string","null"]},"tokensOut":{"type":["string","null"]},"price":{"type":"string"},"probability":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"blockNumber":{"type":"string"},"transactionHash":{"type":"string"},"logIndex":{"type":["integer","null"],"minimum":0}},"required":["id","marketId","outcomeIndex","side","usdcIn","usdcOut","tokensIn","tokensOut","price","probability","timestamp","blockNumber","transactionHash","logIndex"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/markets/{id}/disputes":{"post":{"summary":"File an off-chain dispute against a proposed market resolution","description":"Files the calling user's dispute against the market's pending resolution proposal (propose → dispute window → settle flow). Only allowed while the dispute window is open (until `finalizableAt`): an undisputed proposal is settled when its window ends, so a filing after that returns 409 `DISPUTE_WINDOW_CLOSED`. An open dispute blocks settlement until an admin decides the outcome; that decision is final, settled at once and cannot be disputed, so a filing after it returns 409 `DISPUTE_DECIDED`. One dispute per user per proposal; a second filing returns 409 `DISPUTE_ALREADY_FILED`. A market with no proposal, or whose settlement has begun, returns 422 `MARKET_NOT_DISPUTABLE`. Requires the `trades:write` scope (settlement-affecting write; deliberately reuses the existing scope rather than introducing a new one).","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":10,"maxLength":2000}},"required":["reason"]}}}},"responses":{"201":{"description":"Dispute filed; finalization is blocked pending operator review.","content":{"application/json":{"schema":{"type":"object","properties":{"dispute":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"_meta":{"$ref":"#/components/schemas/WriteResponseMeta"}},"required":["dispute","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"get":{"summary":"Get the calling user's dispute for a market","description":"Returns the latest dispute the calling user filed against this market (one per proposal), including the operator review outcome (`status`, `reviewedAt`, `reviewNote`). 404 when the caller has not filed one — by design, disputes filed by other users are never visible. Requires the `markets:read` scope (granted by default on every tier).","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The caller's dispute for this market.","content":{"application/json":{"schema":{"type":"object","properties":{"dispute":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"marketId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","reviewing","rejected","upheld"]},"reason":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewNote":{"type":["string","null"]}},"required":["id","marketId","status","reason","createdAt","reviewedAt","reviewNote"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["dispute","data","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/markets/{id}/quote":{"get":{"summary":"Quote a buy or sell against a market","description":"Returns an on-chain quote for a buy (`amount` in USDC atomic-6) or sell (`amount` in token WAD-18). All bigints come back as decimal strings — see the `units` block in the response. Requires `markets:quote` scope (granted by default on every tier). Quotes are RPC-heavy; this scope is split from `markets:read` so customers can throttle quote traffic independently. A quote on a Solana market requires API version `2026-08-19`, the default when no `X-Kash-Api-Version` header is sent: pinned to `2026-04-29` it returns 400 `CHAIN_NOT_SUPPORTED` whatever the market's state, so that 400 says nothing about whether the market is cancelled. A market cancelled on chain returns 409 `MARKET_NOT_TRADEABLE` (on `2026-08-19` for Solana), as does a Solana market whose on-chain state is no longer active. A quote is a read, so another untradeable market (for example one past its freeze deadline) can still be quoted: check `market.tradeable` in the response, or on the market resource before quoting. `POST /v1/trades` refuses every untradeable market with 409 `MARKET_NOT_TRADEABLE` on both versions.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":["integer","null"],"minimum":0},"required":false,"name":"outcomeIndex","in":"query"},{"schema":{"type":"string","enum":["buy","sell"]},"required":true,"name":"action","in":"query"},{"schema":{"type":"string","pattern":"^\\d+$"},"required":true,"name":"amount","in":"query"}],"responses":{"200":{"description":"Quote detail + market summary + units block.","content":{"application/json":{"schema":{"type":"object","properties":{"quote":{"oneOf":[{"type":"object","properties":{"outcomeIndex":{"type":"integer","minimum":0},"reserveAfter":{"type":"string","pattern":"^\\d+$"},"c":{"type":"string","pattern":"^\\d+$"},"pAfter":{"type":"array","items":{"type":"string","pattern":"^\\d+$"}},"qAfter":{"type":"array","items":{"type":"string","pattern":"^\\d+$"}},"effectivePrice":{"type":"number"},"impliedProbability":{"type":["number","null"],"minimum":0,"maximum":1},"action":{"type":"string","enum":["buy"]},"amountIn":{"type":"string","pattern":"^\\d+$"},"tokensOut":{"type":"string","pattern":"^\\d+$"}},"required":["outcomeIndex","reserveAfter","c","pAfter","qAfter","effectivePrice","impliedProbability","action","amountIn","tokensOut"]},{"type":"object","properties":{"outcomeIndex":{"type":"integer","minimum":0},"reserveAfter":{"type":"string","pattern":"^\\d+$"},"c":{"type":"string","pattern":"^\\d+$"},"pAfter":{"type":"array","items":{"type":"string","pattern":"^\\d+$"}},"qAfter":{"type":"array","items":{"type":"string","pattern":"^\\d+$"}},"effectivePrice":{"type":"number"},"impliedProbability":{"type":["number","null"],"minimum":0,"maximum":1},"action":{"type":"string","enum":["sell"]},"tokensIn":{"type":"string","pattern":"^\\d+$"},"usdcOut":{"type":"string","pattern":"^\\d+$"},"grossRelease":{"type":"string","pattern":"^\\d+$"}},"required":["outcomeIndex","reserveAfter","c","pAfter","qAfter","effectivePrice","impliedProbability","action","tokensIn","usdcOut","grossRelease"]}]},"market":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contractAddress":{"type":"string"},"chainId":{"type":"integer","exclusiveMinimum":0},"chainRef":{"type":"string","example":"evm:8453"},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"label":{"type":"string"},"probability":{"type":"number","minimum":0,"maximum":1}},"required":["index","label","probability"]}},"status":{"type":["string","null"],"enum":["UNSEEDED","ACTIVE","RESOLVED","ABANDONED",null]},"tradeable":{"type":"boolean","description":"Whether the market accepts trades right now. The same rule that refuses a trade with 409 `MARKET_NOT_TRADEABLE`, evaluated when the response was produced. `status` alone does not answer this: it stays `ACTIVE` for a cancelled or frozen market.","example":true},"notTradeableReason":{"type":["string","null"],"enum":["resolved","cancelled","inactive","frozen",null],"description":"Why the market does not accept trades right now, or null when it does. In precedence order: `resolved` (the outcome is final), `cancelled` (cancelled on chain; positions are refundable through redemption), `inactive` (the market status is not one that trades), `frozen` (the freeze deadline has passed).","example":null}},"required":["id","contractAddress","outcomes","status","tradeable","notTradeableReason"]},"units":{"type":"object","properties":{"usdc":{"type":"string","enum":["atomic-6"]},"token":{"type":"string","enum":["wad-18"]}},"required":["usdc","token"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["quote","market","units","_meta"]}}}},"400":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/portfolio":{"get":{"summary":"Get the authenticated user's portfolio summary","security":[{"XApiKey":[]}],"responses":{"200":{"description":"Portfolio summary.","content":{"application/json":{"schema":{"type":"object","properties":{"portfolio":{"type":"object","properties":{"smartAccountAddress":{"type":"string"},"activePositions":{"type":"integer","minimum":0},"totalCostBasisAtomic":{"type":"string","pattern":"^\\d+$"}},"required":["smartAccountAddress","activePositions","totalCostBasisAtomic"]},"data":{"type":"object","properties":{"smartAccountAddress":{"type":"string"},"activePositions":{"type":"integer","minimum":0},"totalCostBasisAtomic":{"type":"string","pattern":"^\\d+$"}},"required":["smartAccountAddress","activePositions","totalCostBasisAtomic"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["portfolio","data","_meta"]}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/portfolio/positions":{"get":{"summary":"List the authenticated user's active positions","description":"Supports conditional GET. Every `200` carries a weak `ETag`; send it back as `If-None-Match` and an unchanged position set is answered `304 Not Modified` with no body, without running the list query. Poll with `If-None-Match` (the SDK does this automatically from 0.3.0), or subscribe to `trade.completed` webhooks and read positions once per event instead of polling. A `304` still counts toward the rate limit.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"marketId","in":"query"},{"schema":{"type":"string","description":"An `ETag` from an earlier response. A match is answered `304`.","example":"W/\"pos1.2026-04-29.0123456789abcdef0123456789abcdef\""},"required":false,"name":"if-none-match","in":"header"}],"responses":{"200":{"description":"Active positions.","headers":{"ETag":{"description":"Weak validator of the position set. Opaque: compare it, never parse it.","schema":{"type":"string"}},"Cache-Control":{"description":"`private, no-cache` — per caller, always revalidate.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"marketId":{"type":"string","format":"uuid"},"outcomeIndex":{"type":"integer","minimum":0},"shares":{"type":"string","pattern":"^\\d+$"},"costBasisAtomic":{"type":"string","pattern":"^\\d+$"},"tradeCount":{"type":"integer","minimum":0},"firstTradeAt":{"type":"string","format":"date-time"},"lastTradeAt":{"type":"string","format":"date-time"}},"required":["marketId","outcomeIndex","shares","costBasisAtomic","tradeCount","firstTradeAt","lastTradeAt"]}},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","_meta"]}}}},"304":{"description":"Not Modified: `If-None-Match` matched the current position set. No body; reuse the response you already hold.","headers":{"ETag":{"description":"The current validator.","schema":{"type":"string"}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/account/usage":{"get":{"summary":"Per-key usage telemetry summary (24h / 7d / 30d windows)","description":"Single-round-trip rolling-window summary the webapp Settings page renders inline. Returns trade counts and success rates per window, p50/p99 end-to-end latency, webhook delivery success, and recent auth + rate-limit signals — all derived from the calling key's own audit + trade rows. Auth: requires the `auth:manage` scope.","security":[{"XApiKey":[]}],"responses":{"200":{"description":"Per-key usage summary for the calling API key.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"apiKeyId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"trades":{"type":"object","properties":{"24h":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1},"latencyMs":{"type":"object","properties":{"p50":{"type":["integer","null"]},"p99":{"type":["integer","null"]}},"required":["p50","p99"]}},"required":["total","completed","failed","successRate","latencyMs"]},"7d":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["total","completed","failed","successRate"]},"30d":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["total","completed","failed","successRate"]}},"required":["24h","7d","30d"]},"webhooks":{"type":"object","properties":{"7d":{"type":"object","properties":{"emitted":{"type":"integer","minimum":0},"delivered":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"successRate":{"type":["number","null"],"minimum":0,"maximum":1}},"required":["emitted","delivered","failed","successRate"]}},"required":["7d"]},"auth":{"type":"object","properties":{"24h":{"type":"object","properties":{"failures":{"type":"integer","minimum":0},"rateLimitRejections":{"type":"integer","minimum":0}},"required":["failures","rateLimitRejections"]}},"required":["24h"]}},"required":["apiKeyId","generatedAt","trades","webhooks","auth"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","_meta"]}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/webhooks/events":{"get":{"summary":"List recent webhook deliveries for the calling key","description":"Paginated, newest-first list of webhook events scoped strictly to the calling key (api_key_id, not user_id — cross-key leaks are impossible). Each row carries the same delivery-state shape that surfaces inline on a trade resource's `webhookDelivery`. Auth: requires the `webhooks:manage` scope.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Page of webhook events with cursor pagination.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"tradeRequestId":{"type":["string","null"],"format":"uuid"},"emittedAt":{"type":"string","format":"date-time"},"outboxEmittedAt":{"type":["string","null"],"format":"date-time"},"replayCount":{"type":"integer","minimum":0},"status":{"type":"string","enum":["none","pending","delivered","retrying","failed"]},"delivery":{"type":"object","properties":{"attempts":{"type":"integer","minimum":0},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"lastDeliveredAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastFailureCode":{"type":["string","null"]},"lastErrorMessage":{"type":["string","null"]},"terminalFailureAt":{"type":["string","null"],"format":"date-time"}},"required":["attempts","lastAttemptedAt","lastDeliveredAt","lastStatusCode","lastFailureCode","lastErrorMessage","terminalFailureAt"]}},"required":["id","eventType","tradeRequestId","emittedAt","outboxEmittedAt","replayCount","status","delivery"]}},"pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"_meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["data","pagination","_meta"]}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/webhooks/events/{eventId}/redeliver":{"post":{"summary":"Re-emit a previously-shipped webhook event","description":"Idempotent at the customer's dedupe layer: the redelivered webhook carries the same X-Kash-Event-Id as the original, so a customer who already processed the first delivery treats the replay as a no-op. Capped at 5 replays per event to bound amplification. Auth: requires the `webhooks:manage` scope.","security":[{"XApiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"eventId","in":"path"}],"responses":{"202":{"description":"Replay accepted; delivery worker drains the FIFO queue at its own cadence.","content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"apiKeyId":{"type":"string","format":"uuid"},"tradeRequestId":{"type":["string","null"],"format":"uuid"},"emittedAt":{"type":"string","format":"date-time"},"lastDeliveredAt":{"type":["string","null"],"format":"date-time"},"deliveryAttempts":{"type":"integer","minimum":0}},"required":["id","eventType","apiKeyId","tradeRequestId","emittedAt","lastDeliveredAt","deliveryAttempts"]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"apiKeyId":{"type":"string","format":"uuid"},"tradeRequestId":{"type":["string","null"],"format":"uuid"},"emittedAt":{"type":"string","format":"date-time"},"lastDeliveredAt":{"type":["string","null"],"format":"date-time"},"deliveryAttempts":{"type":"integer","minimum":0}},"required":["id","eventType","apiKeyId","tradeRequestId","emittedAt","lastDeliveredAt","deliveryAttempts"]},"_meta":{"allOf":[{"$ref":"#/components/schemas/ResponseMeta"},{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}]}},"required":["event","data","_meta"]}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/v1/auth/api-keys/me/webhook-secret/rotate":{"post":{"summary":"Rotate the webhook signing secret for the authenticating API key","description":"Self-service: the key authenticates itself; no path param. The plaintext secret is returned ONCE — capture it from this response. The previous secret is retained for the 7-day overlap window during which the worker dual-signs deliveries (`X-Kash-Signature: t=<ms>,v1=<new>,v1=<previous>`), so verifiers on either secret accept the signature. Returns 429 `WEBHOOK_SECRET_ROTATION_COOLDOWN` if called within 60s of a prior successful rotation — this protects the rollback slot against retry-storm double-rotation. Auth: requires the `webhooks:manage` scope.","security":[{"XApiKey":[]}],"responses":{"200":{"description":"Rotation complete; capture the new plaintext secret immediately.","content":{"application/json":{"schema":{"type":"object","properties":{"webhookSecret":{"type":"object","properties":{"secret":{"type":"string"},"rotatedAt":{"type":"string","format":"date-time"},"previousRetainedUntil":{"type":"string","format":"date-time"}},"required":["secret","rotatedAt","previousRetainedUntil"]},"data":{"type":"object","properties":{"secret":{"type":"string"},"rotatedAt":{"type":"string","format":"date-time"},"previousRetainedUntil":{"type":"string","format":"date-time"}},"required":["secret","rotatedAt","previousRetainedUntil"]},"_meta":{"allOf":[{"$ref":"#/components/schemas/ResponseMeta"},{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}]}},"required":["webhookSecret","data","_meta"]}}}},"401":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"RFC 7807 Problem Details","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"webhooks":{"trade.confirmation-required":{"post":{"summary":"High-value trade is awaiting explicit confirmation","description":"Fires when POST /v1/trades returns a 202 Accepted with a confirmation token. The customer endpoint should surface to a human (or auto-approve via policy) and POST the token to /v1/trades/{id}/confirm before `confirmationExpiresAt` — otherwise the trade auto-cancels.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradeConfirmationRequiredEnvelope"}}}},"responses":{"200":{"description":"ACK — delivery confirmed; no further attempts."},"202":{"description":"Acknowledged for async processing — also confirms delivery."},"4XX":{"description":"Permanent failure — customer endpoint rejected the payload. Delivery worker classifies as terminal and surfaces via /v1/webhooks/events. Use POST /v1/webhooks/events/{id}/redeliver after fixing the endpoint."},"5XX":{"description":"Transient failure — retried about every 2 minutes, up to 10 attempts, then moved to the DLQ."}}}},"trade.completed":{"post":{"summary":"Trade reached terminal success","description":"Fires when a trade row reaches `status: 'completed'`. The on-chain transaction has been mined; `txHash` and `tokensOut` are final. No further events for this trade.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradeCompletedEnvelope"}}}},"responses":{"200":{"description":"ACK — delivery confirmed; no further attempts."},"202":{"description":"Acknowledged for async processing — also confirms delivery."},"4XX":{"description":"Permanent failure — customer endpoint rejected the payload. Delivery worker classifies as terminal and surfaces via /v1/webhooks/events. Use POST /v1/webhooks/events/{id}/redeliver after fixing the endpoint."},"5XX":{"description":"Transient failure — retried about every 2 minutes, up to 10 attempts, then moved to the DLQ."}}}},"trade.failed":{"post":{"summary":"Trade reached terminal failure (execution-time)","description":"Fires when a trade was submitted on-chain but failed during execution (RPC revert, balance race, etc.). `errorCode` is a stable token (see the per-code docs at /v1/errors); `errorMessage` is a sanitised human description. For pre-execution rejections (risk-engine declined the trade) see the separate `trade.rejected` event. No further events for this trade.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradeFailedEnvelope"}}}},"responses":{"200":{"description":"ACK — delivery confirmed; no further attempts."},"202":{"description":"Acknowledged for async processing — also confirms delivery."},"4XX":{"description":"Permanent failure — customer endpoint rejected the payload. Delivery worker classifies as terminal and surfaces via /v1/webhooks/events. Use POST /v1/webhooks/events/{id}/redeliver after fixing the endpoint."},"5XX":{"description":"Transient failure — retried about every 2 minutes, up to 10 attempts, then moved to the DLQ."}}}},"trade.rejected":{"post":{"summary":"Trade rejected before on-chain execution","description":"Fires when the risk engine declined a trade BEFORE submission (per-trade cap, daily spend cap, sanctions / KYC gate, kill switch, etc.). The trade was never broadcast, so there is no `txHash` and no `tokensOut`. `errorCode` is a stable token (see the per-code docs at /v1/errors). Distinct from `trade.failed`, which fires for execution-time failures. No further events for this trade.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradeRejectedEnvelope"}}}},"responses":{"200":{"description":"ACK — delivery confirmed; no further attempts."},"202":{"description":"Acknowledged for async processing — also confirms delivery."},"4XX":{"description":"Permanent failure — customer endpoint rejected the payload. Delivery worker classifies as terminal and surfaces via /v1/webhooks/events. Use POST /v1/webhooks/events/{id}/redeliver after fixing the endpoint."},"5XX":{"description":"Transient failure — retried about every 2 minutes, up to 10 attempts, then moved to the DLQ."}}}}}}