API Reference

Persons API

Persons represent characters that can appear in your videos. Each person has a photo used for face-locking in AI generation, and can optionally have a cloned voice.

The Person Object

json
{
  "id": 1,
  "name": "Alex Chen",
  "description": "Tech startup founder",
  "photo_url": "https://storage.twin.actor/persons/1/photo.jpg",
  "photo_base64": null,
  "has_voice": true,
  "voice_provider": "elevenlabs",
  "voice_id": "voice_abc123",
  "company_id": null,
  "user_id": 42,
  "created_at": "2024-03-20T10:00:00Z",
  "updated_at": "2024-03-20T10:00:00Z"
}

Attributes

NameTypeDescription
idintegerUnique identifier
namestringDisplay name
descriptionstringOptional description or bio
photo_urlstringURL to the person's photo
photo_base64stringBase64 photo (only on create/update)
has_voicebooleanWhether a voice clone exists
voice_providerstringVoice provider (elevenlabs, hume, chatterbox)
voice_idstringProvider's voice ID
company_idintegerAssociated company (optional)
user_idintegerOwner user ID
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp

List Persons

GET/persons

List all persons belonging to the authenticated user

Query Parameters

NameTypeDescription
has_voicebooleanFilter by voice availability
company_idintegerFilter by company
bash
curl https://api.twin.actor/api/v1/persons \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

json
[
  {
    "id": 1,
    "name": "Alex Chen",
    "description": "Tech startup founder",
    "photo_url": "https://storage.twin.actor/persons/1/photo.jpg",
    "has_voice": true,
    "voice_provider": "elevenlabs",
    "created_at": "2024-03-20T10:00:00Z"
  },
  {
    "id": 2,
    "name": "Sarah Johnson",
    "description": "Marketing director",
    "photo_url": "https://storage.twin.actor/persons/2/photo.jpg",
    "has_voice": false,
    "voice_provider": null,
    "created_at": "2024-03-19T15:30:00Z"
  }
]
200List of persons
401Unauthorized

Create Person

POST/persons

Create a new person with a photo

Request Body

NameTypeDescription
namerequiredstringPerson's name
descriptionstringBio or description
photo_base64requiredstringPhoto as base64 data URL
company_idintegerAssociate with a company

Photo Requirements

  • Clear, front-facing photo works best
  • Supported formats: JPEG, PNG, WebP
  • Recommended size: 512x512 to 1024x1024
  • Maximum file size: 10MB
bash
curl -X POST https://api.twin.actor/api/v1/persons \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alex Chen",
    "description": "Tech startup founder specializing in AI",
    "photo_base64": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
  }'

Response:

json
{
  "id": 3,
  "name": "Alex Chen",
  "description": "Tech startup founder specializing in AI",
  "photo_url": "https://storage.twin.actor/persons/3/photo.jpg",
  "has_voice": false,
  "voice_provider": null,
  "voice_id": null,
  "company_id": null,
  "user_id": 42,
  "created_at": "2024-03-20T10:00:00Z",
  "updated_at": "2024-03-20T10:00:00Z"
}
201Person created
400Invalid photo format
401Unauthorized
422Validation error

Get Person

GET/persons/{id}

Get a specific person by ID

bash
curl https://api.twin.actor/api/v1/persons/1 \
  -H "Authorization: Bearer YOUR_TOKEN"
200Person object
404Person not found

Update Person

PUT/persons/{id}

Update a person's details

Request Body

NameTypeDescription
namestringUpdated name
descriptionstringUpdated description
photo_base64stringNew photo
bash
curl -X PUT https://api.twin.actor/api/v1/persons/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alex Chen Jr.",
    "description": "Updated bio with new role"
  }'
200Updated person object
404Person not found

Delete Person

DELETE/persons/{id}

Delete a person and associated voice clones

Deleting a person will also delete any associated voice clones. This action cannot be undone. Projects that used this person will retain their generated content but cannot be regenerated.
bash
curl -X DELETE https://api.twin.actor/api/v1/persons/1 \
  -H "Authorization: Bearer YOUR_TOKEN"
204Successfully deleted
404Person not found

Demo Person

Each user account comes with a demo person (Elon Musk with Tesla company) pre-seeded for testing. You can use this immediately without creating your own person.

The demo person is read-only and cannot be deleted. For production use, create your own persons with your own photos.