> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.ideogram.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.ideogram.ai/_mcp/server.

# Generate with P-Image Ideogram asynchronously

POST https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram
Content-Type: multipart/form-data

Accepts a P-Image Ideogram generation request for asynchronous processing
and returns immediately with a generation\_id. Poll
`GET /v1/generations/{generation_id}` to retrieve the result. If a
`webhook_url` is supplied, the generated images are additionally POSTed
to it once ready, in a payload that mirrors the synchronous response with
an added generation\_id for correlation.

See [Webhooks](/ideogram-api/webhooks) for the delivery payload and how to verify webhook signatures.

Reference: https://developer.ideogram.ai/v1/api-reference/generate-images/generate-p-image-ideogram-async

## Authentication

- `Api-Key` header (required) — API key for access control. Use in the header with the name \"Api-Key\"

## Request

### Query parameters

- `webhook_url` (string, optional) — HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a JSON POST to this URL once all images for the request have finished generating. The body mirrors the synchronous generate response: `request_id`, `created`, and a `data` array containing every generated image (`url`, `prompt`, `resolution`, `seed`, `is_image_safe`). Each delivery is signed with Ed25519 and verifiable against the public keys at `https://api.ideogram.ai/v1/.well-known/jwks.json`. Must be HTTPS; private and loopback hosts and the cloud metadata service are rejected.

### Body (multipart/form-data)

This endpoint expects a multipart form.

- `prompt` (string, required) — The prompt for image generation. Accepts either natural language or a structured Ideogram 4.0 JSON prompt; the server detects which was supplied.
- `prompt_upsampling` (enum, optional) — Controls magic-prompt (prompt upsampling). Defaults to `AUTO`.
- `seed` (integer, optional) — Random seed for reproducibility.
- `quality` (enum, optional) — The generation quality level. Defaults to `MEDIUM`.
- `resolution` (enum, optional) — The output-size tier. Defaults to `1K`.
- `aspect_ratio` (enum, optional) — The output aspect ratio. Defaults to `1x1`.
- `custom_width` (integer, optional) — Optional. An exact output width in pixels, used together with `custom_height` for output sizes outside the preset tiers. Must be a positive multiple of 16 between 16 and 4096, and `custom_width` × `custom_height` must not exceed 4,194,304 pixels (2048×2048). Cannot be combined with `resolution` or `aspect_ratio`; the request is billed at the resolution tier matching its total pixel count.
- `custom_height` (integer, optional) — Optional. An exact output height in pixels, used together with `custom_width`. See `custom_width` for the accepted range and billing behavior.
- `enable_copyright_detection` (boolean, optional) — Optional. Opt this request into post-generation copyright detection.

## Response

### 200

Request accepted for asynchronous delivery.

- `generation_id` (string, required) — URL-safe base64 ID of the accepted generation. Matches the `generation_id` field delivered in the webhook payload, and the `generation_id` accepted by the generation polling endpoint.

## Errors

### 400 Bad Request Error

Invalid input provided.

- `any`

### 401 Unauthorized Error

Not authorized.

- `any`

### 422 Unprocessable Entity Error

Prompt failed the safety check.

- `error` (string, required)

### 429 Too Many Requests Error

Too many requests.

- `any`

## Examples

**Request**

```json
{
  "prompt": "string"
}
```

**Response**

```json
{
  "generation_id": "generation_id"
}
```

**SDK Code**

```python
import requests

url = "https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram"

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"aspect_ratio\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_height\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_width\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_copyright_detection\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt_upsampling\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quality\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"resolution\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"seed\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {
    "Api-Key": "<apiKey>",
    "Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
}

response = requests.post(url, data=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram';
const form = new FormData();
form.append('aspect_ratio', '');
form.append('custom_height', '');
form.append('custom_width', '');
form.append('enable_copyright_detection', '');
form.append('prompt', 'string');
form.append('prompt_upsampling', '');
form.append('quality', '');
form.append('resolution', '');
form.append('seed', '');

const options = {method: 'POST', headers: {'Api-Key': '<apiKey>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"aspect_ratio\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_height\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_width\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_copyright_detection\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt_upsampling\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quality\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"resolution\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"seed\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Api-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"aspect_ratio\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_height\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_width\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_copyright_detection\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt_upsampling\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quality\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"resolution\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"seed\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram")
  .header("Api-Key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"aspect_ratio\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_height\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_width\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_copyright_detection\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt_upsampling\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quality\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"resolution\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"seed\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram', [
  'multipart' => [
    [
        'name' => 'prompt',
        'contents' => 'string'
    ]
  ]
  'headers' => [
    'Api-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram");
var request = new RestRequest(Method.POST);
request.AddHeader("Api-Key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"aspect_ratio\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_height\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_width\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_copyright_detection\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt_upsampling\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quality\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"resolution\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"seed\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Api-Key": "<apiKey>"]
let parameters = [
  [
    "name": "aspect_ratio",
    "value": 
  ],
  [
    "name": "custom_height",
    "value": 
  ],
  [
    "name": "custom_width",
    "value": 
  ],
  [
    "name": "enable_copyright_detection",
    "value": 
  ],
  [
    "name": "prompt",
    "value": "string"
  ],
  [
    "name": "prompt_upsampling",
    "value": 
  ],
  [
    "name": "quality",
    "value": 
  ],
  [
    "name": "resolution",
    "value": 
  ],
  [
    "name": "seed",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.ideogram.ai/v1/async/text-to-image/p-image-ideogram")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```