AI Image and Video Upscaling API
One REST API for image upscaling, video upscaling to 4K, and image utilities, built for apps, pipelines, and AI agents. Pay per result with the same credits as the web app.
- Images
- Up to 100 MP
- Video
- 4K, 60 fps
- Billing
- Per result
curl -X POST https://upsampler.com/api/v2/image/upscale/auto \
-H "Authorization: Bearer $UPSAMPLER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"input": {
"imageUrl": "https://example.com/photo.jpg",
"maxCredits": 20
},
"webhook": "https://your.app/hooks/upsampler"
}'import os, uuid, requests
r = requests.post(
"https://upsampler.com/api/v2/image/upscale/auto",
headers={
"Authorization": f"Bearer {os.environ['UPSAMPLER_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={"input": {"imageUrl": "https://example.com/photo.jpg", "maxCredits": 20}},
)
print(r.json())const res = await fetch("https://upsampler.com/api/v2/image/upscale/auto", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.UPSAMPLER_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
input: { imageUrl: "https://example.com/photo.jpg", maxCredits: 20 },
}),
});
console.log(await res.json());{
"id": "cmh2x8f3k0001",
"status": "IN_QUEUE",
"creditCost": 4,
"auto": {
"intent": "faithful",
"model": "p-image-upscale",
"input": { "upscaleFactor": 4 },
"output": { "width": 4096, "height": 3072 },
"credits": 4,
"reason": "A clean photo with real detail, so it is enlarged as it is."
}
}Every endpoint, with its price
Prices are in credits and match the web app. The cost of each job comes back in the submit response, before anything runs.
Image upscaling
- POSTmodel: auto (default)
/api/v2/image/upscale/{model}The advisor picks the model, settings and size for the image, then it runs. Add preview to see a tile first, or compare the options side by side.
The model's price - POSTRecommend
/api/v2/image/upscale/recommendMeasures the image and returns which model to use, with the exact input and price.
Free - POSTFlux
/api/v2/image/upscale/fluxCreative upscaling: regenerates fine detail as it enlarges.
1 credit per output MPUp to 100 MP - POSTKrea 2
/api/v2/image/upscale/krea-2Creative upscaling with a natural, photographic look.
1 credit per output MPUp to 100 MP - POSTStable Diffusion
/api/v2/image/upscale/stable-diffusionCreative upscaling with the classic SD look.
1 credit per output MPUp to 50 MP - POSTSeed VR 2 Small
/api/v2/image/upscale/seed-vr-2Faithful upscaling: sharper, cleaner, nothing invented.
1 credit per 4 output MPUp to 100 MP - POSTSeed VR 2 Large
/api/v2/image/upscale/seed-vr-2-largeThe larger SeedVR2: more fine texture recovered, nothing invented.
1 credit per 2 output MPUp to 100 MP - POSTP Image Upscale
/api/v2/image/upscale/p-image-upscaleFast faithful upscaling with a photorealistic lift.
1 credit per 4 output MPUp to 100 MP - POSTGAN
/api/v2/image/upscale/ganFast faithful upscaling for large batches.
1 credit per 4 output MPUp to 100 MP
Video upscaling
- POSTmodel: auto (default)
/api/v2/video/upscale/{model}The advisor picks the model, settings and size for the clip, then it runs. Add preview to see a few seconds first, or compare the options side by side.
The model's price - POSTRecommend
/api/v2/video/upscale/recommendMeasures the clip and returns which model to use, with the exact input and price.
Free - POSTLTX 2.5
/api/v2/video/upscale/ltx-2-5Rebuilds the most detail; a creativity setting controls how much.
2 credits per MP·sUp to about 4 MP - POSTSeedVR 2
/api/v2/video/upscale/seed-vr-2Diffusion upscaler, strong on AI clips and heavy compression.
2.5 credits per MP·sUp to about 4 MP - POSTRelayVSR
/api/v2/video/upscale/relay-vsrFaithful detail with steady motion, nothing invented.
0.5 credits per MP·sUp to about 4 MP - POSTRTX VSR
/api/v2/video/upscale/rtx-vsrFast, clean sharpening all the way to 4K.
0.1 credits per MP·sUp to 4K (2160p) - POSTGAN
/api/v2/video/upscale/ganFast GAN upscaling to 4K.
0.2 credits per MP·sUp to 4K (2160p)
Image utilities
- POSTBackground removal
/api/v2/image/edit/background-removalTransparent cutout of the subject.
1 credit per image - POSTColorize
/api/v2/image/edit/colorizeNatural color for black and white photos.
5 credits per image - POSTDepth map
/api/v2/image/edit/depth-mapA grayscale depth map for 3D and compositing.
1 credit per image
Jobs and files
- POSTUploads
/api/v2/uploadsA signed upload URL for files too large to send by link.
Free - GETStatus
/api/v2/status/{id}Job status and result URLs; fresh links on every call.
Free - GETAccount
/api/v2/accountThe credit balance, to check before a large job.
Free - GETModels
/api/v2/modelsEvery model the API serves.
Free
The models behind the endpoints
Runs from the same models the API serves.
Drag the split to compare. Zoom in to check the detail.
Built for agents
Everything an AI agent needs to find the endpoints, call them safely, and get the result back without a human in the loop.
- Docs agents can read
- The whole reference as plain markdown, generated from the schemas the API validates with, so it never drifts from what the endpoints accept.
/api/v2/llms.txt- OpenAPI 3.1
- Point a code generator or an agent's tool loader at the spec and every endpoint becomes a typed call.
/api/v2/openapi.json- Safe retries
- Send an Idempotency-Key with each submission. A retried request returns the original job instead of charging twice.
Idempotency-Key: <uuid>- Results that come back on their own
- Pass a webhook and get one signed POST when the job finishes, or poll the status endpoint. Failed jobs are refunded automatically.
"webhook": "https://..."
Reference
API Documentation 🖼️
Integrate our powerful image upscaling capabilities into your application.
Introduction
Welcome to the Upsampler API! It upscales images and video with the same models as the web app: creative ones that redraw fine detail as they enlarge (Krea 2, Flux, Stable Diffusion) and faithful ones that keep the image as it is (P Image, SeedVR2, GAN), plus a few image utilities. It runs over HTTPS with JSON request and response bodies, and the input fields match the settings in the web app.
Not sure which model to use? Send auto as the model and the API picks one for your file, or add preview to see a small tile before you pay for the whole image. See Choosing a model below.
Use the API version toggle below to view either the legacy v1 endpoints or the new v2 paths. v1 remains supported for existing integrations.
All tasks are processed asynchronously. You can provide a webhook URL to be notified when processing is complete, or you can poll the status endpoint. Please note that all returned image URLs are temporary and will expire after 3 hours.
Pricing
Every endpoint shows its own price, on the endpoint. Rates differ per model and per media type, so a single table at the top of this page could only ever be a summary of some of them, and would go stale the first time a model was added.
- Image upscaling is priced per megapixel of the output, so the cost follows the upscale factor.
keepIdentityadds 5 credits per image andrestore5. - Video upscaling is priced per output megapixel-second, so it follows the factor and the clip length. A target
fpsabove 24 adds 0.01 credits per second of video for each frame per second over it, andkeepIdentityadds 3 per second of video. - Utilities are a flat cost per image.
The submit response returns the exact creditCost charged. GET /models returns the live rate for every model, which is what to read if you are computing costs ahead of time. A failed job is refunded automatically.
Authentication
All API requests require authentication. Include your API key in the Authorization header as a Bearer token.
Authorization: Bearer YOUR_API_KEYAPI Version
Select the API version you want to use. v2 introduces clearer endpoint naming while keeping request payloads nearly identical. New integrations should use v2 by default.
Base URL
All API requests should be made to the following base URL:
https://staging.upsampler.com/api/v2General Request Structure
All POST requests to the upscaling endpoints share a common structure:
{
"webhook": "YOUR_WEBHOOK_URL", // Optional
"input": { /* Schema-specific input parameters as detailed below */ }
}- webhook (string, optional): A HTTPS URL where a POST request with the results (or error) will be sent upon completion or failure of the upscaling job. We will attempt to deliver the webhook notification up to 3 times with exponential backoff if the initial attempts fail. Your endpoint should respond with a 2xx status code to acknowledge receipt.
- input (object, required): An object containing the specific parameters for the chosen endpoint. The schema for this object varies by endpoint (see below).
Retries and idempotency
Send an Idempotency-Key header on any submission and we will treat repeats of that key as one job for 24 hours, returning the original response instead of starting and charging a second job. Use a fresh UUID per job. Without it, a retry after a timeout starts a second job and costs a second time.
Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset, so you can pace requests without waiting to be refused. Failures also carry a stable code field alongside the human-readable error; branch on code, never on the message text.
What happens to your images
Your input is read from your URL when you submit, and again when the job runs. Keep the file reachable and unchanged until the job completes. We record what your origin reports about the file (its ETag and size) at submit and check it again before running; if it changed in between, the job fails with a full refund rather than being priced on one file and processed on another. Base64 inputs are uploaded to our storage at submit and are not subject to this.
Jobs are deleted 7 days after submission, result included. After that GET /status/{id} returns 404. Download what you need within that window; result URLs can be re-issued from the status endpoint any time until then.
Webhook signatures
Every webhook we deliver carries an Upsampler-Signature header shaped t=<unix seconds>,v1=<hex>. The signature is an HMAC-SHA256 over "<t>.<raw body>" using your key's webhook secret, which you can reveal next to the key above. Verify it before trusting a delivery, and reject a t older than a few minutes so a captured delivery cannot be replayed.
Choosing a model
Every upscale is POST /image/upscale/{model} or POST /video/upscale/{model}. Use auto as the model unless you need a specific one: the advisor looks at the file, picks the model, settings and size, and the job runs through that model's route with its own price, validation, idempotency and refunds.
- auto takes the same fields as the model routes, all optional except the file, plus
intent:"faithful"(the default) keeps the image as it is,"detail"lets the model redraw fine detail. Any setting you send overrides the pick. The response adds anautoobject with themodel, theinputthat ran, theoutputsize, thecreditsand a one-sentencereason. Picks improve over time, so pin a model (with the settings fromauto.input) when you need the same result every time. - recommend (
POST /image/upscale/recommendor/video/upscale/recommend) is free: the plan without the job. It returns what the file shows and twopicks, faithful and detail, each with the endpoint, the exact input to send, the output size and the price. - maxCredits on any upscale is a cap on what the request may charge. A job that would cost more is refused with code
budget_exceededand nothing is charged; it is never made smaller or swapped to fit. Withauto, the pick for yourintentis checked: over the cap, the request is refused, and the other intent's pick never runs in its place. Withpreview, the cap applies to the preview's price; with severalcandidates, to all of them together.
curl -X POST https://staging.upsampler.com/api/v2/image/upscale/auto \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{ "input": { "imageUrl": "https://example.com/image.jpg", "maxCredits": 20 } }'Look before you pay: preview
Add "preview": true (or a preview object) to any upscale and the job runs on a square tile of the image, or a few seconds of a video, at the model's normal rate for that much output: usually 1 to 2 credits for an image tile. The response says which tile ran (crop or segment), the fullCreditCost of the whole file, and fullRequest, the exact request to send for it.
- Image:
cropis"auto"(the default: the largest face, else text, else the most detailed area) or{ "x", "y", "size" }, the tile's centre and side as shares of the image.cropPixelssets the tile's output side (default 1024, up to 2048). - Video:
segmentis"auto"or{ "start", "seconds" }, 1 to 5 seconds. - Compare (with
autoonly):"candidates": "recommended"previews the faithful and detail picks side by side, or list up to 4 models as{ "model": "<slug>", ...settings }. All run on the same tile, as one job with oneid(startingcmp_);GET /status/{id}lists every candidate with its result, price andfullRequest. Each candidate counts as one request against your rate limit, and a webhook arrives once per candidate.
curl -X POST https://staging.upsampler.com/api/v2/image/upscale/auto \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "input": { "imageUrl": "https://example.com/image.jpg", "preview": { "candidates": "recommended" } } }'Restore first
For old, damaged or very blurry photos, "restore": true has an edit model repair the image (tears, stains, missing areas, fading, compression artifacts) before the upscale, for 5 extra credits. The repair redraws the image, so small details can change. Output is capped at 8 MP, inputs larger than about 3.7 MP are refused, and it has no preview. With "intent": "detail", auto turns it on by itself for an image that needs it.
Keep identity
"keepIdentity": true upscales every face separately with a faithful face model and blends it back, so people keep looking like themselves on a creative model. It adds 5 credits per image, and on video 3 credits per second, previews included, charged whether or not a face is found. Leave it off for files without people.
Fields a model doesn't use: ignoredFields
A request is never refused over a field the route doesn't need. Unknown fields, settings the chosen model lacks and retired fields are accepted and dropped, and the response lists each one in ignoredFields with the reason. Check it: an ignored setting did not apply. Wrong values in fields the route does use (an upscaleFactor out of range, a missing imageUrl) are still a 400.
Endpoints
Click on an endpoint below to see its request structure and code examples.
Response Handling
Upon submitting a valid request to an upscale endpoint, you will receive an initial synchronous response confirming that the job has been started or queued. Make sure you store the id from this response, as it is the key to associating the final, asynchronous result with your initial request. The actual results, including image URLs or any processing errors, are delivered asynchronously. If you provide a webhook URL, the final results will be send there. Otherwise, you must use the GET /status/{id} endpoint to retrieve the results.
Initial Synchronous Response:
// Synchronous Response on Success
{
"id": "xxxxxxxxxxxx",
"status": "IN_PROGRESS", // or "IN_QUEUE"
"creditCost": x,
// Only when you sent fields this route did not use:
"ignoredFields": [{ "field": "fooBar", "reason": "Unknown field." }]
}
// Synchronous Response on Failure
{
"status": "FAILED",
"error": "ERROR MESSAGE",
"code": "invalid_request" // stable; branch on this, not on the message
}Asynchronous Results:
Once the job is complete, you can retrieve the final results in one of two ways:
- Webhook: Our server will send a POST request to the provided `webhook` URL with the final result.
- Status endpoint: You can call the
GET /status/{id}endpoint with the job ID.
Important: The compressedImageUrl and imageUrl are temporary and will only be valid for 3 hours. Please download and store the images.
Final Result Payloads (via Webhook or GET):
// Payload on Success
{
"id": "xxxxxxxxxxxx",
"status": "SUCCESS",
"compressedImageUrl": "URL_TO_COMPRESSED_IMAGE", // display-sized rendition
"imageUrl": "URL_TO_FULL_QUALITY_IMAGE", // full-quality output (PNG for upscales)
"creditCost": x
}
// Payload on Failure
{
"id": "xxxxxxxxxxxx",
"status": "FAILED",
"error": "Failed to process image due to an internal error. Your credits have been refunded."
}Error Handling (Synchronous)
Errors that occur before a job is started or queued (e.g., authentication issues, invalid request structure, validation errors) will be returned synchronously. The API uses standard HTTP status codes.
- 400 Bad Request: The request JSON was malformed or contained semantic errors (e.g.,
upscaleFactorout of range). - 401 Unauthorized: No API key was provided, or the API key is invalid.
- 403 Forbidden: API key inactive or insufficient credits.
- 404 Not Found: The requested job ID does not exist (applies to the
GET /status/{id}endpoint). - 413 Payload Too Large: The request payload exceeds the maximum allowed size.
- 429 Too Many Requests: You have exceeded the rate limit, or your account already has as many jobs running and queued as your plan allows.
- 500 Internal Server Error: An unexpected error occurred on our side before the job could be started or queued.
Every failure also carries a stable code. Branch on it, never on the error text:
invalid_request: a value is wrong or a required field is missing (400).unauthorized: missing, invalid or inactive key.insufficient_credits: the balance doesn't cover the job (403).budget_exceeded: the job costs more than yourmaxCredits; nothing was charged (400).rate_limited: too many requests, or a full job queue (429). Wait forRetry-After.idempotency_conflict: a request with the sameIdempotency-Keyis still in progress (409).model_unavailable: no such model slug; useautoorGET /models(404).input_unreadable,unsupported_format,input_too_large,output_too_large: the file could not be fetched or read, or is too big in or out.content_rejected: the input failed moderation.not_found: no such job for this key, or it expired.provider_failed,internal: an error on our side. Nothing is charged for a job that fails; retry later.
Processing errors that occur after a job has been queued will be reported via the webhook.
Rate Limits
To ensure service stability, API requests are rate-limited per API key. The current limit for the upscaling endpoints is 90 requests per minute and 6000 requests per hour. For the GET /status/{id} endpoint, the limit is 240 requests per minute. The advisor (recommend, and the analysis step of auto) has its own budget of 20 requests per minute and 300 per hour, since it decodes your file on our servers. A compare counts each candidate as one request. Exceeding these limits will result in a 429 Too Many Requests error. Keep in mind that your subscription plan’s concurrent job and queue size limits apply as well: jobs beyond the concurrent limit are queued, and a full queue also returns 429.
Support
If you have any questions, encounter issues, or need assistance with the API, please do not hesitate to contact us.