POST/v1/auth/login

Returns access_token. Use it as the bearer token in subsequent requests.

curl -fsSL -X POST 'https://api.riavatar.tech/v1/auth/login' \
    -H "Content-Type: application/json" \
    -d '{
      "username": "YOUR_USERNAME",
      "password": "YOUR_PASSWORD"
    }'

POST/v1/auth/register

Creates an account and returns its access token.

curl -fsSL -X POST 'https://api.riavatar.tech/v1/auth/register' \
    -H "Content-Type: application/json" \
    -d '{
      "username": "YOUR_USERNAME",
      "password": "YOUR_PASSWORD"
    }'

GET/v1/session

Returns the account associated with the bearer token.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X GET 'https://api.riavatar.tech/v1/session' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

POST/v1/auth/logout

Revokes this bearer token. Other tokens are unaffected.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X POST 'https://api.riavatar.tech/v1/auth/logout' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

GET/v1/components

Returns supported voice IDs, localization keys, female/male voice metadata and the configured defaults.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X GET 'https://api.riavatar.tech/v1/components' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

GET/v1/characters

Lists characters owned by the current account.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X GET 'https://api.riavatar.tech/v1/characters' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

POST/v1/characters

Creates the character and returns its ID. Set voice_gender to female or male for automatic selection, or set voice_type to choose a voice from GET /v1/components.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X POST 'https://api.riavatar.tech/v1/characters' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "My character",
      "voice_gender": "female"
    }'

GET/v1/characters/{CHARACTER_ID}

Returns the saved character, voice and portrait preparation state.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"

curl -fsSL -X GET "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

PUT/v1/characters/{CHARACTER_ID}

Replaces editable character settings. Include existing values for settings you want to keep, including voice_type; omitted fields may reset to defaults.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"

curl -fsSL -X PUT "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Updated character",
      "voice_type": "VOICE_ID_FROM_COMPONENTS"
    }'

DELETE/v1/characters/{CHARACTER_ID}

Deletes the character owned by this account.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"

curl -fsSL -X DELETE "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

POST/v1/characters/{CHARACTER_ID}/avatar

Upload a portrait as JSON with avatar.filename and avatar.content_base64 (plain base64, no data URL). Maximum decoded size: 10 MiB. Its background is removed and the portrait is prepared for use.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"

curl -fsSL -X POST "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID/avatar" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    --data '{
      "avatar": {
        "filename": "portrait.png",
        "content_base64": "BASE64_OF_PORTRAIT_PNG"
      }
    }'

POST/v1/characters/{CHARACTER_ID}/offline-videos

Create a video with a JSON body. Use text, or set input_type to audio and provide audio.filename and audio.content_base64. Audio must be 16-bit PCM WAV, .pcm or .s16le. The decoded audio and text fields together must not exceed 96 MiB.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"

curl -fsSL -X POST "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID/offline-videos" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    --data '{
      "input_type": "text",
      "text": "Hello and welcome."
    }'

POST/v1/characters/{CHARACTER_ID}/knowledge/files

Upload knowledge files as a JSON files array. Each item has filename and content_base64; relative_path and content_type are optional. Maximum total decoded size: 96 MiB. Base64 increases upload size by about one third. Multipart requests are not accepted.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"

curl -fsSL -X POST "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID/knowledge/files" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    --data '{
      "files": [
        {
          "filename": "notes.txt",
          "content_base64": "SGVsbG8u",
          "content_type": "text/plain"
        }
      ]
    }'

GET/v1/characters/{CHARACTER_ID}/offline-videos/{JOB_ID}

Returns video generation progress and output information.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"
RIAVATAR_JOB_ID="JOB_ID_FROM_VIDEO_RESPONSE"

curl -fsSL -X GET "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID/offline-videos/$RIAVATAR_JOB_ID" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

GET/v1/characters/{CHARACTER_ID}/offline-videos/{JOB_ID}/video

Downloads the completed WebM video using bearer authentication.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_CHARACTER_ID="CHARACTER_ID_FROM_CREATE_RESPONSE"
RIAVATAR_JOB_ID="JOB_ID_FROM_VIDEO_RESPONSE"

curl -fsSL -X GET "https://api.riavatar.tech/v1/characters/$RIAVATAR_CHARACTER_ID/offline-videos/$RIAVATAR_JOB_ID/video" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -o "avatar.webm"

POST/v1/sessions

Creates a live session for a character. Returns session_id and a single-use websocket_ticket valid for 120 seconds to open the WebSocket connection.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X POST 'https://api.riavatar.tech/v1/sessions' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "character_id": "CHARACTER_ID"
    }'

POST/v1/auth/tickets

Returns a replacement single-use WebSocket ticket scoped to this session. Use access_ticket in the WebSocket URL; never put the bearer token in the URL.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X POST 'https://api.riavatar.tech/v1/auth/tickets' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "purpose": "websocket",
      "resource": "SESSION_ID"
    }'

WSS/v1/ws/chat/{SESSION_ID}

Connect with the session ID and access ticket. Send media capabilities before text or microphone input. Audio input is a JSON message containing base64-encoded PCM16 mono at 16 kHz.

wss://api.riavatar.tech/v1/ws/chat/SESSION_ID?access_ticket=ACCESS_TICKET

{"type":"media_capabilities","video_codecs":["h264","webp","jpeg"]}
{"type":"text_input","text":"Hello"}
{"type":"media_audio","data":"BASE64_PCM16_AUDIO"}
{"type":"interrupt"}

POST/v1/sessions/{SESSION_ID}/character

Switches an existing live session to another owned character. The current reply can finish before the new voice takes effect.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_SESSION_ID="SESSION_ID_FROM_SESSION_RESPONSE"

curl -fsSL -X POST "https://api.riavatar.tech/v1/sessions/$RIAVATAR_SESSION_ID/character" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "character_id": "OTHER_CHARACTER_ID"
    }'

DELETE/v1/sessions/{SESSION_ID}

Ends the live session.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_SESSION_ID="SESSION_ID_FROM_SESSION_RESPONSE"

curl -fsSL -X DELETE "https://api.riavatar.tech/v1/sessions/$RIAVATAR_SESSION_ID" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

GET/v1/platform

Returns enabled services, payment methods and package identifiers. No bearer token required.

curl -fsSL -X GET 'https://api.riavatar.tech/v1/platform'

GET/v1/account/history

Returns the latest 100 credit transactions for this account.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X GET 'https://api.riavatar.tech/v1/account/history' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

GET/v1/account/summary

Returns available credits, reserved credits, payment packages, check-in status and recent history.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X GET 'https://api.riavatar.tech/v1/account/summary' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

POST/v1/account/checkin

Claims the daily reward once for the current account.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X POST 'https://api.riavatar.tech/v1/account/checkin' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

POST/v1/payments/orders

Use a package_id and an available method from GET /v1/platform. Returns an order with checkout or QR information; creating an order does not confirm payment.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X POST 'https://api.riavatar.tech/v1/payments/orders' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "method": "alipay",
      "package_id": "PACKAGE_ID_FROM_PLATFORM"
    }'

GET/v1/payments/orders/{ORDER_ID}

Returns the current state of an order owned by this account.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_ORDER_ID="ORDER_ID_FROM_ORDER_RESPONSE"

curl -fsSL -X GET "https://api.riavatar.tech/v1/payments/orders/$RIAVATAR_ORDER_ID" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

DELETE/v1/payments/orders/{ORDER_ID}

Requests cancellation of a pending order. Check its status until cancellation or payment is confirmed; a successful payment must use the refund endpoint.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_ORDER_ID="ORDER_ID_FROM_ORDER_RESPONSE"

curl -fsSL -X DELETE "https://api.riavatar.tech/v1/payments/orders/$RIAVATAR_ORDER_ID" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

GET/v1/payments/orders?limit=20&offset=0

Lists paid purchases and their refund state. Use limit and offset for pagination.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"

curl -fsSL -X GET 'https://api.riavatar.tech/v1/payments/orders?limit=20&offset=0' \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"

POST/v1/payments/orders/{ORDER_ID}/refund

Requests a refund for a paid order. Repeating the request returns the same refund.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_ORDER_ID="ORDER_ID_FROM_ORDER_RESPONSE"

curl -fsSL -X POST "https://api.riavatar.tech/v1/payments/orders/$RIAVATAR_ORDER_ID/refund" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "reason": "No longer needed"
    }'

GET/v1/payments/orders/{ORDER_ID}/refund

Returns the refund status. A refund is complete only when its status is succeeded.

RIAVATAR_TOKEN="ACCESS_TOKEN_FROM_LOGIN"
RIAVATAR_ORDER_ID="ORDER_ID_FROM_ORDER_RESPONSE"

curl -fsSL -X GET "https://api.riavatar.tech/v1/payments/orders/$RIAVATAR_ORDER_ID/refund" \
    -H "Authorization: Bearer $RIAVATAR_TOKEN"