> For the complete documentation index, see [llms.txt](https://bountyv.gitbook.io/vdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bountyv.gitbook.io/vdocs/soul-api/identities-generate.md).

# Generate from a Soul

Identity-locked text-to-image using a previously created Soul. Per-call charge.

```
POST /api/v1/identities/{id}/generate
```

Synchronous. Typical response time: 20–60 seconds.

Renders a new image of the Soul's face in whatever scene you describe in the prompt. The face stays consistent across calls — same person, new outfit, new pose, new location, every time. You need an `id` returned from [`POST /api/v1/identities/create`](/vdocs/soul-api/identities-create.md).

## Authentication

```
Authorization: Bearer sk_live_...
```

See [Authentication](/vdocs/authentication.md) for details.

## Path parameters

| Param | Type   | Required | Description                                           |
| ----- | ------ | -------- | ----------------------------------------------------- |
| `id`  | string | ✅        | The Soul id from create. Must belong to your account. |

## Request

**Content-Type:** `application/json`

| Field    | Type    | Required | Default | Description                                                                |
| -------- | ------- | -------- | ------- | -------------------------------------------------------------------------- |
| `prompt` | string  | ✅        | —       | What to generate. The Soul's face is locked in — describe everything else. |
| `width`  | integer | —        | `1024`  | Output width in pixels.                                                    |
| `height` | integer | —        | `1024`  | Output height in pixels.                                                   |
| `seed`   | integer | —        | —       | Optional. Reproducibility.                                                 |

## Response

```json
{
  "image": "data:image/png;base64,iVBORw0KGgo...",
  "generation_id": "gJ8nP3kQ2m",
  "charged_cents": 25,
  "balance_cents": 4775
}
```

| Field           | Type           | Description                                                      |
| --------------- | -------------- | ---------------------------------------------------------------- |
| `image`         | string         | Generated image as a base64 data URL.                            |
| `generation_id` | string \| null | Id of the persisted generation record, if persistence succeeded. |
| `charged_cents` | integer        | Amount deducted from your balance for this call.                 |
| `balance_cents` | integer        | Remaining balance.                                               |

## Example

```bash
curl -X POST https://substance-api.com/api/v1/identities/5e9b27ec-.../generate \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt": "On a Tokyo rooftop at sunset, leather jacket"}'
```

## Errors

| Status | When                                                           |
| ------ | -------------------------------------------------------------- |
| `400`  | Missing or non-string `prompt`.                                |
| `401`  | Missing/invalid API key.                                       |
| `402`  | Insufficient balance.                                          |
| `404`  | Soul id doesn't exist or isn't owned by your account.          |
| `500`  | Soul face crop unavailable — contact support.                  |
| `502`  | Generation failed upstream. Balance is refunded automatically. |

See [Errors](/vdocs/errors.md) for full details.

## Pricing

Billed per call — see [Credits & pricing](/vdocs/account/credits.md) for current rates.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bountyv.gitbook.io/vdocs/soul-api/identities-generate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
