# API REST

> Fabriquer des personnages 3D depuis un programme avec l'API REST d'Infinite Characters : l'authentification par clé d'API, un premier personnage pas à pas (prix, photo, lancement, suivi, export), le suivi des créations, les erreurs et la référence de chaque opération.

L'API REST fait depuis n'importe quel programme ce que fait le site : une tête 3D à partir de mots et de photos, ses options (Hair Grooms, Facial Grooms, Poses), puis ses fichiers pour Unreal Engine, Unity, GLB ou OBJ.

- **Adresse de base** : `https://api.infinitepeople.ai`
- **Authentification** : `Authorization: Bearer <clé>`, avec une clé d'API de votre compte Infinite Characters.
- **Format** : JSON en entrée et en sortie ; les photos s'envoient en `multipart/form-data` ou par un lien public.
- **OpenAPI** : [`/v1/characters/openapi.json`](https://api.infinitepeople.ai/v1/characters/openapi.json), lisible sans clé.

## Votre clé d'API

Créez une clé dans votre compte, sur le site : **Compte > Clés d'API**. Elle n'est montrée qu'une fois : gardez-la secrète, comme un mot de passe. Une clé n'ouvre qu'Infinite Characters (son périmètre est `infinite-characters`) ; elle se révoque depuis la même page à tout moment. Tout ce qu'elle lance est payé par votre compte, comme sur le site.

## Un premier personnage, pas à pas

**1. Le prix.** Rien n'est payé sans le connaître :

```bash
curl -s "https://api.infinitepeople.ai/v1/characters/estimate?kind=head&hair=true&facial=true&rig_poses=true" \
  -H "Authorization: Bearer $IC_KEY"
```

La réponse donne le prix, sa devise, ce qui le paie (`pay_with` : votre offre ou votre solde prépayé) et s'il peut être lancé maintenant.

**2. Une photo** (facultative, deux au plus), depuis un lien public :

```bash
curl -s -X POST https://api.infinitepeople.ai/v1/characters/references/link \
  -H "Authorization: Bearer $IC_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/portrait.jpg"}'
```

Sa réponse donne l'adresse de la photo sur notre hôte, à mettre dans `references`.

**3. Le lancement.** Envoyez un `Idempotency-Key` à vous : renvoyé après une réponse perdue, il rend la tête déjà lancée, payée une seule fois.

```bash
curl -s -X POST https://api.infinitepeople.ai/v1/characters/heads \
  -H "Authorization: Bearer $IC_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: ma-premiere-tete-0001" \
  -d '{"prompt": "une femme de 30 ans, taches de rousseur, cheveux roux", "references": ["<adresse de la photo>"], "hair": true, "facial": true, "rig_poses": true, "name": "Rousse"}'
```

La réponse est la tête, avec son `id`, à suivre.

**4. La suivre** jusqu'à ce qu'elle soit prête. L'appel attend jusqu'à 25 s et répond dès que quelque chose change : rappelez-le aussitôt tant que `keep_polling` vaut true.

```bash
curl -s "https://api.infinitepeople.ai/v1/characters/jobs/<id>?wait=25" -H "Authorization: Bearer $IC_KEY"
```

Une tête est livrée en plusieurs temps : `ready` passe à true dès que la tête elle-même est là ; ses options suivent, sur le même id, chacune avec son avancement dans `grooms.parts` et `track`.

**5. Ses fichiers.** Les formats proposés et leurs options :

```bash
curl -s https://api.infinitepeople.ai/v1/characters/exports/formats -H "Authorization: Bearer $IC_KEY"
```

Puis l'export, suivi comme la tête ; une fois prêt, `result.url` est le fichier à télécharger. Les exports sont gratuits.

```bash
curl -s -X POST https://api.infinitepeople.ai/v1/characters/exports \
  -H "Authorization: Bearer $IC_KEY" -H "Content-Type: application/json" \
  -d '{"head": "<id>", "format": "glb"}'
```

## Erreurs

Une erreur répond son statut HTTP avec un corps JSON dont `code` dit pourquoi, une phrase à lire et, quand réessayer plus tard aide, `retry` et `retry_after_s`. Parmi les plus fréquentes : `402` rien ne le paie (offre épuisée, solde insuffisant), `403` le compte n'a pas accès, `409` `rights_declaration_needed` (la personne doit accepter les déclarations listées, puis relancer avec leurs ids dans `declarations`) ou `head_not_ready`, `429` trop de créations en cours.

# Référence

Tirée de l'OpenAPI de l'API, en anglais : les descriptions des champs sont celles de l'API.

- [Prix, offres et compte](#prix-offres-et-compte) (8)
- [Photos](#photos) (2)
- [Têtes et options](#tetes-et-options) (8)
- [Suivre une création](#suivre-une-creation) (5)
- [Exports](#exports) (2)
- [Animations](#animations) (7)
- [Autres](#autres) (3)

## Prix, offres et compte

### GET `/v1/characters/terms`

**Terms** · `terms_v1_characters_terms_get`

The terms in French or English, as Markdown (#, ##, paragraphs, « - » lists, **bold**, > quotes).

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `lang` | query | string |  |  |

Réponses : `200` Successful Response · `422` Validation Error.

### GET `/v1/characters/estimate`

**Estimate** · `estimate_v1_characters_estimate_get`

The price of a creation and what the account's week says of it: the share it takes and whether it fits. Nothing starts. `price` is what is paid for that choice, from the table of the day; while the launch lasts, `launch_until` is its last day (Paris) and `next_price` the same choice after it. `options` gives each option's price with the head and later on one; a head says `chosen`, `head_price` and, with options, `all_later`: the same pieces bought one by one that day. `launchable` false: its price is shown, the chains do not make it yet.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `kind` | query | `head`, `grooms`, `hair`, `facial`, `rig_poses`, `pack`, `animation` | oui | head, pack, or later on a head: rig_poses, facial, hair, grooms. |
| `hair` | query | boolean |  | A head made with its head of hair (without facial: its facial grooms too). |
| `facial` | query | boolean |  | A head made with its brows, lashes, beard and moustache. |
| `rig_poses` | query | boolean |  | A head made with its ARKit poses, emotions and lipsync. |
| `head` | query | string |  | An option later: the head it is made on. |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/estimate`

**Estimate Posted** · `estimate_posted_v1_characters_estimate_post`

The same estimate, the request in the body: for clients that only POST.

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `kind` | `head`, `grooms`, `hair`, `facial`, `rig_poses`, `pack`, `animation` | oui | head (with its options), pack (the head with the three), or one later on a delivered head: rig_poses, facial, hair, or grooms (facial and hair). |
| `hair` | boolean |  | A head made with its head of hair (head only); sent without facial, its facial grooms too, for one version. |
| `facial` | boolean |  | A head made with its brows, lashes, beard and moustache (head only). |
| `rig_poses` | boolean |  | A head made with its ARKit poses, emotions and lipsync (head only). |
| `head` | string |  | An option later: the account's delivered head it is made on. |

Réponses : `200` Successful Response · `422` Validation Error.

### GET `/v1/characters/status`

**Status** · `status_v1_characters_status_get`

Whether making characters is in maintenance, for the whole service or this account (`maintenance`: service, account or null), with what to tell the person; the site and the app show it before any launch.

Réponses : `200` Successful Response.

### GET `/v1/characters/prices`

**Prices** · `prices_v1_characters_prices_get`

A head and the options ticked, priced as the estimate prices them, for whoever reads the site without an account: its price in the currency of where the request comes from (euros from the Union, dollars elsewhere), and while the launch lasts the same choice after it. Nothing of an account: GET /v1/characters/estimate says what the account's week and balance make of it.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `hair` | query | boolean |  | A head made with its head of hair (without facial: its facial grooms too). |
| `facial` | query | boolean |  | A head made with its brows, lashes, beard and moustache. |
| `rig_poses` | query | boolean |  | A head made with its ARKit poses, emotions and lipsync. |

Réponses : `200` Successful Response · `422` Validation Error.

### GET `/v1/characters/plans`

**Plans** · `plans_v1_characters_plans_get`

The subscription plans, read without an account, in the currency of where the request comes from; nothing of an account is said (no plan held, no waitlist). Subscribing takes an account.

Réponses : `200` Successful Response.

### GET `/v1/balance`

**Balance** · `balance_v1_balance_get`

What the balance holds, the gift spent first; the amounts it tops up by, and whether this app may offer it; for an offer with characters, what its month still pays of them, said in characters; whether a paid character waits for the account to accept the terms of Infinite Characters.

Réponses : `200` Successful Response.

### GET `/v1/balance/movements`

**Movements** · `movements_v1_balance_movements_get`

The balance's movements, newest first: what each took or added (signed, gift and paid apart), the balance after it, and what it was for (`label` is English, for programs: the app says its own from `kind`).

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `limit` | query | integer |  |  |
| `before` | query | integer |  |  |

Réponses : `200` Successful Response · `422` Validation Error.

## Photos

### POST `/v1/characters/references`

**Send Reference** · `send_reference_v1_characters_references_post`

A photo for a head, sent as a file; refused during the subscribers' beta before it is moderated or kept.

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/references/link`

**Reference From Link** · `reference_from_link_v1_characters_references_link_post`

A photo for a head, fetched from a public link (send_file on the characters' door), refused as a file is.

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `url` | string | oui | A public https link to the picture itself, never a platform's page. |

Réponses : `200` Successful Response · `422` Validation Error.

## Têtes et options

### POST `/v1/characters/heads/{head_id}/talk`

**Open Talk** · `open_talk_v1_characters_heads__head_id__talk_post`

Open a live conversation with the head: where Talk's server listens, the short token the browser gives it (one session, opened before expires_at) and that session's caps. The character's voice is its own for the language.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `lang` | string |  | The site's language, two letters: the character answers in it, in its voice for it. |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads`

**Launch Head** · `launch_head_v1_characters_heads_post`

Launch a head, with its grooms and its rig and poses if asked (the three, the pack): moderated, its rights declared, paid by the week or the prepaid balance at its public price, then made by the chains under its one id. Answers the head to poll.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `idempotency-key` | header | string |  | Drawn by the client for one launch: sent again, it answers the head already launched, paid once. |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `prompt` | string |  | The head in the person's words: age, features, expression; may be left out when a photo is given. |
| `references` | liste de string |  | Reference photos, on our media host (POST /v1/characters/references), 2 at most; the portrait is made from the first. |
| `hair` | boolean |  | The head made with its head of hair (and, without facial, its facial grooms too, one version). |
| `facial` | boolean |  | The head made with its brows, lashes, beard and moustache; apart from hair once the chains make them apart, until then the same value as hair (422 grooms_together otherwise). |
| `rig_poses` | boolean |  | The head made with its rig and poses (with hair, the pack). |
| `name` | string |  | The character's name, shown with the head. |
| `pay_with` | `subscription`, `balance`, `week` |  | Who pays: the subscription or the prepaid balance; by default the one the estimate names (week, its former name, is the subscription). |
| `declarations` | liste de string |  | Only after a 409 rights_declaration_needed: the ids of the declarations the person accepted. |

Réponses : `202` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/grooms`

**Launch Grooms** · `launch_grooms_v1_characters_heads__head_id__grooms_post`

The grooms (head of hair, brows, lashes, beard, moustache) of one of the account's delivered heads, paid at their public price. Answers the creation to poll.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `pay_with` | `subscription`, `balance`, `week` |  | Who pays: the subscription or the prepaid balance; by default the one the estimate names (week, its former name, is the subscription). |

Réponses : `202` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/facial`

**Launch Facial** · `launch_facial_v1_characters_heads__head_id__facial_post`

The facial grooms (brows, lashes, beard, moustache) of one of the account's delivered heads, paid at their price later on a head. Answers the creation to poll.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Réponses : `202` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/hair`

**Launch Hair** · `launch_hair_v1_characters_heads__head_id__hair_post`

The head of hair (a short or a long cut) of one of the account's delivered heads, paid at its price later on a head. Answers the creation to poll.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Réponses : `202` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/rig-poses`

**Launch Rig Poses** · `launch_rig_poses_v1_characters_heads__head_id__rig_poses_post`

The rig, curves and 16 poses (8 emotions, 8 visemes) of one of the account's delivered heads, paid at their public price. Answers the creation to poll.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `pay_with` | `subscription`, `balance`, `week` |  | Who pays: the subscription or the prepaid balance; by default the one the estimate names (week, its former name, is the subscription). |

Réponses : `202` Successful Response · `422` Validation Error.

### GET `/v1/characters/heads/{head_id}/viewer`

**Head Viewer** · `head_viewer_v1_characters_heads__head_id__viewer_get`

What the site's 3D viewer loads for a delivered head: its files, signed for an hour, to whoever may open it.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/retry`

**Retry Offered** · `retry_offered_v1_characters_heads__head_id__retry_post`

The generation our quality control offered with a head delivered with visible flaws: the same request made again (its words, its photos, its hair), once, before the offer's date, paid by nothing.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Réponses : `202` Successful Response · `422` Validation Error.

## Suivre une création

### GET `/v1/characters/jobs/{job_id}`

**Get Job** · `get_job_v1_characters_jobs__job_id__post_get`

The creation, held up to `wait` seconds until it changes. GET or POST alike.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `job_id` | path | string | oui |  |
| `wait` | query | integer |  | Seconds the connection is held until something changes; 0 answers at once. |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/jobs/{job_id}`

**Get Job** · `get_job_v1_characters_jobs__job_id__post`

The creation, held up to `wait` seconds until it changes. GET or POST alike.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `job_id` | path | string | oui |  |
| `wait` | query | integer |  | Seconds the connection is held until something changes; 0 answers at once. |

Réponses : `200` Successful Response · `422` Validation Error.

### DELETE `/v1/characters/jobs/{job_id}`

**Delete Job** · `delete_job_v1_characters_jobs__job_id__delete`

Cancel a head the line has not taken (what it took is given back; once taken it goes on and is counted), or put a finished one in the bin for 48 h, then gone: an Infinite Characters key never takes it back. Only the owner deletes.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `job_id` | path | string | oui |  |

Réponses : `200` Successful Response · `422` Validation Error.

### GET `/v1/characters/jobs`

**List Jobs** · `list_jobs_v1_characters_jobs_post_get`

The account's creations of the trade, the latest first, those still being made among them; one in the bin, or deleted after it failed, is no longer there (the bin shows a binned one).

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `limit` | query | integer |  |  |
| `offset` | query | integer |  |  |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/jobs`

**List Jobs** · `list_jobs_v1_characters_jobs_post`

The account's creations of the trade, the latest first, those still being made among them; one in the bin, or deleted after it failed, is no longer there (the bin shows a binned one).

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `limit` | query | integer |  |  |
| `offset` | query | integer |  |  |

Réponses : `200` Successful Response · `422` Validation Error.

## Exports

### GET `/v1/characters/exports/formats`

**Export Formats** · `export_formats_v1_characters_exports_formats_get`

The formats a head is downloaded in, each with its options (values, the default first) and its rough weight: the one list the app, the plugins and the agents read.

Réponses : `200` Successful Response.

### POST `/v1/characters/exports`

**Make Export** · `make_export_v1_characters_exports_post`

A head in a format, with its options: a creation to poll whose result is the file. The same head, format and options answer the export already made, at once.

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `head` | string | oui | The head's id: a finished head of the account, or one shared with it. |
| `format` | string | oui | One of GET /v1/characters/exports/formats. |
| `options` | object |  | The format's options; the others at their default. |

Réponses : `202` Successful Response · `422` Validation Error.

## Animations

### GET `/v1/characters/heads/{head_id}/animations/offer`

**Animation Offer** · `animation_offer_v1_characters_heads__head_id__animations_offer_get`

What can be animated on this head: closed (poses_needed, head_not_animatable) when nothing can be.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/animations/estimate`

**Animation Estimate** · `animation_estimate_v1_characters_heads__head_id__animations_estimate_post`

The animation's price and who pays it, or why it cannot be launched as asked, before anything is paid.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `mode` | `prompt`, `images`, `pilot` |  |  |
| `prompt` | string | oui |  |
| `images` | liste de string |  |  |
| `pilot` | Pilot |  |  |
| `seconds` | integer | oui |  |
| `variants` | integer |  |  |
| `speech` | Speech |  |  |
| `pay_with` | string |  | The prepaid balance pays an animation. |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/animations/speech`

**Animation Speech** · `animation_speech_v1_characters_heads__head_id__animations_speech_post`

The scene Animate's writer reads from the prompt and the head's portrait: whether the character speaks, its line, its tone and its voice, for the client to change before launching; given its own line (text), the scene is written around it, said word for word.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `mode` | `prompt`, `images`, `pilot` |  |  |
| `prompt` | string | oui |  |
| `seconds` | integer | oui |  |
| `language` | `en`, `fr`, `es`, `de`, `it`, `pt` |  |  |
| `text` | string |  | The client's own line, said word for word. |

Réponses : `200` Successful Response · `422` Validation Error.

### GET `/v1/characters/heads/{head_id}/animations`

**Head Animations** · `head_animations_v1_characters_heads__head_id__animations_get`

The head's animations, the latest first.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/heads/{head_id}/animations`

**Launch Animation** · `launch_animation_v1_characters_heads__head_id__animations_post`

An animation launched on the head and paid from the prepaid balance; the same key answers the same animation, another body under it 409 idempotency_key_reused with `head`, the animation already launched and paid.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `head_id` | path | string | oui |  |
| `idempotency-key` | header | string |  |  |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `mode` | `prompt`, `images`, `pilot` |  |  |
| `prompt` | string | oui |  |
| `images` | liste de string |  |  |
| `pilot` | Pilot |  |  |
| `seconds` | integer | oui |  |
| `variants` | integer |  |  |
| `speech` | Speech |  |  |
| `pay_with` | string |  | The prepaid balance pays an animation. |

Réponses : `202` Successful Response · `422` Validation Error.

### GET `/v1/characters/animations/{animation_id}`

**Get Animation** · `get_animation_v1_characters_animations__animation_id__get`

One animation, held up to `wait` seconds until one of its sequences moves.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `animation_id` | path | string | oui |  |
| `wait` | query | integer |  |  |

Réponses : `200` Successful Response · `422` Validation Error.

### DELETE `/v1/characters/animations/{animation_id}`

**Delete Animation** · `delete_animation_v1_characters_animations__animation_id__delete`

An animation that failed, taken off the shelf: nothing was delivered and all of it was given back. Its row stays with its payment and its refund; deleting it again answers the same.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `animation_id` | path | string | oui |  |

Réponses : `200` Successful Response · `422` Validation Error.

## Autres

### POST `/v1/characters/demos/{demo}/talk`

**Open Demo Talk** · `open_demo_talk_v1_characters_demos__demo__talk_post`

Open a live conversation with one of the site's demo characters, from its welcome page: the same session as with a head, for an account holding the right.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `demo` | path | string | oui |  |

Corps (JSON) :

| Champ | Type | Obligatoire | Description |
|---|---|---|---|
| `lang` | string |  | The site's language, two letters: the character answers in it, in its voice for it. |

Réponses : `200` Successful Response · `422` Validation Error.

### GET `/v1/characters/demos/{demo}/exports`

**Demo Exports** · `demo_exports_v1_characters_demos__demo__exports_get`

The demo's packages ready to download, each a format of the catalogue with its options; none made on a click. Read without an account: a download takes one.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `demo` | path | string | oui |  |

Réponses : `200` Successful Response · `422` Validation Error.

### POST `/v1/characters/demos/{demo}/exports/{format}`

**Download Demo** · `download_demo_v1_characters_demos__demo__exports__format__post`

A demo package already made, its address signed for an hour: free, nothing queued nor paid, a few a day per account (429 too_many_downloads). 409 not_ready while it is not published.

| Paramètre | Où | Type | Obligatoire | Description |
|---|---|---|---|---|
| `demo` | path | string | oui |  |
| `format` | path | string | oui |  |

Réponses : `200` Successful Response · `422` Validation Error.
