Welcome to the theGlitch API
theGlitch offers 19 image transforms from a single platform — for developers and creators alike. Fast edits (resize, format, watermark, vectorize to SVG) and AI-powered transforms (background removal, upscale, colorize, image to text, product scene, listing copy) all share the same API.
Whichever channel you use, the result and price are the same:
Quickstart
Create an account, get a key, send your first request — 60 seconds.
- Get an API key
Panel → API Keys → New key. Your access key is a unique 32-character string.
- Send your first request
Resize an image to 800px wide:
curl "https://theglitch.app/api/v1/resize?url=https://theglitch.app/showcase/resize-before.webp&width=800" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- Get the response
Response: 200 OK + processed image (binary), written to result.webp.
- Try more
All 19 processing endpoints are below: API Reference.
Authentication
All processing requests are authenticated with the X-Api-Key header. View and copy your access keys from the panel. How many keys you can hold at once depends on your plan: Free and Starter 1, Pro 5, Business 20. On plans that allow several keys you rotate without downtime by creating a new key and revoking the old one; on single-key plans you must revoke first and then create, and requests in between return 401.
curl "https://theglitch.app/api/v1/resize?width=800" \ -H "X-Api-Key: YOUR_API_KEY" \ -F "file=@photo.jpg" -o result.webp
Input Methods
There are 4 ways to send an image to the API. Every processing endpoint accepts all four. If you send more than one, this order wins: form file → url → image → binary body; in a form upload only the first file is read.
- 1 · URL
Pass a public http(s) address via the url query parameter. Localhost, private and internal-network addresses are refused; up to 5 redirects are followed; a non-2xx source response returns 400 INVALID_INPUT. The download is capped at 10 s / 25 MB and our requests carry the TheGlitch/1.0 User-Agent. URL inputs are cached for 60 minutes.
- 2 · Base64
The image field in a JSON body (data-URI supported): Content-Type: application/json.
- 3 · Binary body
Send raw bytes directly in the body with an image/* Content-Type.
- 4 · Form upload
Upload a file via the multipart file field.
# 1) URL
curl "https://theglitch.app/api/v1/resize?url=https://theglitch.app/showcase/resize-before.webp&width=800" -H "X-Api-Key: KEY" -o out.webp
# 2) Base64 (JSON body)
curl -X POST "https://theglitch.app/api/v1/resize?width=800" -H "X-Api-Key: KEY" \
-H "Content-Type: application/json" -d '{"image":"data:image/jpeg;base64,/9j/4AAQ..."}' -o out.webp
# 3) Binary body
curl -X POST "https://theglitch.app/api/v1/resize?width=800" -H "X-Api-Key: KEY" \
-H "Content-Type: image/jpeg" --data-binary @photo.jpg -o out.webp
# 4) Form upload
curl -X POST "https://theglitch.app/api/v1/resize?width=800" -H "X-Api-Key: KEY" -F "file=@photo.jpg" -o out.webpAll Transforms
19 processing endpoints (plus the read-only /v1/info). They share the same authentication. /v1/image-info and /v1/listing-copy return JSON, /v1/ocr returns JSON by default, /v1/vectorize returns SVG; the rest return a binary image.
| Method | Endpoint | Description |
|---|---|---|
| GET POST | /v1/process | Everything in one request (main endpoint) |
| GET POST | /v1/resize | Resize |
| GET POST | /v1/convert | Format conversion |
| GET POST | /v1/effects | Brightness, contrast, saturation, blur |
| GET POST | /v1/watermark | Add a watermark |
| GET POST | /v1/optimize | Optimize for the web |
| GET POST | /v1/preset/{name} | Social media presets |
| GET POST | /v1/image-info | Image metadata (JSON response) |
| GET POST | /v1/vectorize | Logo and icon to SVG (SVG response) |
| GET POST | /v1/remove-bg | Background removal (AI) |
| GET POST | /v1/upscale | AI 2x / 4x upscale |
| GET POST | /v1/colorize | Colorize black-and-white |
| GET POST | /v1/face-restore | Face restore |
| GET POST | /v1/restore | Old photo restore |
| GET POST | /v1/remove-object | Object removal (AI) |
| GET POST | /v1/headshot | Professional headshot (AI) |
| GET POST | /v1/ocr | Image to text — OCR (AI) |
| GET POST | /v1/listing-copy | Marketplace listing draft from a photo — JSON (AI) |
| GET POST | /v1/product-scene | Product scene: extra product image (AI) |
| GET | /v1/info | API capabilities & version info |
GET POST /v1/process
The main endpoint that combines everything in one request: resize, effects, rotation, watermark, format conversion and presets together. Any combination still counts as 1 request.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| width | int | Optional | 1 … 8000 | Target width (px). Aspect ratio is preserved when given alone. |
| height | int | Optional | 1 … 8000 | Target height (px). Aspect ratio is preserved when given alone. |
| mode | string | Optional | fit (fit · fill · pad · stretch (contain=fit, cover=fill)) | Resize behavior: fit contains, fill center-crops, pad letterboxes, stretch ignores aspect ratio. contain=fit, cover=fill are aliases. |
| padColor | string | Optional | #FFFFFF (#RRGGBB) | Background color of the letterbox area when mode=pad. In a GET request encode # as %23. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| brightness | int | Optional | 0 (-100 … 100) | Brightness. -100 is completely black, +100 twice as bright. |
| contrast | int | Optional | 0 (-100 … 100) | Contrast. Negative washes out, positive deepens. |
| saturation | int | Optional | 0 (-100 … 100) | Saturation. -100 equals grayscale. |
| blur | int | Optional | 0 (0 … 100) | Gaussian blur intensity. |
| sharpen | int | Optional | 0 (0 … 100) | Sharpening intensity. Start low (10–30); high values can introduce artifacts. |
| grayscale | bool | Optional | false | Converts to grayscale. |
| sepia | bool | Optional | false | Applies a warm sepia tone. |
| rotate | int | Optional | 0 (0 · 90 · 180 · 270) | Clockwise rotation. 90° increments only. |
| flipH | bool | Optional | false | Mirror horizontally (left-right). |
| flipV | bool | Optional | false | Mirror vertically (top-bottom). |
| preset | string | Optional | 14 preset adı | Applies a social media preset (size + crop). See the Preset section for names. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/process?url=https://theglitch.app/showcase/resize-before.webp&width=800&format=webp&brightness=10&sharpen=20" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- AI flags like removeBackground, upscale and colorize are also accepted — see the AI endpoint sections. Only ONE AI flag is allowed per request; more than one returns 400 MULTIPLE_AI_OPERATIONS, so chain AI operations with separate requests. An AI flag must be a plain query parameter or a top-level field of a UTF-8 JSON body. Requests using an AI flag deduct AI credits.
- POST + JSON body is supported; query string values take precedence for url/image/width/height.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/resize
Resizes the image to target dimensions. Provide at least one of width/height; mode controls cropping.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| width | int | Optional | 1 … 8000 | Target width (px). Aspect ratio is preserved when given alone. |
| height | int | Optional | 1 … 8000 | Target height (px). Aspect ratio is preserved when given alone. |
| mode | string | Optional | fit (fit · fill · pad · stretch (contain=fit, cover=fill)) | Resize behavior: fit contains, fill center-crops, pad letterboxes, stretch ignores aspect ratio. contain=fit, cover=fill are aliases. |
| padColor | string | Optional | #FFFFFF (#RRGGBB) | Background color of the letterbox area when mode=pad. In a GET request encode # as %23. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/resize?url=https://theglitch.app/showcase/resize-before.webp&width=800&height=600&mode=fill" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- Output resolution is plan-limited (Free 2048px, Starter 4000px, Pro+ 8000px). An explicit width/height above the limit returns VALIDATION_ERROR. If you request no resize and the source is larger than the limit, the output is scaled down to fit it, preserving the aspect ratio.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/convert
Converts the image to another format. Without format, auto behavior applies (Accept header → WebP default).
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/convert?url=https://theglitch.app/showcase/resize-before.webp&format=webp&quality=80" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- GIF output is served as PNG. TIFF and AVIF are available on paid plans — see File Formats.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/effects
Brightness, contrast, saturation, blur, sharpen, grayscale, sepia plus rotate/flip. All effects can be combined in a single request.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| brightness | int | Optional | 0 (-100 … 100) | Brightness. -100 is completely black, +100 twice as bright. |
| contrast | int | Optional | 0 (-100 … 100) | Contrast. Negative washes out, positive deepens. |
| saturation | int | Optional | 0 (-100 … 100) | Saturation. -100 equals grayscale. |
| blur | int | Optional | 0 (0 … 100) | Gaussian blur intensity. |
| sharpen | int | Optional | 0 (0 … 100) | Sharpening intensity. Start low (10–30); high values can introduce artifacts. |
| grayscale | bool | Optional | false | Converts to grayscale. |
| sepia | bool | Optional | false | Applies a warm sepia tone. |
| rotate | int | Optional | 0 (0 · 90 · 180 · 270) | Clockwise rotation. 90° increments only. |
| flipH | bool | Optional | false | Mirror horizontally (left-right). |
| flipV | bool | Optional | false | Mirror vertically (top-bottom). |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/effects?url=https://theglitch.app/showcase/resize-before.webp&brightness=15&contrast=20&sharpen=25" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- Rotation and flips are applied before effects and resizing.
- If grayscale and sepia are both set, grayscale wins.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/watermark
Adds a text watermark. 5 positions, custom color, size and opacity.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| watermarkText | string | Required | — | Watermark text (Unicode supported). URL-encode special characters in GET requests. |
| watermarkPosition | string | Optional | bottom-right (top-left · top-right · bottom-left · bottom-right · center) | Watermark placement. |
| watermarkOpacity | int | Optional | 50 (0 … 100) | Opacity: 0 invisible, 100 solid. |
| watermarkFontSize | int | Optional | 24 (12 … 120 px) | Font size (px). |
| watermarkColor | string | Optional | #FFFFFF (#RRGGBB) | Text color. Send # as %23 in GET requests. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/watermark?url=https://theglitch.app/showcase/resize-before.webp&watermarkText=theGlitch.app&watermarkPosition=center&watermarkOpacity=40" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- watermarkText is required and must be sent in the query string; if empty, MISSING_WATERMARK is returned.
- The watermark is applied before resizing; combine with other operations via /process.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/optimize
Automatic web optimization: output is WebP unless a format is specified, default quality 85.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/optimize?url=https://theglitch.app/showcase/resize-before.webp&quality=80" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- If a format parameter is provided, it overrides the WebP default.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/preset/{name}
Applies a social media size preset. name is a path parameter (case-insensitive, underscore naming). All presets use mode=fill (center crop).
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Available presets
| name | px | Description |
|---|---|---|
| instagram_square | 1080 × 1080 | Feed post (1:1) |
| instagram_story | 1080 × 1920 | Story / Reels (9:16) |
| instagram_post | 1080 × 1350 | Portrait post (4:5) |
| facebook_cover | 820 × 312 | Page cover photo |
| facebook_post | 1200 × 630 | Feed post / link share |
| twitter_header | 1500 × 500 | Profile header |
| twitter_post | 1200 × 675 | Tweet image (16:9) |
| linkedin_banner | 1584 × 396 | Company banner |
| linkedin_post | 1200 × 627 | Feed post |
| youtube_thumbnail | 1280 × 720 | Video thumbnail (16:9) |
| youtube_banner | 2560 × 1440 | Channel banner |
| og_image | 1200 × 630 | Open Graph / SEO preview |
| whatsapp_status | 1080 × 1920 | Status image (9:16) |
| tiktok_video | 1080 × 1920 | Video cover (9:16) |
Example
curl "https://theglitch.app/api/v1/preset/og_image?url=https://theglitch.app/showcase/resize-before.webp" \ -H "X-Api-Key: YOUR_API_KEY" \ -o og.webp
- An unknown name returns INVALID_PRESET along with the list of valid presets.
- Combine with effect/format parameters: /preset/og_image?url=…&brightness=10&format=jpeg
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/image-infoJSON response
Returns image metadata. Unlike every other endpoint, the response is JSON, not binary (Content-Type: application/json).
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Response fields
| Name | Type | Description |
|---|---|---|
| width | int | Width (px) |
| height | int | Height (px) |
| format | string | Detected format: jpeg, png, webp, gif, tiff, avif |
| colorType | string | Colour model: rgb, rgba, grayscale or cmyk. Nothing outside these four values is returned. |
| hasAlpha | bool | Whether a transparency channel exists |
| orientation | int | Raw EXIF orientation tag (1-8). width and height already report the oriented size; this field only tells you what the source tag was. |
| fileSize | int | File size (bytes) |
| fileSizeHuman | string | Human-readable size (e.g. "240.0 KB") |
{
"width": 1920,
"height": 1080,
"format": "jpeg",
"colorType": "rgb",
"hasAlpha": false,
"orientation": 1,
"fileSize": 245760,
"fileSizeHuman": "240.0 KB"
}Example
curl "https://theglitch.app/api/v1/image-info?url=https://theglitch.app/showcase/resize-before.webp" \ -H "X-Api-Key: YOUR_API_KEY"
- This endpoint does not process the image; it only decodes and inspects it. Counts as 1 request.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/vectorizeSVG response
Turns a flat-color logo or icon into a scalable SVG vector. It runs on our own servers: it counts as 1 request against your quota, not against AI credits. The response is image/svg+xml.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| colors | int | Optional | 8 (2 … 16) | Number of palette colors, 2–16 (default 8). Fewer colors give a simpler output. |
| curves | string | Optional | spline (spline · polygon) | spline (default): smooth curves · polygon: straight edges. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Response headers
| Header | Example | Description |
|---|---|---|
| Content-Type | image/svg+xml; charset=utf-8 | The body is UTF-8 SVG text. |
| Content-Security-Policy | default-src 'none'; style-src 'unsafe-inline' | Even if the SVG is opened directly in a browser, no script runs and no external resource loads. |
| X-Content-Type-Options | nosniff | The browser does not guess the content type; the file is always handled as SVG. |
Example
curl "https://theglitch.app/api/v1/vectorize?url=https://theglitch.app/logo-512.png&colors=4&curves=polygon" \ -H "X-Api-Key: YOUR_API_KEY" \ -o logo.svg
- Works best for flat-color logos and icons; heavy gradients come out simplified. It is not meant for turning photos into vectors: a photo-like, very detailed image is refused with 400 VALIDATION_ERROR.
- Turkish letters in a logo (Ç, Ğ, İ, Ö, Ş, Ü) keep their dots and cedillas; the lettering comes back as shapes (paths), not as editable text.
- Input is PNG, JPEG or WebP; at most 4 megapixels, longest edge 4096 px. A photo-like image is refused before vectorizing starts and costs nothing; if vectorizing has run and the output turns out too detailed to serve, you also get 400 VALIDATION_ERROR, and that request counts as 1 request against your quota.
- The output is cleaned: DTDs, scripts, event attributes and external links are removed and only basic shape elements remain; ids get a per-request prefix and the root element always has a viewBox.
- The image is not written to persistent storage: temporary files are kept in memory only and deleted as soon as processing finishes.
Each successful call counts as 1 request against your monthly quota (a combo of effects + resize + format is still 1).
GET POST /v1/remove-bgAI · 1 credit
Removes the background with AI; the result has a transparent background.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/remove-bg?url=https://theglitch.app/showcase/bg-before.webp" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.png
- With format=auto the output is forced to PNG to preserve transparency. An explicit format wins.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/upscaleAI · 1 credit
Upscales resolution 2x or 4x with AI; sharpens low-resolution images.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| upscaleScale | int | Optional | 4 (2 · 4) | Upscale factor: 2x or 4x. Any other value returns INVALID_SCALE. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/upscale?url=https://theglitch.app/showcase/up-before.webp&upscaleScale=4" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- Combine with effects, watermark or format: /upscale?url=…&upscaleScale=2&sharpen=20&format=webp
- Two separate limits apply: (1) the source image cannot exceed 2.1 megapixels (1448×1448) — this limit is independent of the scale factor; (2) the upscaled size (source × factor) must stay within your plan's resolution limit — on Free (2048px) that means sources up to 512px for 4×, or 1024px for 2×. If either is exceeded, VALIDATION_ERROR is returned before the AI runs and no AI credits are used.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/colorizeAI · 1 credit
Brings black & white or faded photos to natural color with AI.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/colorize?url=https://theglitch.app/showcase/color-before.webp" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/face-restoreAI · 9 credits
Restores blurry, low-resolution or degraded faces with AI.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/face-restore?url=https://theglitch.app/showcase/face-before.webp" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- Whatever the input measures, the output is normalized to about 1 megapixel; the aspect ratio and the orientation are roughly preserved. Sending a larger source does not produce a larger result — keep your original. Very wide or very tall images (a panorama, say) can come back noticeably reshaped.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/restoreAI · 9 credits
Repairs old, damaged or faded photographs with AI; age-related degradation is fixed automatically.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/restore?url=https://theglitch.app/showcase/feat-photo-before.webp" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- Scratch, tear and stain repair is automatic; no separate parameter is needed for it.
- Whatever the input measures, the output is normalized to about 1 megapixel; the aspect ratio and the orientation are roughly preserved. Sending a larger source does not produce a larger result — keep your original. Very wide or very tall images (a panorama, say) can come back noticeably reshaped.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/remove-objectAI · 1 credit
Removes masked objects with AI and fills the background naturally.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| mask | string | Required | — | Mask image: a URL in the query string or base64 in the JSON body. Must match source dimensions; white areas mark objects to remove, black areas are preserved. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/remove-object?url=https://theglitch.app/showcase/obj-before.webp&mask=YOUR_MASK_URL" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- mask is required. Send a URL in the query string, or base64 data in the mask field of a JSON body (POST); if it is missing, MISSING_MASK is returned.
- To prepare a mask, paint the areas to remove white in any editor and save as a PNG with the same dimensions as the source.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/headshotAI · 9 credits
Generates a studio-style professional headshot from a portrait photo with AI — for CVs, LinkedIn and company team pages. The result is an image; format and quality apply as on the other AI endpoints.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| background | string | Optional | neutral (neutral · white · gray · black · office) | Portrait background: neutral (default), white, gray, black or office. |
| aspectRatio | string | Optional | 3:4 (3:4 · 1:1 · 4:5 · 2:3) | Output aspect ratio: 3:4 (default), 1:1, 4:5 or 2:3. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Example
curl "https://theglitch.app/api/v1/headshot?url=https://theglitch.app/showcase/det-face-s3-before.webp&background=office&aspectRatio=3:4" \ -H "X-Api-Key: YOUR_API_KEY" \ -o headshot.webp
- This is NOT a biometric ID photo: it cannot be used for passports, ID cards, driving licences or official applications.
- Only send your own photo, or a photo of someone who has given you permission (terms of use).
- No gender or similar attribute is asked for; the headshot is generated from the uploaded photo.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/ocrAI · 1 creditJSON response
Reads the text in an image with AI: receipts, invoices, menus, business cards, old documents. The default response is JSON (text, markdown, blocks, warnings); use output to get plain text, Markdown, HTML, CSV, Word (DOCX) or PDF.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| output | string | Optional | json (json · txt · md · html · csv · docx · pdf) | Output format. json (default) returns a structured result; txt, md, html and csv return text; docx and pdf return a downloadable document. Content types are in the table below. |
| csvDelimiter | string | Optional | ; (; · , · tab) | Delimiter for output=csv only: ; (default, Turkish Excel), , or tab. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Output formats
| output | Content-Type | Description |
|---|---|---|
| json | application/json; charset=utf-8 | Default. Structured result; fields below. |
| txt | text/plain; charset=utf-8 | Plain text; table cells are separated by tabs. |
| md | text/markdown; charset=utf-8 | Markdown (GFM); tables as Markdown tables. |
| html | text/html; charset=utf-8 | An HTML document (lang="tr"). Text in the image is never treated as markup; no raw HTML is produced. |
| csv | text/csv; charset=utf-8 | Tables the image prints with their own header row; otherwise one text column with a row per line. Receipts and price lists come back as plain lines, not tables. UTF-8 with a BOM, delimiter set by csvDelimiter. |
| docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | A Word document; attachment, filename="ocr.docx". |
| application/pdf | A re-typeset text PDF with Turkish characters embedded; attachment, filename="ocr.pdf". |
JSON fields (output=json)
| Name | Type | Description |
|---|---|---|
| text | string | All extracted text, as plain text. |
| markdown | string | The same content as Markdown (GFM). |
| blocks | array | The document structure, in order: each block has a type (heading, paragraph, list, table) and, depending on the type, level, text, items or rows. |
| warnings | string[] | Fixed warning keys (e.g. truncated, low_confidence, fallback_used); empty means no warnings. |
Example: an image that contains a table with its own printed header row (Ürün, Tutar). A table is returned as a table only when the image prints a header row; receipt items and price lists come back as plain lines.
{
"text": "KAHVE EVİ\n\nFiş No: 0042\n\nÜrün\tTutar\nTürk kahvesi\t60,00\nSu\t15,00\n",
"markdown": "# KAHVE EVİ\n\nFiş No: 0042\n\n| Ürün | Tutar |\n|---|---|\n| Türk kahvesi | 60,00 |\n| Su | 15,00 |\n",
"blocks": [
{ "type": "heading", "level": 1, "text": "KAHVE EVİ" },
{ "type": "paragraph", "text": "Fiş No: 0042" },
{ "type": "table", "rows": [["Ürün", "Tutar"], ["Türk kahvesi", "60,00"], ["Su", "15,00"]] }
],
"warnings": []
}Example
curl "https://theglitch.app/api/v1/ocr?url=https://theglitch.app/showcase/det-ocr-hero-before.webp&output=json" \ -H "X-Api-Key: YOUR_API_KEY"
- The output is a draft: check it against the original image before you use it, especially numbers, names and tables.
- The input is a single image; PDF input is not accepted. Send a multi-page document page by page as images — each image is a separate request and is charged separately.
- csv: only tables the image prints with their own header row are written as tables, row by row. Receipts and price lists are not treated as tables and stay as plain lines; if there is no table, no error is returned — each line of text becomes a single-column (text) row. The file is UTF-8 with a BOM; the default delimiter is a semicolon, for Turkish Excel (csvDelimiter).
- docx and pdf return a file to download (Content-Disposition: attachment; filename="ocr.docx" / "ocr.pdf"). The PDF is the extracted text re-typeset, with an embedded font for Turkish characters; the original image is not included.
- warnings carries fixed keys: truncated (the output looks cut short or stuck repeating; text may be missing or duplicated), fallback_used (the first reading looked unusable and the image was read again), low_confidence (no text was found, or it could not be read reliably). An empty array means no warnings. The same keys also arrive, comma-separated, in the X-Glitch-Warnings response header for every output format; the header is absent when there are no warnings.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/listing-copyAI · 1 creditJSON response
Writes a Turkish marketplace listing draft from a product photo (Trendyol, Hepsiburada, n11 format). The response is JSON: title, description, features, color, material, keywords, altText and warnings.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| brand | string | Optional | ≤ 60 | Brand name, 60 characters max. If given it is used in the title; otherwise a brand is written only if it can be read on the product. It reaches the model as data, not as an instruction. |
| category | string | Optional | ≤ 60 | Category hint (e.g. sneaker), 60 characters max. It reaches the model as data. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
JSON fields
| Name | Type | Description |
|---|---|---|
| title | string | Title in the brand + product type + key feature pattern, 100 characters max. A brand appears only if you sent one or it can be read on the product. |
| description | string | Product description; paragraphs are separated by a blank line. |
| features | string[] | Feature bullets that can be seen in the photo. |
| color | string | null | Dominant color; null when it cannot be determined from the photo. |
| material | string | null | Material; null when it cannot be determined from the photo (no guessing). |
| keywords | string[] | Lower-case Turkish search keywords. |
| altText | string | An objective image description for blind and low-vision users, 125 characters max. |
| warnings | string[] | Warning keys: fallback_used (the first draft did not match the schema and was rewritten with a backup model), truncated (the title or alt text went over its limit and was shortened), wording_review (the text contains an exaggeration, health claim or unverifiable performance claim to review before publishing; the text is not changed, only flagged). An empty array means no warnings. |
Example: a real response for the white shoe photo in the request above, with category=sneaker. The text can differ on every call and is a draft.
{
"title": "Beyaz Kanvas Dokulu Bağcıklı Sneaker Ayakkabı",
"description": "Bu beyaz sneaker, sade ve yalın tasarımıyla günlük stilinizin temel parçalarından biri olmaya adaydır. Kanvas dokulu dış yüzeyi ve aynı tondaki dikiş detaylarıyla temiz bir görünüm sunan bu ayakkabı, her türlü kıyafetle kolayca uyum sağlar. Bağcıklı kapanış sistemi, ayak yapınıza göre ayarlanabilen bir yapı sunarken, ayakkabının genelindeki beyaz renk bütünlüğü modern bir estetik yaratır. Metal halkalı bağcık delikleri ve tonal bağcıklarıyla bütünüyle beyaz bir görünüm sergiler.\n\nGündelik kombinlerinizde kot pantolonlar, şortlar veya keten pantolonlarla bir araya getirerek zahmetsiz bir şıklık yakalayabilirsiniz. Sade tasarımı sayesinde hem spor hem de yarı resmi kıyafetlerle birlikte kullanılabilir. Ürünün burun kısmındaki dokulu kauçuk detay, tasarıma hareket katarken yan panellerdeki dikişler belirgin bir görünüm sergiler. Gardırobunuzdaki farklı renk ve desenlerle rahatça eşleştirebileceğiniz bu çok yönlü model, stilinize ferah bir dokunuş ekler.\n\nŞehir hayatının hareketli temposuna uyum sağlayan bu model, düşük bilekli yapısı ve klasik silüetiyle dikkat çeker. Taban kenarlarındaki ince çizgisel detaylar ve burun bölümündeki pütürlü doku, tasarımın yalınlığını destekleyen estetik unsurlardır. Farklı mekanlarda kullanıma uygun olan bu tasarım, nötr rengi sayesinde mevsim geçişlerinde de kurtarıcı bir parça rolü üstlenir. Minimalist detayları ve beyazın zamansız etkisini birleştiren bu ürünü, çeşitli aksesuarlarınızla kolayca tamamlayarak kendi tarzınızı yansıtabilirsiniz.",
"features": ["Bağcıklı kapanış sistemi", "Kanvas dokulu dış yüzey", "Düşük bilekli tasarım", "Beyaz metal kuşgözü detayları", "Tonal dikiş özellikleri", "Dokulu burun koruması"],
"color": "beyaz",
"material": null,
"keywords": ["beyaz sneaker", "kanvas ayakkabı", "bağcıklı sneaker", "günlük ayakkabı", "düz taban sneaker", "beyaz ayakkabı", "spor ayakkabı", "bez ayakkabı"],
"altText": "Yan profilden görünen, beyaz renkli, kanvas dokulu ve beyaz bağcıklı düşük bilekli sneaker ayakkabı.",
"warnings": []
}Example
curl "https://theglitch.app/api/v1/listing-copy?url=https://theglitch.app/showcase/feat-bgrm-shoe-before.webp&category=sneaker" \ -H "X-Api-Key: YOUR_API_KEY"
- The output is a draft: check details such as brand, size and material before you publish. Health claims and superiority claims such as "the best" or "flawless" are forbidden in the prompt; this is not a guarantee of legal compliance.
- brand and category are optional (60 characters max) and reach the model as data, not as instructions; control characters are stripped.
- color and material come back null when they are not visible in the photo (no guessing). The title is at most 100 characters and the alt text at most 125.
- For now it writes Turkish only.
- If the model cannot produce a result that matches the schema, it is retried once with a backup model; if that also fails you get 503 GPU_ERROR (Retry-After: 30) and no credits are charged.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/product-sceneAI · 2–7 credits
Creates an extra image for a marketplace listing from a product photo: a white background with a soft shadow (studio), the chosen lifestyle setting (lifestyle) or studio light that keeps the background (relight). The result is an image.
Parameters
| Name | Type | Required | Default · Range | Description |
|---|---|---|---|---|
| url | string | Optional | — | Public http(s) URL of the image to process. The response is cached for 60 minutes; if the image behind the URL changes, vary a parameter (e.g. &v=2) to get a fresh result. |
| image | string | Optional | — | Base64-encoded image (data-URI supported). Send in the JSON body. |
| file | file | Optional | — | Multipart form file (field name: file). Keep other parameters in the query string. |
| sceneType | string | Optional | studio (studio · lifestyle · relight) | studio (default): white background with a soft shadow · lifestyle: the chosen lifestyle setting · relight: studio light, keeping the background. The credits charged depend on the type. |
| scenePreset | string | Optional | oak_living (oak_living · marble_bath · kitchen_counter · concrete_minimal) | Only with sceneType=lifestyle: oak_living (default; light oak table, Scandinavian living room), marble_bath (marble bathroom counter), kitchen_counter or concrete_minimal (minimal concrete). |
| aspectRatio | string | Optional | 2:3 (2:3 · 1:1 · 3:4 · 4:5) | Output aspect ratio: 2:3 (default, marketplace), 1:1, 3:4 or 4:5. |
| format | string | Optional | auto (auto · jpeg · png · webp · tiff · avif · gif) | Output format. auto: picked from the Accept header, defaults to WebP. |
| quality | int | Optional | 85 (1 … 100) | Compression quality for lossy formats (JPEG, WebP). No effect on PNG. |
Input can be url, image (base64), file (form) or a raw binary body — see Input Methods.
Response
| Header | Example | Description |
|---|---|---|
| Content-Type | image/webp | The result is an image; format and quality apply as on the other AI endpoints (WebP by default). |
| X-Glitch-Notice | product-redrawn | Product scene (product-scene) only: product-redrawn means the product was redrawn by AI (its original pixels were not pasted back); do not use that image as the main image. The relight type always redraws the product. |
Example
curl "https://theglitch.app/api/v1/product-scene?url=https://theglitch.app/showcase/feat-bgrm-shoe-before.webp&sceneType=studio&aspectRatio=2:3" \ -H "X-Api-Key: YOUR_API_KEY" \ -o scene.webp
- Credits depend on the type: studio 2, lifestyle 7, relight 6 AI credits. Without sceneType, studio is charged.
- This is for extra images: the marketplace main image should stay the original white-background photo.
- In the studio and lifestyle types the product's original pixels are pasted back into the result when the placement check passes. If it fails, lifestyle retries with a backup model, while studio returns the raw output with the X-Glitch-Notice: product-redrawn header. If the backup fails the check too, the lifestyle result carries the same header.
- The relight type does not paste pixels back: the product is redrawn by AI, and lettering, logos and texture may change. Its output should not be used as the main image.
- No free-text prompt is accepted; the scene is chosen only through sceneType and scenePreset. Ideally send a photo with a single product: if no product can be separated from the background, you get 422 GPU_INPUT_REJECTED and no credits are charged.
- An invalid sceneType, scenePreset or aspectRatio value is rejected with 400 VALIDATION_ERROR before any AI call; no credits are charged. scenePreset is used only by the lifestyle type and is ignored by the others.
A successful call deducts from your monthly AI credits only; it does not count against the request quota. The cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. Which failed requests are charged is listed under Quotas & Limits. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
Quotas & Limits
Monthly request quotas depend on your plan. AI requests draw from a separate balance of AI credits, and every AI operation has a fixed credit cost. There is no per-minute rate limit. The quota period is your billing period on paid plans and the UTC calendar month on the Free plan (it resets on the 1st).
| Plan | Requests / mo | AI credits / mo | Max resolution |
|---|---|---|---|
| Free | 500 | 10 | 2048 × 2048 |
| Starter | 15,000 | 200 | 4000 × 4000 |
| Pro | 75,000 | 2,000 | 8000 × 8000 |
| Business | 300,000 | 10,000 | 8000 × 8000 |
| Scale | 1,000,000 | 30,000 | 8000 × 8000 |
- A single request combining resize + 5 effects + format conversion = 1 request.
- AI endpoints deduct from your AI credits only; they do not count against the request quota. The credit cost depends on the operation: remove-bg, upscale, colorize, remove-object, ocr (per image) and listing-copy cost 1 credit; product-scene costs 2 (studio), 6 (relight) or 7 (lifestyle); face-restore, restore and headshot cost 9. vectorize (SVG) is not an AI operation and counts against the request quota. Current weights are in the aiUnits field of /api/v1/info, and the credits charged by a call in the X-Glitch-AI-Units header (sent only when credits were charged). If you have fewer credits left than the operation costs, the request returns 429 GPU_QUOTA_EXCEEDED without running; the body carries required, limit, used and resetsAt.
- Only successful responses count against the request quota; the one exception is vectorize, where a request refused after vectorizing has run (an output too detailed to serve) also counts as 1 request. For AI credits, a successful call deducts its weight, and so does a request that disconnects after the AI work was sent to the provider or fails after the AI step for a reason not on our side. A fault on the AI service, temporary throttling (GPU_BUSY), an image the model rejects (GPU_INPUT_REJECTED), 4xx validation errors and our own timeouts (408) deduct nothing.
- URL inputs are cached for 60 minutes (the window refreshes on each hit); an identical request returns instantly without reprocessing. Cached responses do not count against your quota and carry no X-Glitch-Processing-Time. Professional headshots, image to text, listing copy and SVG vectorization results are never cached: on those endpoints an identical request is processed again and counts again.
- When your request quota runs out, AI requests stop too: you get 429 REQUEST_QUOTA_EXCEEDED even if you still have AI credits left.
Responses include custom headers so you can monitor your usage:
| Header | Example | Description |
|---|---|---|
| X-Glitch-Plan | pro | Your current subscription plan |
| X-Glitch-Requests-Remaining | 74922 | Requests remaining in this period, including this one. AI requests are not counted here. |
| X-Glitch-GPU-Remaining | 1958 | AI credits remaining in this period, including this request |
| X-Glitch-AI-Units | 9 | The AI credits charged by this call. Sent only when credits were charged; if the header is absent, this call was not charged. |
| X-Glitch-Warnings | low_confidence | On image to text (ocr), listing copy (listing-copy) and vectorize: comma-separated warning keys. ocr: low_confidence, truncated, fallback_used (sent with every output format); listing-copy: fallback_used, truncated, wording_review (the same as warnings in the JSON response); vectorize: large_output (the SVG is over 2 MB or 5,000 paths). Absent when there are no warnings. |
| X-Glitch-Notice | product-redrawn | Product scene (product-scene) only: product-redrawn means the product was redrawn by AI (its original pixels were not pasted back); do not use that image as the main image. The relight type always redraws the product. |
| X-Glitch-Processing-Time | 142ms | Server-side processing duration |
| Retry-After | 10 | On 429 responses and on 503 GPU_ERROR: how many seconds to wait before retrying. For AI_FAILURE_LIMIT, fix the input before trying again once it has passed. |
Error Codes
Error responses are always JSON with a 4xx/5xx status code. Successful responses are binary images, except /image-info and /listing-copy (JSON), /ocr (JSON, text or a document, depending on output) and /vectorize (SVG). Tell success from failure by the status code, not the Content-Type.
Error response format
{
"error": true,
"code": "INVALID_INPUT",
"message": "No image input provided. Use url, image (base64), file upload, or binary body."
}| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_INPUT | Image input missing or invalid (one of url / image / file / binary body is required). Also returned when an AI flag is not sent as a plain query parameter or a top-level field of a UTF-8 JSON body (e.g. a prefixed query name, a UTF-16 body). |
| 400 | MULTIPLE_AI_OPERATIONS | More than one AI flag in a single request (e.g. /process?removeBackground=true&upscale=true), or an AI flag added to an /ocr request. Send each AI operation as its own request; retrying the same request gives the same result. |
| 400 | INVALID_FORMAT | The requested output format is not supported, or the uploaded file is in a format we do not accept. The error message names the format. /vectorize accepts PNG, JPEG and WebP only. |
| 403 | FORMAT_REQUIRES_PLAN | TIFF and AVIF are available on paid plans — on both input and output. The response body carries format, direction and requiredPlan. This request does not count against your monthly quota. |
| 400 | VALIDATION_ERROR | Image exceeds size, resolution (plan-based), the 80-megapixel decode limit, the 2.1-megapixel (1448×1448) source cap for AI upscaling, or format limits, or a parameter value is invalid (e.g. quality; background or aspectRatio for headshot; output or csvDelimiter for ocr; sceneType, scenePreset or aspectRatio for product-scene; a brand or category over 60 characters and a blank image for listing-copy; colors, curves, the 4-megapixel / 4096 px input limit, an input too detailed to vectorize (photo-like) and an output too detailed to serve for vectorize). On AI endpoints this is returned before the request reaches the AI, so it costs no AI credits. On vectorize, a refusal that comes after vectorizing has run (an output too detailed to serve) still counts as 1 request against your quota. |
| 400 | MISSING_WATERMARK | watermarkText parameter is missing (required in the query string). |
| 400 | INVALID_SCALE | upscaleScale must be 2 or 4. |
| 400 | MISSING_MASK | mask parameter is missing (send a URL in the query string or base64 in the JSON body). |
| 400 | INVALID_MASK | Mask image could not be resolved (invalid URL/base64). |
| 400 | INVALID_PRESET | Unknown preset name; the response includes the list of valid presets. |
| 400 | INVALID_IMAGE | Image could not be decoded (corrupt or unsupported file). Returned by /image-info, /ocr, /listing-copy and /vectorize (on /ocr and /listing-copy before the AI step, so no credit is spent); the other processing endpoints report the same condition as VALIDATION_ERROR. |
| 401 | UNAUTHORIZED | API key missing or invalid. |
| 403 | GPU_NOT_AVAILABLE | AI transforms are not included in your current plan; these endpoints stay closed until you upgrade. |
| 403 | FEATURE_DISABLED | The requested feature is disabled on the server. |
| 408 | TIMEOUT | The request exceeded its time budget: 30 s for quick transforms, 90 s for AI transforms. Upload time and the source-URL fetch (10 s) both count against that budget. |
| 413 | PAYLOAD_TOO_LARGE | The request body exceeded the server limit. A base64 body is about a third larger than the raw image, so it can hit the cap first. |
| 422 | GPU_INPUT_REJECTED | The AI model refused this input — the image may be corrupt or carry unsupported content, the object-removal mask may not match the image, or no product could be separated from the background for a product scene. This is permanent: retrying the same input will not help. Size-related refusals do NOT land here — they return VALIDATION_ERROR before the AI runs and cost no AI credits. |
| 429 | REQUEST_QUOTA_EXCEEDED | Monthly request quota exhausted. |
| 429 | GPU_QUOTA_EXCEEDED | Not enough AI credits left for this operation. The body carries required (the operation's cost), limit, used and resetsAt (when the period ends); Retry-After runs until the end of the period. |
| 429 | GPU_BUSY | The AI service is momentarily busy. Wait the number of seconds in the Retry-After header (also in the retryAfterSeconds field) and retry — this is not a quota error. |
| 429 | SERVER_BUSY | Concurrency gate: the server is at capacity right now. Wait for the Retry-After header's value and retry — this is not a quota error. |
| 429 | AI_FAILURE_LIMIT | Too many of your account's recent AI requests failed in the model, so new AI requests are refused for a short while. Once the Retry-After header (also retryAfterSeconds in the body) has passed, retry with a corrected input (image, format, mask). This is not a quota error. |
| 500 | PROCESSING_ERROR | Internal image processing error. |
| 500 | GPU_UNAVAILABLE | A problem on our side: the AI provider is not configured, or the provider rejected our account or configuration. Retrying will not help — open a support ticket if it persists. |
| 503 | GPU_ERROR | The AI service failed temporarily — this is not permanent. The response always carries Retry-After: 30; wait that long and retry. It is also returned when there is no capacity for an image this size at that moment; a smaller image may go through. |
| 503 | GPU_UPLOAD_FAILED | The image could not be sent for AI processing. This is transient: wait a moment and retry the same request. This response carries no Retry-After. |
File Formats
| Format | Input | Output | Note |
|---|---|---|---|
| JPG / JPEG | — | ||
| PNG | — | ||
| WebP | — | ||
| AVIF | Paid plans only — input and output. AVIF’s quality scale is not the same as WebP’s: at the same quality value it produces higher fidelity and therefore a larger file. For smaller files try a quality of 60-70. | ||
| TIFF | Paid plans only — input and output. Output is lossless (Deflate) and quality is ignored. | ||
| GIF | GIF input is read, output is served as PNG. For animated GIFs only the first frame is processed. | ||
| BMP | BMP is not supported. If you upload one you get an error that names the format; your file is not corrupt. |
Webhooks
Receiving long-running AI results via webhooks is on our roadmap — coming soon. The draft below shows the planned payload shape.
{ "event": "transform.completed", "job_id": "job_8f3a91", "endpoint": "/v1/upscale", "status": "ok", "duration_ms": 3214, "result_url": "https://cdn.theglitch.app/r/8f3a91.png"}Changelog
v1.1 · October 2026
- Image to text (OCR): reads the text on receipts, invoices, menus, business cards and old documents, and returns it as JSON, TXT, Markdown, HTML, CSV, Word (DOCX) or PDF. The output is a draft — check it before you use it. 1 AI credit per image.
- Professional headshot: a studio-style portrait for CVs, LinkedIn and company team pages, with 5 backgrounds and 4 aspect ratios. It is not a biometric ID photo. 9 AI credits per call.
- Listing copy: a Turkish listing draft from a product photo in the format Trendyol, Hepsiburada and n11 use — title, description, features, color, material, keywords and alt text (JSON). It is a draft; check it before you publish. Batch processing can also collect the listings in a single CSV. 1 AI credit per image.
- Product scene: an extra image from a product photo — white background (2 credits), relight (6 credits) or a lifestyle setting (7 credits). The marketplace main image should stay the original white-background photo; the panel and the API tell you when the product was redrawn by AI.
- Vectorize to SVG: turns flat-color logos and icons into 2–16 color SVG vectors; Turkish letters in a logo keep their shape. It uses no AI credits and counts as 1 request.
- The AI quota is now AI credits: each AI operation deducts its own weight — background removal, upscaling, colorize, object removal, OCR and listing copy cost 1; product scene costs 2, 6 or 7 depending on the type; face restore, photo restore and professional headshot cost 9. The free plan now includes 10 credits a month.
- New error codes: MULTIPLE_AI_OPERATIONS (more than one AI operation in a single request) and AI_FAILURE_LIMIT (repeated failed AI requests, with Retry-After). 503 GPU_ERROR now always carries Retry-After: 30.
- The Studio now has 19 operations and shows how many credits an AI operation will use before it runs. The separate "scratch repair" option in photo restore is gone: restoration already removes scratches.
v1.0.1 · 17 August 2026
- AI requests no longer count against your monthly request quota. Background removal, upscaling, colorize, face restore, photo restore and object removal now consume only the AI quota, so a plan's request allowance is the full amount advertised.
- X-Glitch-Requests-Remaining and X-Glitch-GPU-Remaining now include the request being served. The last request your plan allows reports 0 instead of 1, matching the 429 you get on the next one.
- Remaining counts are a close estimate rather than an exact ledger: requests running in parallel may not be reflected yet.
v1.0 · 29 May 2026
- 8 quick image processing tools: resize, format conversion, effects, watermark, optimize, crop, social media sizes and image info.
- 6 AI tools: background removal, AI upscaling, colorize, face restore, photo restore and object removal.
- 3 access channels: web panel, REST API and MCP server.
- 4 plans: Free, Starter, Pro and Business.