API Reference

API Reference

Complete reference documentation for all Twin.Actor API endpoints. All endpoints require authentication unless otherwise noted.

Base URL

text
https://api.twin.actor/api/v1

Request Format

All requests should include these headers:

http
Authorization</span>: Bearer YOUR_TOKEN
Content-Type</span>: application/json

Request bodies should be JSON-encoded. File uploads use multipart/form-data.

Response Format

All responses are JSON-encoded. Successful responses return the resource directly:

json
{
  "id": 1,
  "name": "Resource name",
  "status": "active",
  "created_at": "2024-03-20T10:00:00Z"
}

Collection endpoints return arrays with pagination info when applicable:

json
[
  { "id": 1, "name": "First item" },
  { "id": 2, "name": "Second item" }
]

Error Format

Errors return a consistent format:

json
{
  "detail": "Error message describing what went wrong"
}

Validation errors include field-level details:

json
{
  "detail": [
    {
      "loc": ["body", "email"],
      "msg": "Invalid email format",
      "type": "value_error"
    }
  ]
}

Common Status Codes

CodeDescription
200Success
201Created
202Accepted (async job started)
204No Content (successful delete)
400Bad Request (invalid parameters)
401Unauthorized (missing/invalid token)
403Forbidden (insufficient credits/permissions)
404Not Found
422Validation Error
429Rate Limit Exceeded
500Internal Server Error

Endpoints by Resource

Endpoint Summary

MethodEndpointDescription
Authentication
POST/auth/registerCreate account
POST/auth/loginGet access token
GET/auth/meGet current user
GET/auth/creditsGet credit balance
Persons
GET/personsList all persons
POST/personsCreate person
GET/persons/{id}Get person
PUT/persons/{id}Update person
DELETE/persons/{id}Delete person
Voice Cloning
GET/voice-clone/providersList providers
POST/voice-clone/cloneClone voice
POST/voice-clone/ttsGenerate TTS
Scene Projects
GET/scene-projectsList projects
POST/stories/createCreate project
GET/scene-projects/{id}Get project
POST/scene-projects/{id}/approveStart generation
GET/scene-projects/{id}/statusGet status
Avatar Projects
GET/avatarList projects
POST/avatar/generateGenerate video
GET/avatar/{id}/statusGet status

Need More Details?

Click on any resource in the sidebar to see detailed documentation including request/response examples, parameters, and error codes.