API Reference

SnapAPI - AI Image Processing API

v1.0.0

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
Include api-key: YOUR_API_KEY header
API Playground
Test endpoints live in your browser
Support
Questions or integration help? Reach the team.

Quickstart

First API call in 60 seconds
1

Get your API key

Sign up at snapapi.ai/dashboard and create an API key. Takes 10 seconds.

2

Make your first API call

All endpoints use input_image for image input and return output_image_url — one consistent pattern.

# Option A: api-key header
curl -X POST "https://api.snapapi.ai/v1/images/remove-background" \
  -H "api-key: sk-snap-xxxxx" \
  -F "input_image=@photo.jpg"

# Option B: Bearer token (OpenAI-compatible)
curl -X POST "https://api.snapapi.ai/v1/images/remove-background" \
  -H "Authorization: Bearer sk-snap-xxxxx" \
  -F "input_image=@photo.jpg"
3

Get your result

Every image endpoint returns OpenAI-compatible format. Your result URL is at data[0].url. No base64 decoding needed.

json
{
  "created": 1745827200,
  "data": [
    { "url": "https://outputs.snapapi.ai/outputs/abc123.png" }
  ]
}

More examples

# Edit an image with AI prompt
curl -X POST "https://api.snapapi.ai/v1/images/edits" \
  -H "api-key: YOUR_API_KEY" \
  -F "input_image=@photo.jpg" \
  -F "prompt=Transform to anime style" \
  -F "mode=editing"

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`.

Need help? SnapAPI Support

Error Handling

Errors return a non-2xx status code with a consistent JSON body. Check error.type and error.code to handle failures programmatically.

json
{
  "error": {
    "message": "Invalid API key provided.",
    "type": "authentication_error",
    "code": 401
  }
}

Rate Limits

60 requests/minute per API key. Check x-ratelimit-remaining-requests header to track usage. On 429, wait for retry-after seconds.

Credits

Each API call costs credits based on the model used — 1 credit = $0.0005. Per-call costs are listed in each endpoint's description. See Pricing for credit packages.

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.

OpenAI SDK Compatibility

SnapAPI is a drop-in replacement for the OpenAI Python & Node SDKs — just point base_url at SnapAPI and reuse your existing code.

python
from openai import OpenAI

client = OpenAI(
    api_key="sk-snap-xxxxx",
    base_url="https://api.snapapi.ai/v1",
)

result = client.images.generate(
    model="snapapi/z-image",
    prompt="a cat",
)
print(result.data[0].url)

LLM-Friendly Documentation

Our documentation is also available in an LLM-friendly format, making it easy to integrate with large language models and AI tools. You can access it in two ways:

  • llms.txt — a lightweight sitemap that lists all documentation pages.
  • llms-full.txt — the full documentation in Markdown format.