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/v1Request Format
All requests should include these headers:
http
Authorization</span>: Bearer YOUR_TOKEN
Content-Type</span>: application/jsonRequest 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
| Code | Description |
|---|---|
200 | Success |
201 | Created |
202 | Accepted (async job started) |
204 | No Content (successful delete) |
400 | Bad Request (invalid parameters) |
401 | Unauthorized (missing/invalid token) |
403 | Forbidden (insufficient credits/permissions) |
404 | Not Found |
422 | Validation Error |
429 | Rate Limit Exceeded |
500 | Internal Server Error |
Endpoints by Resource
Endpoint Summary
| Method | Endpoint | Description |
|---|---|---|
| Authentication | ||
POST | /auth/register | Create account |
POST | /auth/login | Get access token |
GET | /auth/me | Get current user |
GET | /auth/credits | Get credit balance |
| Persons | ||
GET | /persons | List all persons |
POST | /persons | Create person |
GET | /persons/{id} | Get person |
PUT | /persons/{id} | Update person |
DELETE | /persons/{id} | Delete person |
| Voice Cloning | ||
GET | /voice-clone/providers | List providers |
POST | /voice-clone/clone | Clone voice |
POST | /voice-clone/tts | Generate TTS |
| Scene Projects | ||
GET | /scene-projects | List projects |
POST | /stories/create | Create project |
GET | /scene-projects/{id} | Get project |
POST | /scene-projects/{id}/approve | Start generation |
GET | /scene-projects/{id}/status | Get status |
| Avatar Projects | ||
GET | /avatar | List projects |
POST | /avatar/generate | Generate video |
GET | /avatar/{id}/status | Get status |
Need More Details?
Click on any resource in the sidebar to see detailed documentation including request/response examples, parameters, and error codes.