{"openapi":"3.1.0","info":{"title":"Remwa Avatars API","version":"1.0.0","description":"REST v1. Errors are `{ \"error\": { \"code\", \"message\", \"details\"? } }`. Lists are newest first; page with `before` set to the last item's created_at."},"servers":[{"url":"/api/v1"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key, `av_test_…` or `av_live_…`. Server-side only; browsers get client tokens from POST /sessions"}},"schemas":{"Avatar":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["stock","photo","video_twin","3d"]},"status":{"type":"string","enum":["pending","processing","ready","failed","disabled"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","name","type","status","created_at"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"]}},"required":["error"]},"Voice":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"language":{"type":"string","pattern":"^[a-z]{2,3}$","description":"ISO 639 code, e.g. en, lg, sw","example":"en"},"type":{"type":"string","enum":["stock","cloned"]},"status":{"type":"string","enum":["pending","processing","ready","failed","disabled"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","name","language","type","status","created_at"]},"Persona":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"avatar_id":{"type":"string","format":"uuid"},"voice_id":{"type":"string","format":"uuid"},"language":{"type":"string","pattern":"^[a-z]{2,3}$","description":"ISO 639 code, e.g. en, lg, sw","example":"en"},"llm":{"type":"object","properties":{"model":{"type":"string","maxLength":100,"description":"Hosted model; empty for the platform default"}},"additionalProperties":false},"system_prompt":{"type":"string"},"greeting":{"type":"string"},"status":{"type":"string","enum":["active","disabled"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","avatar_id","voice_id","language","llm","system_prompt","greeting","status","created_at","updated_at"]},"PersonaCreate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"avatar_id":{"type":"string","format":"uuid"},"voice_id":{"type":"string","format":"uuid"},"language":{"type":"string","pattern":"^[a-z]{2,3}$","default":"en","description":"ISO 639 code, e.g. en, lg, sw","example":"en"},"system_prompt":{"type":"string","maxLength":20000,"default":""},"greeting":{"type":"string","maxLength":2000,"default":""},"llm":{"type":"object","properties":{"model":{"type":"string","maxLength":100,"description":"Hosted model; empty for the platform default"}},"default":{},"additionalProperties":false}},"required":["name","avatar_id","voice_id"],"additionalProperties":false},"PersonaUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"avatar_id":{"type":"string","format":"uuid"},"voice_id":{"type":"string","format":"uuid"},"language":{"type":"string","pattern":"^[a-z]{2,3}$","description":"ISO 639 code, e.g. en, lg, sw","example":"en"},"system_prompt":{"type":"string","maxLength":20000},"greeting":{"type":"string","maxLength":2000},"llm":{"type":"object","properties":{"model":{"type":"string","maxLength":100,"description":"Hosted model; empty for the platform default"}},"additionalProperties":false},"status":{"type":"string","enum":["active","disabled"]}},"additionalProperties":false},"SessionStarted":{"allOf":[{"$ref":"#/components/schemas/Session"},{"type":"object","properties":{"room_url":{"type":"string","description":"LiveKit server URL for the client SDK"},"client_token":{"type":"string","description":"Join token for this one room. Give it to the browser; never give it an API key"},"client_token_expires_at":{"type":"string","format":"date-time"}},"required":["room_url","client_token","client_token_expires_at"]}]},"Session":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"persona_id":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["3d","2d","audio_to_video"]},"state":{"type":"string","enum":["requested","provisioning","waiting_for_client","active","recovering","ending","ended","failed"]},"room":{"type":["string","null"]},"started_at":{"type":["string","null"],"format":"date-time"},"ended_at":{"type":["string","null"],"format":"date-time"},"end_reason":{"type":["string","null"]},"active_seconds":{"type":"number"},"end_user_ref":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","persona_id","mode","state","room","started_at","ended_at","end_reason","active_seconds","end_user_ref","created_at"]},"SessionCreate":{"type":"object","properties":{"persona_id":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["3d","2d"],"default":"3d","description":"Render mode. Only 3d is live in v1.0"},"end_user_ref":{"type":"string","minLength":1,"maxLength":200,"description":"Your own reference for the end user; never shown to them"}},"required":["persona_id"],"additionalProperties":false},"Video":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"persona_id":{"type":["string","null"],"format":"uuid"},"avatar_id":{"type":["string","null"],"format":"uuid"},"script":{"type":"string"},"status":{"type":"string","enum":["queued","rendering","completed","failed","cancelled"]},"output_ref":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","persona_id","avatar_id","script","status","output_ref","created_at"]},"VideoCreate":{"type":"object","properties":{"script":{"type":"string","minLength":1,"maxLength":100000},"persona_id":{"type":"string","format":"uuid"},"avatar_id":{"type":"string","format":"uuid"}},"required":["script"],"additionalProperties":false},"WebhookEndpointCreated":{"allOf":[{"$ref":"#/components/schemas/WebhookEndpoint"},{"type":"object","properties":{"secret":{"type":"string","description":"Signing secret. Shown once; store it now"}},"required":["secret"]}]},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string","enum":["avatar.ready","video.completed","session.ended","consent.revoked"]}},"enabled":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","url","events","enabled","created_at"]},"WebhookCreate":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"description":"Public HTTPS URL","example":"https://example.com/avatar-webhooks"},"events":{"type":"array","items":{"type":"string","enum":["avatar.ready","video.completed","session.ended","consent.revoked"]},"minItems":1}},"required":["url","events"],"additionalProperties":false}},"parameters":{}},"paths":{"/avatars":{"get":{"tags":["Catalogue"],"summary":"List your avatars and the stock library","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Return items created before this time (the last item's created_at)"},"required":false,"description":"Return items created before this time (the last item's created_at)","name":"before","in":"query"}],"responses":{"200":{"description":"Avatars","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Avatar"}},"has_more":{"type":"boolean"}},"required":["data","has_more"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/voices":{"get":{"tags":["Catalogue"],"summary":"List your voices and the stock voices","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Return items created before this time (the last item's created_at)"},"required":false,"description":"Return items created before this time (the last item's created_at)","name":"before","in":"query"}],"responses":{"200":{"description":"Voices","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Voice"}},"has_more":{"type":"boolean"}},"required":["data","has_more"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/personas":{"post":{"tags":["Personas"],"summary":"Create a persona","security":[{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonaCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Persona"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Personas"],"summary":"List personas","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Return items created before this time (the last item's created_at)"},"required":false,"description":"Return items created before this time (the last item's created_at)","name":"before","in":"query"}],"responses":{"200":{"description":"Personas","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Persona"}},"has_more":{"type":"boolean"}},"required":["data","has_more"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/personas/{id}":{"get":{"tags":["Personas"],"summary":"Get a persona","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Persona","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Persona"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Personas"],"summary":"Update or disable a persona","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonaUpdate"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Persona"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sessions":{"post":{"tags":["Sessions"],"summary":"Start a real-time session","description":"Returns the room URL and a client token valid 10 minutes for joining. Pass both to the browser SDK.","security":[{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionCreate"}}}},"responses":{"201":{"description":"Started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStarted"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Sessions"],"summary":"List sessions","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Return items created before this time (the last item's created_at)"},"required":false,"description":"Return items created before this time (the last item's created_at)","name":"before","in":"query"}],"responses":{"200":{"description":"Sessions","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Session"}},"has_more":{"type":"boolean"}},"required":["data","has_more"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sessions/{id}":{"get":{"tags":["Sessions"],"summary":"Get a session","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sessions/{id}/end":{"post":{"tags":["Sessions"],"summary":"End a session","description":"Disconnects the end user and the avatar and sends session.ended. Ending an ended session returns it unchanged.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Ended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/videos":{"post":{"tags":["Videos"],"summary":"Queue a video","security":[{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VideoCreate"}}}},"responses":{"201":{"description":"Queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Video"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Videos"],"summary":"List videos","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Return items created before this time (the last item's created_at)"},"required":false,"description":"Return items created before this time (the last item's created_at)","name":"before","in":"query"}],"responses":{"200":{"description":"Videos","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Video"}},"has_more":{"type":"boolean"}},"required":["data","has_more"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/videos/{id}":{"get":{"tags":["Videos"],"summary":"Get a video's status","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Video","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Video"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"post":{"tags":["Webhooks"],"summary":"Add a webhook endpoint","description":"The response carries the signing secret, shown this once. Each delivery has headers Avatar-Event, Avatar-Delivery (dedupe on it: delivery is at least once) and Avatar-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the secret>. Reject a t more than 5 minutes off. Failed deliveries are retried after 1, 5, 30, 120 and 480 minutes.","security":[{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointCreated"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Webhooks"],"summary":"List webhook endpoints","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Return items created before this time (the last item's created_at)"},"required":false,"description":"Return items created before this time (the last item's created_at)","name":"before","in":"query"}],"responses":{"200":{"description":"Endpoints","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"has_more":{"type":"boolean"}},"required":["data","has_more"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}":{"delete":{"tags":["Webhooks"],"summary":"Remove a webhook endpoint","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Removed"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in your organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule (consent, persona, URL guard)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}