curl --request POST \
--url https://api.moda.app/v1/media/precise-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"prompt": "<string>",
"mask": "<string>",
"context_window": "<string>",
"quality": "medium",
"seed": 1073741823,
"model": "ideogram-precise-edit",
"idempotency_key": "<string>"
}
'import requests
url = "https://api.moda.app/v1/media/precise-edit"
payload = {
"image": "<string>",
"prompt": "<string>",
"mask": "<string>",
"context_window": "<string>",
"quality": "medium",
"seed": 1073741823,
"model": "ideogram-precise-edit",
"idempotency_key": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image: '<string>',
prompt: '<string>',
mask: '<string>',
context_window: '<string>',
quality: 'medium',
seed: 1073741823,
model: 'ideogram-precise-edit',
idempotency_key: '<string>'
})
};
fetch('https://api.moda.app/v1/media/precise-edit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moda.app/v1/media/precise-edit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image' => '<string>',
'prompt' => '<string>',
'mask' => '<string>',
'context_window' => '<string>',
'quality' => 'medium',
'seed' => 1073741823,
'model' => 'ideogram-precise-edit',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moda.app/v1/media/precise-edit"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"mask\": \"<string>\",\n \"context_window\": \"<string>\",\n \"quality\": \"medium\",\n \"seed\": 1073741823,\n \"model\": \"ideogram-precise-edit\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moda.app/v1/media/precise-edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"mask\": \"<string>\",\n \"context_window\": \"<string>\",\n \"quality\": \"medium\",\n \"seed\": 1073741823,\n \"model\": \"ideogram-precise-edit\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moda.app/v1/media/precise-edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"mask\": \"<string>\",\n \"context_window\": \"<string>\",\n \"quality\": \"medium\",\n \"seed\": 1073741823,\n \"model\": \"ideogram-precise-edit\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}Precise Edit Image
Repaint one region of an image from a prompt, at its full resolution (metered, Ideogram direct API).
curl --request POST \
--url https://api.moda.app/v1/media/precise-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"prompt": "<string>",
"mask": "<string>",
"context_window": "<string>",
"quality": "medium",
"seed": 1073741823,
"model": "ideogram-precise-edit",
"idempotency_key": "<string>"
}
'import requests
url = "https://api.moda.app/v1/media/precise-edit"
payload = {
"image": "<string>",
"prompt": "<string>",
"mask": "<string>",
"context_window": "<string>",
"quality": "medium",
"seed": 1073741823,
"model": "ideogram-precise-edit",
"idempotency_key": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image: '<string>',
prompt: '<string>',
mask: '<string>',
context_window: '<string>',
quality: 'medium',
seed: 1073741823,
model: 'ideogram-precise-edit',
idempotency_key: '<string>'
})
};
fetch('https://api.moda.app/v1/media/precise-edit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moda.app/v1/media/precise-edit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image' => '<string>',
'prompt' => '<string>',
'mask' => '<string>',
'context_window' => '<string>',
'quality' => 'medium',
'seed' => 1073741823,
'model' => 'ideogram-precise-edit',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moda.app/v1/media/precise-edit"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"mask\": \"<string>\",\n \"context_window\": \"<string>\",\n \"quality\": \"medium\",\n \"seed\": 1073741823,\n \"model\": \"ideogram-precise-edit\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moda.app/v1/media/precise-edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"mask\": \"<string>\",\n \"context_window\": \"<string>\",\n \"quality\": \"medium\",\n \"seed\": 1073741823,\n \"model\": \"ideogram-precise-edit\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moda.app/v1/media/precise-edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"mask\": \"<string>\",\n \"context_window\": \"<string>\",\n \"quality\": \"medium\",\n \"seed\": 1073741823,\n \"model\": \"ideogram-precise-edit\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}Authorizations
API key from Settings > Developer > REST API
Headers
Calendar-dated API version pin. New integrations should pin 2026-05-01 to opt into the newest response shapes. For back-compat the server also accepts requests with no header and resolves them to the current default (today: 2026-04-12); that default advances on each sunset date. Any unsupported value returns 400 unsupported_version.
2026-04-12, 2026-05-01 "2026-05-01"
Body
file_ id or http(s) URL of the image to edit (PNG, JPEG or WebP; up to 8192x8192).
What to change inside the edited area.
1 - 10000file_ id or http(s) URL of a mask: white marks the area to edit, black or transparent the area to keep (white strokes on a transparent layer work). Resized to the image.
Which region to edit at full resolution: auto (fit around the mask), none (edit the whole image; over 2048x2048 of area it comes back scaled down), or y_min,x_min,y_max,x_max in the image's own pixels, rows first, max edges exclusive (each side >= 256px, area <= 4194304px, aspect within 6:1). Default: auto with a mask, none without. Pixels outside the region come back unchanged.
Rendering quality; the only field that changes the price.
very_low, low, medium, high 0 <= x <= 2147483647"ideogram-precise-edit"A retried call with the same key replays the stored response (replayed:true) instead of paying for a second provider render.
200Response
Successful Response
The response is of type Response Mediapreciseeditimage · object.