{"openapi":"3.1.0","info":{"title":"Sureel AI Partner API","description":"### Partner API Key Authentication\nAI Partner endpoints authenticate with a scoped Sureel Partner API key (`sl_pk_...`), **not** Auth0 OAuth2.\n\nPass your key in either header:\n\n```http\nAuthorization: Bearer sl_pk_<your_key>\n```\n\nor:\n\n```http\nX-API-Key: sl_pk_<your_key>\n```\n\n**Scopes**\n- `permission_feed:read` — Required for `GET /v1/ai/permission-feed/messages`\n- `permission_feed:ack` — Required for `POST /v1/ai/permission-feed/messages/{message_id}/ack`\n\n**Errors & Rate Limits**\n- `401` (`invalid_api_key`): Missing, malformed, revoked, or expired key\n- `403` (`insufficient_scope`): Key lacks the scope required by the endpoint\n- `429`: Rate limit exceeded (default 1,200 requests per 60s window per key)\n\n### Permission Delta Feed (`sureel.ai/permission-delta/1`)\nThe Permission Delta Feed delivers incremental rights and NILV permission updates for subjects in your partner scope.\n\n1. **Long-Poll with a Cursor**: Call `GET /v1/ai/permission-feed/messages?after_sequence=<cursor>&wait_ms=20000`. Start from `after_sequence=0` on initial bootstrap and persist `next_after_sequence` as your next cursor. Set your HTTP client timeout slightly above `wait_ms` (e.g., 25–30 seconds).\n2. **30-Second Leases & Automatic Redelivery**: Returned messages are leased for 30 seconds (`leased_until`). If a lease expires before an acknowledgement arrives, the message is automatically re-sequenced to the head of your queue and redelivered on a subsequent poll without rewinding your cursor.\n3. **Two-Step Enforcement Handshake**:\n   - Send `POST /v1/ai/permission-feed/messages/{message_id}/ack` with `{\"state\": \"received\", \"timestamp\": \"...\"}` promptly on receipt (extends the lease by another 30 seconds while enforcement propagates).\n   - Send `{\"state\": \"applied\", ...}` once enforcement is active (`match_status`: `matched` or `retained_unmatched`) to advance the applied baseline, or `{\"state\": \"rejected\", ...}` if the payload cannot be enforced.\n4. **Snapshots & Filtering**: Every message includes both the incremental `changes` array and the complete `effective` rule snapshot (`default: \"block\"`). Filter optionally with `subject_type` (`track` | `party`) and `mode` (`test` | `live`).\n\n**Poll Example**\n\n```bash\ncurl --request GET \\\n  --url 'https://api.sureel.ai/v1/ai/permission-feed/messages?after_sequence=0&limit=100&wait_ms=20000' \\\n  --header 'Authorization: Bearer sl_pk_<your_key>'\n```","version":"","contact":{"name":"Sureel","url":"https://www.sureel.ai"}},"components":{"securitySchemes":{"PartnerApiKeyBearer":{"type":"http","scheme":"bearer","bearerFormat":"sl_pk_...","description":"Partner API key sent in the Authorization header (`Authorization: Bearer sl_pk_...`)."},"PartnerApiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Partner API key sent in the `X-API-Key` header (`X-API-Key: sl_pk_...`)."}},"schemas":{}},"paths":{"/v1/ai/permission-feed/messages":{"get":{"operationId":"pollPermissionFeedMessages","summary":"Poll pending permission delta messages","tags":["permission-feed"],"description":"Leases up to `limit` pending permission delta messages with `sequence > after_sequence` for 30 seconds (`leased_until`), optionally waiting up to `wait_ms` milliseconds for new messages. Authenticated via partner API key (`Authorization: Bearer <key>` or `X-API-Key: <key>`) with scope `permission_feed:read`.","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"example":0,"in":"query","name":"after_sequence","required":false,"description":"Return messages with sequence > after_sequence (including expired leases re-sequenced to the head)."},{"schema":{"minimum":1,"maximum":500,"default":100,"type":"integer"},"example":100,"in":"query","name":"limit","required":false,"description":"Maximum number of messages to lease in one response."},{"schema":{"minimum":0,"maximum":20000,"default":0,"type":"integer"},"example":0,"in":"query","name":"wait_ms","required":false,"description":"Optional long-poll wait duration in milliseconds before returning an empty batch."},{"schema":{"title":"PermissionFeedSubjectType","anyOf":[{"type":"string","enum":["track"]},{"type":"string","enum":["party"]}]},"in":"query","name":"subject_type","required":false},{"schema":{"title":"PermissionFeedMode","anyOf":[{"type":"string","enum":["test"]},{"type":"string","enum":["live"]}]},"in":"query","name":"mode","required":false}],"security":[{"PartnerApiKeyBearer":[]},{"PartnerApiKeyHeader":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PollPermissionFeedResponse","type":"object","required":["schema","recipient","messages","next_after_sequence","leased_until"],"properties":{"schema":{"examples":["sureel.ai/permission-delta/1"],"type":"string"},"recipient":{"examples":["suno"],"type":"string"},"messages":{"type":"array","items":{"title":"PermissionFeedMessage","type":"object","required":["message_id","schema","policy_version","sequence","created_at","recipient","mode","subject","territory","valid_from","valid_until","conditions","changes","effective"],"properties":{"message_id":{"type":"string"},"schema":{"type":"string"},"policy_version":{"type":"string"},"sequence":{"type":"integer"},"created_at":{"type":"string"},"recipient":{"type":"string"},"mode":{"title":"PermissionFeedMode","anyOf":[{"type":"string","enum":["test"]},{"type":"string","enum":["live"]}]},"subject":{"title":"PermissionFeedSubject","anyOf":[{"title":"PermissionFeedTrackSubject","type":"object","required":["type","isrc","iswc","work_id","title","release_upc","controlling_claimants"],"properties":{"type":{"type":"string","enum":["track"]},"isrc":{"type":"string"},"iswc":{"anyOf":[{"type":"string"},{"type":"null"}]},"work_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"title":{"type":"string"},"release_upc":{"anyOf":[{"type":"string"},{"type":"null"}]},"controlling_claimants":{"type":"array","items":{"title":"PermissionFeedControllingClaimant","type":"object","required":["party_id","isni","name","authorized_rights"],"properties":{"party_id":{"type":"string"},"isni":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"authorized_rights":{"type":"array","items":{"anyOf":[{"type":"string","enum":["recording"]},{"type":"string","enum":["publishing"]}]}}}}}}},{"title":"PermissionFeedPartySubject","type":"object","required":["type","party_type","party_id","isni","ipi","name"],"properties":{"type":{"type":"string","enum":["party"]},"party_type":{"anyOf":[{"type":"string","enum":["person"]},{"type":"string","enum":["group"]}]},"party_id":{"type":"string"},"isni":{"anyOf":[{"type":"string"},{"type":"null"}]},"ipi":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}}}]},"territory":{"type":"array","items":{"type":"string"}},"valid_from":{"type":"string"},"valid_until":{"anyOf":[{"type":"string"},{"type":"null"}]},"conditions":{"title":"PermissionFeedEnvelopeConditions","type":"object","required":["commercial_use","allowed_models"],"properties":{"commercial_use":{"anyOf":[{"type":"string","enum":["allowed"]},{"type":"string","enum":["non_commercial_only"]}]},"allowed_models":{"type":"array","items":{"type":"string"}}}},"changes":{"type":"array","items":{"title":"PermissionFeedRuleChange","type":"object","required":["key","from","to"],"properties":{"key":{"type":"string"},"from":{"title":"PermissionFeedDecision","anyOf":[{"type":"string","enum":["allow"]},{"type":"string","enum":["block"]},{"type":"string","enum":["review_required"]}]},"to":{"title":"PermissionFeedDecision","anyOf":[{"type":"string","enum":["allow"]},{"type":"string","enum":["block"]},{"type":"string","enum":["review_required"]}]}}}},"effective":{"title":"PermissionFeedEffectiveBlock","type":"object","required":["default","rules"],"properties":{"default":{"type":"string","enum":["block"]},"rules":{"type":"object","additionalProperties":{"title":"PermissionFeedDecision","anyOf":[{"type":"string","enum":["allow"]},{"type":"string","enum":["block"]},{"type":"string","enum":["review_required"]}]}},"rule_conditions":{"type":"object","additionalProperties":{"title":"PermissionFeedRuleCondition","type":"object","required":["content_filter_profile"],"properties":{"content_filter_profile":{"type":"string"},"user_preferences_ref":{"type":"string"},"user_preferences_refs":{"type":"array","items":{"type":"string"}}}}}}}}}},"next_after_sequence":{"minimum":0,"examples":[42],"type":"integer"},"leased_until":{"anyOf":[{"examples":["2026-11-19T16:09:11.470Z"],"type":"string"},{"type":"null"}]}}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/v1/ai/permission-feed/messages/{message_id}/ack":{"post":{"operationId":"ackPermissionFeedMessage","summary":"Acknowledge a permission delta message (two-step handshake)","tags":["permission-feed"],"description":"Records a `received`, `applied`, or `rejected` enforcement handshake step on a permission delta message. Authenticated via partner API key (`Authorization: Bearer <key>` or `X-API-Key: <key>`) with scope `permission_feed:ack`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"title":"AckPermissionFeedBody","anyOf":[{"title":"PermissionFeedReceivedAckBody","additionalProperties":false,"examples":[{"state":"received","timestamp":"2026-11-19T16:09:11.470Z"}],"type":"object","required":["state","timestamp"],"properties":{"state":{"type":"string","enum":["received"]},"timestamp":{"format":"date-time","minLength":1,"examples":["2026-11-19T16:09:11.470Z"],"type":"string"}}},{"title":"PermissionFeedAppliedAckBody","additionalProperties":false,"examples":[{"state":"applied","timestamp":"2026-11-19T16:09:11.470Z","active_at":"2026-11-19T16:09:11.470Z","active_in":["inference-prod","training-pipeline"],"policy_version":"sureel.ai/policy/2026-11","match_status":"matched","remaining_gaps":[]}],"type":"object","required":["state","timestamp","active_at","active_in","policy_version","match_status"],"properties":{"state":{"type":"string","enum":["applied"]},"timestamp":{"format":"date-time","minLength":1,"examples":["2026-11-19T16:09:11.470Z"],"type":"string"},"active_at":{"format":"date-time","minLength":1,"examples":["2026-11-19T16:09:11.470Z"],"type":"string"},"active_in":{"minItems":1,"maxItems":50,"examples":[["inference-prod","training-pipeline"]],"type":"array","items":{"minLength":1,"maxLength":256,"examples":["inference-prod"],"type":"string"}},"policy_version":{"minLength":1,"maxLength":256,"examples":["sureel.ai/policy/2026-11"],"description":"Policy version from the acknowledged message (for example `sureel.ai/policy/2026-11`).","type":"string"},"match_status":{"title":"PermissionFeedMatchStatus","examples":["matched"],"anyOf":[{"type":"string","enum":["matched"]},{"type":"string","enum":["retained_unmatched"]}]},"superseded_by_sequence":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"remaining_gaps":{"maxItems":50,"examples":[[]],"type":"array","items":{"minLength":1,"maxLength":256,"examples":["offline-batch-index"],"type":"string"}}}},{"title":"PermissionFeedRejectedAckBody","additionalProperties":false,"examples":[{"state":"rejected","timestamp":"2026-11-19T16:09:11.470Z","error":{"code":"INVALID_RULE_KEY","detail":"Unsupported rule key in effective.rules"}}],"type":"object","required":["state","timestamp","error"],"properties":{"state":{"type":"string","enum":["rejected"]},"timestamp":{"format":"date-time","minLength":1,"examples":["2026-11-19T16:09:11.470Z"],"type":"string"},"error":{"title":"PermissionFeedRejectionError","additionalProperties":false,"examples":[{"code":"INVALID_RULE_KEY","detail":"Unsupported rule key in effective.rules"}],"type":"object","required":["code","detail"],"properties":{"code":{"title":"PermissionFeedRejectionErrorCode","examples":["INVALID_RULE_KEY"],"anyOf":[{"type":"string","enum":["UNSUPPORTED_CONDITION"]},{"type":"string","enum":["INVALID_RULE_KEY"]},{"type":"string","enum":["MALFORMED_IDENTIFIER"]}]},"detail":{"minLength":1,"maxLength":2000,"examples":["Unsupported rule key in effective.rules"],"type":"string"}}}}}]},"examples":{"example1":{"value":{"state":"received","timestamp":"2026-11-19T16:09:11.470Z"}},"example2":{"value":{"state":"applied","timestamp":"2026-11-19T16:09:11.470Z","active_at":"2026-11-19T16:09:11.470Z","active_in":["inference-prod","training-pipeline"],"policy_version":"sureel.ai/policy/2026-11","match_status":"matched","remaining_gaps":[]}},"example3":{"value":{"state":"rejected","timestamp":"2026-11-19T16:09:11.470Z","error":{"code":"INVALID_RULE_KEY","detail":"Unsupported rule key in effective.rules"}}}}}}},"parameters":[{"schema":{"minLength":1,"maxLength":256,"type":"string"},"example":"msg_01JCP8V3E5M8R7D6K2Q9N4W1XY_trk_USRC17607839","in":"path","name":"message_id","required":true,"description":"External wire message identifier (`msg_...`)"}],"security":[{"PartnerApiKeyBearer":[]},{"PartnerApiKeyHeader":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"title":"AckPermissionFeedResponse","type":"object","required":["status","message"],"properties":{"status":{"type":"string","enum":["ok"]},"message":{"title":"PermissionFeedAckMessageState","type":"object","required":["message_id","sequence","state","leased_until","received_at","applied_at","active_at","match_status","superseded_by_sequence","rejected_at"],"properties":{"message_id":{"type":"string"},"sequence":{"type":"integer"},"state":{"title":"PermissionFeedState","anyOf":[{"type":"string","enum":["PENDING"]},{"type":"string","enum":["LEASED"]},{"type":"string","enum":["RECEIVED"]},{"type":"string","enum":["APPLIED"]},{"type":"string","enum":["REJECTED"]},{"type":"string","enum":["SUPERSEDED"]}]},"leased_until":{"anyOf":[{"type":"string"},{"type":"null"}]},"received_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"applied_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"active_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"match_status":{"anyOf":[{"title":"PermissionFeedMatchStatus","examples":["matched"],"anyOf":[{"type":"string","enum":["matched"]},{"type":"string","enum":["retained_unmatched"]}]},{"type":"null"}]},"superseded_by_sequence":{"anyOf":[{"type":"integer"},{"type":"null"}]},"rejected_at":{"anyOf":[{"type":"string"},{"type":"null"}]}}}}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"title":"PermissionFeedError","additionalProperties":true,"type":"object","properties":{"statusCode":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}},"servers":[{"url":"https://api.sureel.ai","description":"Production"}],"tags":[{"name":"permission-feed","description":"Incremental permission delta feed (`sureel.ai/permission-delta/1`) with cursor long-polling, 30-second leases, and two-step enforcement acknowledgements"}]}