Skip to main content
POST
/
v1
/
images
/
edits
curl --request POST \
  --url https://api.apimart.ai/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-imagine-1.0-edit-apimart",
    "prompt": "Change the background to a starry sky, keep the main subject",
    "image_urls": ["https://example.com/original.png"],
    "n": 1
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01JNXXXXXXXXXXXXXXXXXX"
    }
  ]
}
curl --request POST \
  --url https://api.apimart.ai/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-imagine-1.0-edit-apimart",
    "prompt": "Change the background to a starry sky, keep the main subject",
    "image_urls": ["https://example.com/original.png"],
    "n": 1
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01JNXXXXXXXXXXXXXXXXXX"
    }
  ]
}

Authorizations

Authorization
string
required
All APIs require Bearer Token authenticationGet API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY

Body

model
string
default:"grok-imagine-1.0-edit-apimart"
required
Image editing model nameSupported models:
  • grok-imagine-1.0-edit-apimart - Grok Image Editing
Example: "grok-imagine-1.0-edit-apimart"
prompt
string
required
Text description for image editing, supports multiple languages
image_urls
string[]
required
Array of source image URLs. The system will use the first image in the array as the editing reference.Supports https:// links or data:image/...;base64,... format.
n
integer
default:1
Number of images to generateRange: 1-10 (minimum 1, maximum 10)

Response

code
integer
Response status code
data
array
Response data array

Use Cases

Case 1: Background Editing

{
  "model": "grok-imagine-1.0-edit-apimart",
  "prompt": "Change the background to a starry sky, keep the main subject",
  "image_urls": ["https://example.com/original.png"]
}

Case 2: Style Transfer

{
  "model": "grok-imagine-1.0-edit-apimart",
  "prompt": "Convert the image to cyberpunk style",
  "image_urls": ["https://example.com/original.png"],
  "n": 2
}