Welcome to the theGlitch API
theGlitch offers 14 image transforms from a single platform — for developers and creators alike. Fast edits (resize, format, watermark) and AI-powered transforms (background removal, upscale, colorize) 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 14 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
14 processing endpoints (plus the read-only /v1/info). They share the same authentication and, except for /v1/image-info, 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/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 | /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, colorize are also accepted — see the AI endpoint sections. Requests using an AI flag count against the AI quota.
- 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/remove-bgGPU · counts against AI quota
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.
Each successful call consumes 1 from your monthly AI quota only; it does not count against the request quota. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/upscaleGPU · counts against AI quota
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 quota is used.
Each successful call consumes 1 from your monthly AI quota only; it does not count against the request quota. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/colorizeGPU · counts against AI quota
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
Each successful call consumes 1 from your monthly AI quota only; it does not count against the request quota. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/face-restoreGPU · counts against AI quota
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.
Each successful call consumes 1 from your monthly AI quota only; it does not count against the request quota. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/restoreGPU · counts against AI quota
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. |
| withScratch | bool | Optional | false | Enables scratch/tear repair. Use true for physically damaged photos. |
| 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&withScratch=true" \ -H "X-Api-Key: YOUR_API_KEY" \ -o result.webp
- Use withScratch=true if the photo has physical damage like scratches or tears.
- 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.
Each successful call consumes 1 from your monthly AI quota only; it does not count against the request quota. (If your request quota is exhausted, AI calls also return 429 REQUEST_QUOTA_EXCEEDED.)
GET POST /v1/remove-objectGPU · counts against AI quota
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.
Each successful call consumes 1 from your monthly AI quota only; it does not count against the request quota. (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 are tracked against a separate AI quota. There is no per-minute rate limit; quotas reset on the 1st of each month (UTC).
| Plan | Requests / mo | AI / mo | Max resolution |
|---|---|---|---|
| Free | 500 | 5 | 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 (remove-bg, upscale, colorize, face-restore, restore, remove-object) consume 1 from the AI quota only; they do not count against the request quota.
- Only successful (2xx) responses count against your quota.
- 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.
- When your request quota runs out, AI requests stop too: you get 429 REQUEST_QUOTA_EXCEEDED even if your AI quota is untouched.
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 this month, including this one. AI requests are not counted here. |
| X-Glitch-GPU-Remaining | 1958 | AI requests remaining this month, including this one |
| X-Glitch-Processing-Time | 142ms | Server-side processing duration |
| Retry-After | 10 | On 429 responses and on the capacity-related 503 GPU_ERROR: how many seconds to wait before retrying. |
Error Codes
Error responses are always JSON; successful responses are binary images. If the response Content-Type starts with image/, the request succeeded; application/json means an error (one exception: /image-info returns JSON on success too).
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). |
| 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. |
| 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. On AI endpoints this is returned before the request reaches the AI, so it costs no AI 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 only; the 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, may carry unsupported content, or, for object removal, the mask may not match the image. 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 quota. |
| 429 | REQUEST_QUOTA_EXCEEDED | Monthly request quota exhausted. |
| 429 | GPU_QUOTA_EXCEEDED | Monthly AI quota exhausted. |
| 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. |
| 500 | PROCESSING_ERROR | Internal image processing error. |
| 500 | GPU_UNAVAILABLE | The AI provider is not configured. This is on our side; retrying will not help — open a support ticket if it persists. |
| 503 | GPU_ERROR | AI service temporarily failed — this is not permanent and the call can be retried. If a Retry-After header came with it, wait that long. 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.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.