Docs / Overview

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:

Web Panel

Drag, drop in the browser. Process up to 100 images at a time without code.

Open panel

REST API

Call from your backend with one request. Standard HTTP, JSON response.

Quickstart

MCP Server

Direct calls from AI assistants like Claude and Cursor.

View MCP
First request? Get your first response in 60 seconds via the Quickstart below.

Quickstart

Create an account, get a key, send your first request — 60 seconds.

  1. Get an API key

    Panel → API Keys → New key. Your access key is a unique 32-character string.

  2. Send your first request

    Resize an image to 800px wide:

    ~/glitch · curl
    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
  3. Get the response

    Response: 200 OK + processed image (binary), written to result.webp.

  4. Try more

    All 14 processing endpoints are below: API Reference.

Tip: If you want to try without code, the Web Panel is one click away.

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 · header
curl "https://theglitch.app/api/v1/resize?width=800" \  -H "X-Api-Key: YOUR_API_KEY" \  -F "file=@photo.jpg" -o result.webp
Security: Never expose your API key on the client. Always keep it server-side.

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. 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. 2 · Base64

    The image field in a JSON body (data-URI supported): Content-Type: application/json.

  3. 3 · Binary body

    Send raw bytes directly in the body with an image/* Content-Type.

  4. 4 · Form upload

    Upload a file via the multipart file field.

4 input · curl
# 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.webp
Important: Only the file is read from form uploads — send parameters like width and format in the query string, not as form fields.
Limits: Max input 25 MB · every request has a time budget: 30 s for quick transforms, 90 s for AI transforms (exceeding it returns 408 TIMEOUT). Upload time counts against that budget, so on a slow connection you can hit 408 well before 25 MB · source images up to 80 megapixels · for AI upscale the source is capped at 2.1 megapixels (1448×1448) · restoration output is normalized to about 1 megapixel · URL fetch timeout 10 s (exceeding it returns 408 TIMEOUT) · output resolution is plan-based (2048–8000 px).

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

MethodEndpointDescription
GET POST/v1/processEverything in one request (main endpoint)
GET POST/v1/resizeResize
GET POST/v1/convertFormat conversion
GET POST/v1/effectsBrightness, contrast, saturation, blur
GET POST/v1/watermarkAdd a watermark
GET POST/v1/optimizeOptimize for the web
GET POST/v1/preset/{name}Social media presets
GET POST/v1/image-infoImage metadata (JSON response)
GET POST/v1/remove-bgBackground removal (AI)
GET POST/v1/upscaleAI 2x / 4x upscale
GET POST/v1/colorizeColorize black-and-white
GET POST/v1/face-restoreFace restore
GET POST/v1/restoreOld photo restore
GET POST/v1/remove-objectObject removal (AI)
GET/v1/infoAPI 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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
widthintOptional1 … 8000Target width (px). Aspect ratio is preserved when given alone.
heightintOptional1 … 8000Target height (px). Aspect ratio is preserved when given alone.
modestringOptionalfit (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.
padColorstringOptional#FFFFFF (#RRGGBB)Background color of the letterbox area when mode=pad. In a GET request encode # as %23.
qualityintOptional85 (1 … 100)Compression quality for lossy formats (JPEG, WebP). No effect on PNG.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
brightnessintOptional0 (-100 … 100)Brightness. -100 is completely black, +100 twice as bright.
contrastintOptional0 (-100 … 100)Contrast. Negative washes out, positive deepens.
saturationintOptional0 (-100 … 100)Saturation. -100 equals grayscale.
blurintOptional0 (0 … 100)Gaussian blur intensity.
sharpenintOptional0 (0 … 100)Sharpening intensity. Start low (10–30); high values can introduce artifacts.
grayscaleboolOptionalfalseConverts to grayscale.
sepiaboolOptionalfalseApplies a warm sepia tone.
rotateintOptional0 (0 · 90 · 180 · 270)Clockwise rotation. 90° increments only.
flipHboolOptionalfalseMirror horizontally (left-right).
flipVboolOptionalfalseMirror vertically (top-bottom).
presetstringOptional14 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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
widthintOptional1 … 8000Target width (px). Aspect ratio is preserved when given alone.
heightintOptional1 … 8000Target height (px). Aspect ratio is preserved when given alone.
modestringOptionalfit (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.
padColorstringOptional#FFFFFF (#RRGGBB)Background color of the letterbox area when mode=pad. In a GET request encode # as %23.
qualityintOptional85 (1 … 100)Compression quality for lossy formats (JPEG, WebP). No effect on PNG.
formatstringOptionalauto (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
qualityintOptional85 (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
brightnessintOptional0 (-100 … 100)Brightness. -100 is completely black, +100 twice as bright.
contrastintOptional0 (-100 … 100)Contrast. Negative washes out, positive deepens.
saturationintOptional0 (-100 … 100)Saturation. -100 equals grayscale.
blurintOptional0 (0 … 100)Gaussian blur intensity.
sharpenintOptional0 (0 … 100)Sharpening intensity. Start low (10–30); high values can introduce artifacts.
grayscaleboolOptionalfalseConverts to grayscale.
sepiaboolOptionalfalseApplies a warm sepia tone.
rotateintOptional0 (0 · 90 · 180 · 270)Clockwise rotation. 90° increments only.
flipHboolOptionalfalseMirror horizontally (left-right).
flipVboolOptionalfalseMirror vertically (top-bottom).
qualityintOptional85 (1 … 100)Compression quality for lossy formats (JPEG, WebP). No effect on PNG.
formatstringOptionalauto (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
watermarkTextstringRequired—Watermark text (Unicode supported). URL-encode special characters in GET requests.
watermarkPositionstringOptionalbottom-right (top-left · top-right · bottom-left · bottom-right · center)Watermark placement.
watermarkOpacityintOptional50 (0 … 100)Opacity: 0 invisible, 100 solid.
watermarkFontSizeintOptional24 (12 … 120 px)Font size (px).
watermarkColorstringOptional#FFFFFF (#RRGGBB)Text color. Send # as %23 in GET requests.
qualityintOptional85 (1 … 100)Compression quality for lossy formats (JPEG, WebP). No effect on PNG.
formatstringOptionalauto (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
qualityintOptional85 (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
qualityintOptional85 (1 … 100)Compression quality for lossy formats (JPEG, WebP). No effect on PNG.
formatstringOptionalauto (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

namepxDescription
instagram_square1080 × 1080Feed post (1:1)
instagram_story1080 × 1920Story / Reels (9:16)
instagram_post1080 × 1350Portrait post (4:5)
facebook_cover820 × 312Page cover photo
facebook_post1200 × 630Feed post / link share
twitter_header1500 × 500Profile header
twitter_post1200 × 675Tweet image (16:9)
linkedin_banner1584 × 396Company banner
linkedin_post1200 × 627Feed post
youtube_thumbnail1280 × 720Video thumbnail (16:9)
youtube_banner2560 × 1440Channel banner
og_image1200 × 630Open Graph / SEO preview
whatsapp_status1080 × 1920Status image (9:16)
tiktok_video1080 × 1920Video cover (9:16)

Example

curl
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—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

NameTypeDescription
widthintWidth (px)
heightintHeight (px)
formatstringDetected format: jpeg, png, webp, gif, tiff, avif
colorTypestringColour model: rgb, rgba, grayscale or cmyk. Nothing outside these four values is returned.
hasAlphaboolWhether a transparency channel exists
orientationintRaw EXIF orientation tag (1-8). width and height already report the oriented size; this field only tells you what the source tag was.
fileSizeintFile size (bytes)
fileSizeHumanstringHuman-readable size (e.g. "240.0 KB")
200 · application/json
{
  "width": 1920,
  "height": 1080,
  "format": "jpeg",
  "colorType": "rgb",
  "hasAlpha": false,
  "orientation": 1,
  "fileSize": 245760,
  "fileSizeHuman": "240.0 KB"
}

Example

curl
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
qualityintOptional85 (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
upscaleScaleintOptional4 (2 · 4)Upscale factor: 2x or 4x. Any other value returns INVALID_SCALE.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
qualityintOptional85 (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
qualityintOptional85 (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
qualityintOptional85 (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
withScratchboolOptionalfalseEnables scratch/tear repair. Use true for physically damaged photos.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
qualityintOptional85 (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
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

NameTypeRequiredDefault · RangeDescription
urlstringOptional—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.
imagestringOptional—Base64-encoded image (data-URI supported). Send in the JSON body.
filefileOptional—Multipart form file (field name: file). Keep other parameters in the query string.
maskstringRequired—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.
formatstringOptionalauto (auto · jpeg · png · webp · tiff · avif · gif)Output format. auto: picked from the Accept header, defaults to WebP.
qualityintOptional85 (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
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).

PlanRequests / moAI / moMax resolution
Free50052048 × 2048
Starter15,0002004000 × 4000
Pro75,0002,0008000 × 8000
Business300,00010,0008000 × 8000
Scale1,000,00030,0008000 × 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:

HeaderExampleDescription
X-Glitch-PlanproYour current subscription plan
X-Glitch-Requests-Remaining74922Requests remaining this month, including this one. AI requests are not counted here.
X-Glitch-GPU-Remaining1958AI requests remaining this month, including this one
X-Glitch-Processing-Time142msServer-side processing duration
Retry-After10On 429 responses and on the capacity-related 503 GPU_ERROR: how many seconds to wait before retrying.
Tip: These counts include the request being served, so 0 means you just used the last one and the next request returns 429 with REQUEST_QUOTA_EXCEEDED or GPU_QUOTA_EXCEEDED. Treat them as a close estimate rather than an exact ledger: requests running in parallel may not be reflected yet. A 429 can also arrive with quota to spare: the GPU_BUSY code means the AI service is momentarily busy and the call can be retried after Retry-After.

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

4xx/5xx · application/json
{
  "error": true,
  "code": "INVALID_INPUT",
  "message": "No image input provided. Use url, image (base64), file upload, or binary body."
}
Extra fields: Some errors carry more than these three fields: 429 quota responses add limit, used and upgrade; 429 GPU_BUSY adds retryAfterSeconds; 401 adds signup and docs.
HTTPCodeDescription
400INVALID_INPUTImage input missing or invalid (one of url / image / file / binary body is required).
400INVALID_FORMATThe requested output format is not supported, or the uploaded file is in a format we do not accept. The error message names the format.
403FORMAT_REQUIRES_PLANTIFF 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.
400VALIDATION_ERRORImage 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.
400MISSING_WATERMARKwatermarkText parameter is missing (required in the query string).
400INVALID_SCALEupscaleScale must be 2 or 4.
400MISSING_MASKmask parameter is missing (send a URL in the query string or base64 in the JSON body).
400INVALID_MASKMask image could not be resolved (invalid URL/base64).
400INVALID_PRESETUnknown preset name; the response includes the list of valid presets.
400INVALID_IMAGEImage could not be decoded (corrupt or unsupported file). Returned by /image-info only; the processing endpoints report the same condition as VALIDATION_ERROR.
401UNAUTHORIZEDAPI key missing or invalid.
403GPU_NOT_AVAILABLEAI transforms are not included in your current plan; these endpoints stay closed until you upgrade.
403FEATURE_DISABLEDThe requested feature is disabled on the server.
408TIMEOUTThe 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.
413PAYLOAD_TOO_LARGEThe 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.
422GPU_INPUT_REJECTEDThe 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.
429REQUEST_QUOTA_EXCEEDEDMonthly request quota exhausted.
429GPU_QUOTA_EXCEEDEDMonthly AI quota exhausted.
429GPU_BUSYThe 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.
429SERVER_BUSYConcurrency gate: the server is at capacity right now. Wait for the Retry-After header's value and retry — this is not a quota error.
500PROCESSING_ERRORInternal image processing error.
500GPU_UNAVAILABLEThe AI provider is not configured. This is on our side; retrying will not help — open a support ticket if it persists.
503GPU_ERRORAI 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.
503GPU_UPLOAD_FAILEDThe 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.
The Retry-After header Every 429 response and the capacity-related 503 GPU_ERROR carry a Retry-After header, and it is exposed through CORS for browser calls. When the header is there, use the seconds it gives you instead of a fixed delay. 408 TIMEOUT and 503 GPU_UPLOAD_FAILED do not carry it; both can still be retried, with a delay you pick yourself.

File Formats

FormatInputOutputNote
JPG / JPEG—
PNG—
WebP—
AVIFPaid 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.
TIFFPaid plans only — input and output. Output is lossless (Deflate) and quality is ignored.
GIFGIF input is read, output is served as PNG. For animated GIFs only the first frame is processed.
BMPBMP is not supported. If you upload one you get an error that names the format; your file is not corrupt.
format=auto: The best format is picked from the Accept header, defaulting to WebP. With background removal, auto falls back to PNG to keep transparency.

Webhooks

Receiving long-running AI results via webhooks is on our roadmap — coming soon. The draft below shows the planned payload shape.

Coming soon
draft payload
{  "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.

All release notes