API documentation
Last updated: 7 November 2026
On the $7.99 plan you can remove backgrounds straight from your own tool or script. Each call sends one photo and returns a PNG with a transparent background. Calls count against the same 3,000 photos a month as the browser.
1. Create an API key
- Sign in on the home page and subscribe to the $7.99 plan.
- In the "API access" section near the bottom of the page, give the key a name and press "Create key". The key is a 44-character string starting with
snk_and is shown only once, right after it is created. Keep it somewhere safe. - An account can hold up to 5 keys. Revoke a key you no longer use with "Revoke"; a revoked key never works again.
Keys are personal. Do not lend, transfer or sell them. Calling the API from inside your own service or tool, or processing your clients' photos as a listing agency, is fine (just never hand over the key string itself). If you think a key has leaked, revoke it at once and create a new one.
If you cancel or move to the $4.99 plan, the keys stop working (403). You can still list and revoke them. When you return to the $7.99 plan, keys you did not revoke work again.
2. Send a photo
| Endpoint | POST https://shironuki.com/v1/cutout |
|---|---|
| Authentication | Authorization: Bearer snk_… |
| Request body | The image file itself (JPEG, PNG, WebP, HEIC and so on). Content-Type is the image type, such as image/jpeg, or application/octet-stream. Up to 20 MB per photo. |
| Processing time | Usually a few seconds; large images can take about 30 seconds. Set your client timeout to 120 seconds. |
| Option | Add ?trim=1 to crop the transparent margin away. |
| On success | 200 with an image/png body (the photo with a transparent background). Headers: x-counted (1 when this call counted a photo, 0 when it did not), x-used (photos used this month), x-remaining (photos left). |
Photos resized to about 2,000 px on the long side process faster and more reliably; the browser version applies the same resize before uploading.
3. How photos are counted
- Only calls that return a result count as one photo. Failed calls do not count.
- Sending the same image data again in the same month does not count a second time (re-runs are free). We compare a hash of the image bytes and never store the image itself.
- If you change plan during a month, the photos already used that month count against the new plan's cap.
- Months are calendar months in Japan Standard Time. Browser and API use add up to the plan's 3,000 photos. At the cap the API answers
429and no new photo is processed until the next month. There is no overage billing.
4. Limits
- Per account: 10 requests per second and 10 requests in flight. Beyond that the API answers
429({"error":"rate"}); wait the seconds given inRetry-Afterand send again. - 20 MB and 100 megapixels per photo; beyond that the API answers
413. Retry-Afteris 3 seconds when 10 requests are in flight and 1 second when the per-second rate is exceeded.
5. Errors
Error bodies are JSON with the reason in error. Errors returned by the network edge (Cloudflare) may be HTML, so handle a body that is not JSON.
400 network | The body was cut off. Send it again. |
|---|---|
401 key | No key, a malformed key, an unknown key, or a revoked one. |
403 plan | The key's owner is not on the $7.99 plan (cancelled or expired included). |
413 size | Over 20 MB. |
413 pixels | Over 100 megapixels. |
415 type / decode | Not an image, or a format that cannot be read. |
429 quota | The month's 3,000 photos are used up. Retry-After is the number of seconds until the next month. |
429 rate | Over 10 requests per second or 10 in flight. Send again after Retry-After seconds. |
502 engine | A fault in the processing engine. Tell us if it repeats. |
503 busy | The service is busy. Send again after Retry-After seconds. |
6. Photos left this month
GET https://shironuki.com/v1/usage with the same Authorization header returns {"used":…,"limit":3000,"remaining":…,"month":"202611","resets_at":"…"}. Nothing is counted.
7. Examples
curl:
curl -X POST https://shironuki.com/v1/cutout \
-H "Authorization: Bearer snk_…" \
-H "Content-Type: image/jpeg" \
--data-binary @photo.jpg \
-o photo.png
Python (requests):
import requests
KEY = "snk_…"
with open("photo.jpg", "rb") as f:
r = requests.post(
"https://shironuki.com/v1/cutout",
headers={"Authorization": f"Bearer {KEY}", "Content-Type": "image/jpeg"},
data=f.read(),
timeout=120,
)
if r.status_code == 200:
open("photo.png", "wb").write(r.content)
print(r.headers["x-remaining"], "photos left")
else:
print(r.status_code, r.text[:200])
8. If you need a white-background JPEG
The API returns the transparent PNG only. For a white-background JPEG, place the PNG over a white canvas and save it (the browser version does this composite on your device).
The terms of use apply to the API. What we store is listed in section 1 of the privacy policy.