# SnapEdit - AI Image Processing API SnapAPI provides a comprehensive suite of AI-powered image processing endpoints including object removal, image enhancement, background removal, virtual try-on, image editing, and more. ## Authentication Two methods supported (pick one): **Option A — `api-key` header (simple):** ``` api-key: sk-snap-xxxxx ``` **Option B — Bearer token (OpenAI-compatible):** ``` Authorization: Bearer sk-snap-xxxxx ``` ### API Key Format All keys use the prefix `sk-snap-` for easy identification and leak detection. ### Security Best Practices - **Never hardcode keys** in source code. Use environment variables (`SNAPAPI_KEY`). - **Rotate keys** every 90 days. Create a new key before revoking the old one. - **Use separate keys** for development and production. - **Set quota limits** per key to prevent unexpected charges. - **Revoke immediately** if a key is exposed. Go to [Dashboard → API Keys](https://snapapi.ai/en/dashboard/api-keys). ## Credits Each API call costs credits based on the model used. See individual endpoint descriptions for credit costs. 1 credit = $0.0005. ## Image Input Most endpoints accept image files or image URLs through fields such as `input_image`, `model_image`, and `cloth_image`. Mask inputs use `input_mask`. ## Rate Limits All endpoints are rate-limited to **60 requests/minute** per API key. Rate limit info is returned in response headers: - `x-ratelimit-limit-requests`: Max requests per window - `x-ratelimit-remaining-requests`: Remaining requests - `x-ratelimit-reset-requests`: Window reset time (ISO 8601) - `retry-after`: Seconds to wait (only on 429) ## OpenAI SDK Compatibility SnapAPI is compatible with the OpenAI Python/Node SDK. Just change the base URL: ```python from openai import OpenAI client = OpenAI(api_key='sk-snap-xxx', base_url='https://api.snapapi.ai/v1') result = client.images.generate(model='snapapi/z-image', prompt='a cat') print(result.data[0].url) ``` See the **OpenAI SDK** tag below for full endpoint documentation with all supported models. ### Response format (all image endpoints) ```json { 'created': 1745827200, 'data': [{ 'url': 'https://outputs.snapapi.ai/...' }] } ``` ### Error format ```json { 'error': { 'message': '...', 'type': 'authentication_error', 'code': 401 } } ``` **Base URL:** `https://api.snapapi.ai` **Authentication:** Include the `api-key: YOUR_API_KEY` header with every request. **API version:** 1.0.0 ## Image Input Most endpoints accept image files or image URLs through fields such as `input_image`, `model_image`, and `cloth_image`. Mask inputs use `input_mask`. --- # Detection Detect objects, text, and wires in images for use with removal endpoints. Models: `object-detection`, `remove-text`, `remove-wireline` ## Detect objects in image **POST** `https://api.snapapi.ai/v1/images/detect-objects` Automatically detect removable objects in an image. Use the returned `session_id` and selected `detected_objects` item with the [Remove Objects API](#removeObjects). **Model:** `object-detection` — **Credit cost:** 1 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to detect objects in. | | `lang` | string | No | Language for object class names.. Default: en | ### Responses - **200**: Objects detected successfully (DetectionResponse) ```json { "session_id": "sess_abc123", "detected_objects": [ { "box": [ 120, 50, 300, 400 ], "mask": "base64_encoded_data...", "accuracy": 0.95, "object_type": "person", "object_description": "person" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Detect text in image **POST** `https://api.snapapi.ai/v1/images/detect-text` Detect text regions and return a mask. The returned `mask` can be used as `input_mask` in the [Remove Text API](#removeText), with optional manual modifications. **Model:** `remove-text` — **Credit cost:** 1 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to detect text in. | ### Responses - **200**: Text mask generated successfully (SimpleDetectionResponse) ```json { "detected": true, "mask": "base64_encoded_data..." } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Detect wires/lines in image **POST** `https://api.snapapi.ai/v1/images/detect-wires` Detect wire, cable, and line regions and return a mask. The returned `mask` can be used as `input_mask` in the [Remove Wires API](#removeWires), with optional manual modifications. **Model:** `remove-wireline` — **Credit cost:** 1 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to detect wires in. | ### Responses - **200**: Wire mask generated successfully (SimpleDetectionResponse) ```json { "detected": true, "mask": "base64_encoded_data..." } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` --- # Removal & Erase Remove objects, text, wires, logos, and backgrounds from images. Models: `remove-object-gan`, `remove-object-sd`, `remove-object-qwen`, `remove-text`, `remove-logo`, `remove-wireline`, `remove-background` ## Erase objects from image **POST** `https://api.snapapi.ai/v1/images/remove-objects` Remove objects from an image using a manual mask, selected detected objects, or both. To erase detected objects, first call the [Detect Objects API](#detectObjects), then provide `original_session_id` plus `mask_objects`. Provide at least one erase target: `input_mask`, or `original_session_id` + `mask_objects`. **Model:** `remove-object-gan`, `remove-object-sd`, `remove-object-qwen` — **Credit cost:** 3 (normal), 4 (super), 13 (ultra) ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to erase objects from. | | `original_session_id` | string | No | Session ID returned by the Detect Objects API. Needed when using `mask_objects`. | | `input_mask` | file | No | Manual brush mask image file or URL. Can be combined with `mask_objects`. | | `mask_objects` | string | No | Selected object item or JSON array from `detected_objects`. Provide with `original_session_id`. | | `erase_mode` | string | No | Erase mode.. Enum: normal, super, ultra. Default: normal | ### Responses - **200**: Objects erased successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Erase text from image **POST** `https://api.snapapi.ai/v1/images/remove-text` Remove text from an image using a text mask. `input_mask` can come from the [Detect Text API](#detectText) and may be manually modified before removal. **Model:** `remove-text` — **Credit cost:** 4 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to erase text from. | | `input_mask` | file | Yes | Text mask image file or URL. Can be generated by the Detect Text API and modified manually. | | `erase_mode` | string | No | Erase mode.. Enum: normal, super, ultra. Default: normal | ### Responses - **200**: Text erased successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Erase logo from image **POST** `https://api.snapapi.ai/v1/images/remove-logo` Remove logos from an image. This API supports **automatic detection and removal**, or **manual removal within a selected region**. **Model:** `remove-logo` — **Credit cost:** 5 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | The image file (or URL) to remove logo from. | | `input_mask` | file | No | RGBG mask image (or URL) for manual logo selection. **If not provided**, the API will automatically detect and remove the logo. | | `predict_mode` | string | No | Predict mode for the logo removal. `3.0` is better for general cases while `2.0` is suitable for emoji cases.. Enum: 2.0, 3.0. Default: 2.0 | ### Responses - **200**: Logo erased successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Erase wires/lines from image **POST** `https://api.snapapi.ai/v1/images/remove-wires` Remove wires, cables, and line objects from an image using a mask. `input_mask` can come from the [Detect Wires API](#detectWires) and may be manually modified before removal. **Model:** `remove-wireline` — **Credit cost:** 4 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to erase wires from. | | `input_mask` | file | Yes | Wire mask image file or URL. Can be generated by the Detect Wires API and modified manually. | ### Responses - **200**: Wires erased successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Remove background from image **POST** `https://api.snapapi.ai/v1/images/remove-background` Remove the background from an image. Returns a mask of the foreground object. **Model:** `remove-background` — **Credit cost:** 1 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to remove the background from. | ### Responses - **200**: Background removed successfully (RemoveBackgroundResponse) ```json { "output_image_url": "https://outputs.snapapi.ai/outputs/abc123.png", "box": [ 10, 20, 300, 400 ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` --- # Enhance & Restore Upscale, enhance, restore, and colorize images. Models: `enhance-upscale-image`, `enhance-art-image`, `restore-image`, `colorize-image` ## Enhance and upscale image **POST** `https://api.snapapi.ai/v1/images/enhance` Upscale and enhance image resolution using AI. Supports input images with maximum width and height <= 1500 px. **Model:** `enhance-upscale-image` — **Credit cost:** 6 (2x), 11 (4x) ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to enhance. Maximum width and height must be <= 1500 px. | | `zoom_factor` | string | Yes | Upscale factor. `2` for 2x, `4` for 4x resolution.. Enum: 2, 4 | | `enhance_faces` | string | No | Enable face enhancement.. Default: true | ### Responses - **200**: Image enhanced successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Enhance art/cartoon image **POST** `https://api.snapapi.ai/v1/images/enhance-art` Upscale and enhance art, anime, or cartoon images. Supports input images with maximum width and height <= 1500 px. **Model:** `enhance-art-image` — **Credit cost:** 2 (2x), 4 (4x) ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to enhance. Maximum width and height must be <= 1500 px. | | `zoom_factor` | string | Yes | Upscale factor. `2` for 2x, `4` for 4x resolution.. Enum: 2, 4 | ### Responses - **200**: Image enhanced successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Restore old images (Normal) **POST** `https://api.snapapi.ai/v1/images/restore` Restore and enhance old images, remove the scratches. **Model:** `restore-image` — **Credit cost:** 1 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to restore. | ### Responses - **200**: Image restored successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Restore old images (Pro) **POST** `https://api.snapapi.ai/v1/images/restore/pro` Restore old or degraded images using Qwen-Image-Edit. This endpoint uses restore mode internally, so users do not need to provide a mode. **Model:** `restore-of-qwen-image-edit` — **Credit cost:** 13 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to restore. | ### Responses - **200**: Image restored successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Colorize old images (Normal) **POST** `https://api.snapapi.ai/v1/images/colorize` Colorize old images. **Model:** `colorize-image` — **Credit cost:** 1 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to colorize. | ### Responses - **200**: Image colorized successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Colorize old images (Pro) **POST** `https://api.snapapi.ai/v1/images/colorize/pro` Add color to black-and-white images using Qwen-Image-Edit. This endpoint uses colorize mode internally, so users do not need to provide a mode. **Model:** `colorize-of-qwen-image-edit` — **Credit cost:** 13 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to colorize. | ### Responses - **200**: Image colorized successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Light restoration **POST** `https://api.snapapi.ai/v1/images/light-restore` Fix lighting issues such as underexposure, overexposure, and backlighting using Qwen-Image-Edit. This endpoint uses light restoration mode internally, so users do not need to provide a mode. **Model:** `light-restoration-of-qwen-image-edit` — **Credit cost:** 21 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to restore lighting for. | ### Responses - **200**: Image lighting restored successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` --- # Generation Generate images from text prompts or transform photos into AI art. Models: `generate-of-z-image`, `generate-of-qwen-image`, `fairy-ai-art-gen` ## Generate image with Z-Image **POST** `https://api.snapapi.ai/v1/images/generates/zimage` Text-to-image generation using Z-Image. **Model:** `z-image-turbo` — **Credit cost:** 9 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `prompt` | string | Yes | Text prompt describing the image to generate. | | `aspect_ratio` | string | No | Output aspect ratio.. Enum: 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16. Default: 1:1 | ### Responses - **200**: Image generated successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Generate image with Qwen-Image **POST** `https://api.snapapi.ai/v1/images/generates/qwen` Text-to-image generation using Qwen-Image. **Model:** `generate-of-qwen-image` — **Credit cost:** 9 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `prompt` | string | Yes | Text prompt describing the image to generate. | | `aspect_ratio` | string | No | Output aspect ratio.. Enum: 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16. Default: 1:1 | ### Responses - **200**: Image generated successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Generate AI art from image **POST** `https://api.snapapi.ai/v1/images/generates/art` Transform a photo into AI-generated art using various styles. The style list and preview images are in this [link](https://storage.googleapis.com/assets.snapedit.app/fairyai/anime_styles_6mar25.json). The styles can be divided into two categories: `v1` (global image transformation) and `v2` (avatar-oriented transformation). `v1` is preferred for images with multiple subjects, while `v2` is designed for a single person. **Model:** `fairy-ai-art-gen` — **Credit cost:** 6 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to transform into art. | | `style` | string | Yes | Art style to apply. | ### Responses - **200**: Art image generated successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Generate professional headshot from image **POST** `https://api.snapapi.ai/v1/images/generates/headshot` Generate a professional headshot from a person image using Qwen-Image-Edit. An example for the prompt is "Professional headshot image of the reference subject in a studio". **Model:** `headshot-generation-of-qwen-image-edit` — **Credit cost:** 21 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Person image file or URL to transform into a headshot. | | `prompt` | string | Yes | Prompt for outfit, background, lighting, or style preferences. | ### Responses - **200**: Image generated successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Generate cartoon or sticker from image **POST** `https://api.snapapi.ai/v1/images/generates/sticker` Generate a cartoon or sticker-style image from an input image using Qwen-Image-Edit. An example for the prompt is "Turn the characters in the image into Apple iOS-style 3D avatars". **Model:** `cartoon-sticker-generation-of-qwen-image-edit` — **Credit cost:** 21 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to transform into a cartoon or sticker. | | `prompt` | string | Yes | Prompt describing the desired cartoon or sticker style. | ### Responses - **200**: Image generated successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` --- # Editing Edit images using AI prompts with various models and modes. Models: `general-edit-of-qwen-image-edit`, `headshot-generation-of-qwen-image-edit`, `cartoon-sticker-generation-of-qwen-image-edit`, `light-restoration-of-qwen-image-edit`, `restore-of-qwen-image-edit`, `colorize-of-qwen-image-edit`, `inpaint-of-qwen-image-edit`, `general-edit-multi-of-qwen-image-edit`, `general-image-editing-of-flux-kontext` ## Edit image with AI prompt **POST** `https://api.snapapi.ai/v1/images/edits` Edit an image using natural language prompts powered by the Qwen-Image-Edit model. Use `editing` for general image edits and `inpaint` when editing a selected masked region. **Model:** `general-edit-of-qwen-image-edit`, `inpaint-of-qwen-image-edit` — **Credit cost:** 13 ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `input_image` | file | Yes | Image file or URL to edit. | | `prompt` | string | Yes | Natural language editing instruction. | | `mode` | string | Yes | Editing mode. Use `inpaint` with `input_mask`.. Enum: editing, inpaint | | `input_mask` | file | No | Mask image file or URL for inpaint mode. | ### Responses - **200**: Image edited successfully (SingleImageResponse) ```json { "created": 1745827200, "data": [ { "url": "https://outputs.snapapi.ai/outputs/abc123.png" } ] } ``` - **400**: Missing required image input (ErrorResponse) ```json { "error": true, "message": "Missing 'input_image' field" } ``` - **429**: Rate limit exceeded or insufficient credits (ErrorResponse) ```json { "error": true, "message": "Rate limit exceeded" } ``` - **500**: Internal server error (ErrorResponse) ```json { "error": true, "message": "Internal Server Error" } ``` ## Edit based on multiple input images with AI prompt **POST** `https://api.snapapi.ai/v1/images/edits/multi` Edit based on multiple images (up to 3) using natural language prompts powered by the Qwen-Image-Edit model. Supports multiple editing modes:
| Mode | Description | Example |
|---|---|---|
| editing | General editing prompt | Put the man and the dog in a stadium |