Developers
REST API Reference
Authenticate, make requests, handle errors and paginate, with an end-to-end generation example. Every operation is listed below.
The REST API is served at:
https://ximagesplitter.com/api/v1It accepts and returns JSON. The pages under this section document every operation, generated from the same definitions the API runs on. The machine-readable OpenAPI 3.1 document is at https://ximagesplitter.com/api/v1/openapi.json.
Authentication
Operations that read public product facts (models, prices and the product profile) need no credential. Every other operation needs one of:
- an API Key you create in your account;
- an OAuth access token issued to a Connected App for the
https://ximagesplitter.com/api/v1resource.
Send it as a bearer token:
curl https://ximagesplitter.com/api/v1/account/profile \
-H "Authorization: Bearer $API_KEY"Each operation requires a specific Scope, shown on its page, such as generations:write.
Example: generate an image
Pick a model
GET /models lists the available model (Seedream 5.5) with its operations, options, input slots and limits. GET /models/{modelId} returns one.
curl https://ximagesplitter.com/api/v1/models/seedream-5-5Check the price
POST /generations/estimate returns the Credits a run would cost, without charging anything.
curl -X POST https://ximagesplitter.com/api/v1/generations/estimate \
-H "Content-Type: application/json" \
-d '{
"modelKey": "seedream-5-5",
"operation": "text-to-image",
"prompt": "A lighthouse coast at sunset, wide panorama",
"options": { "composition": "x-carousel", "aspectRatio": "16:9", "resolution": "2K", "outputCount": 1 }
}'{ "appCredits": 10 }Start the generation
POST /generations charges the Credits and starts the job. Send an Idempotency-Key so a retried request never starts a second paid run.
curl -X POST https://ximagesplitter.com/api/v1/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 4f1c2a9e-lighthouse-01" \
-d '{
"submission": {
"mode": "image",
"modelKey": "seedream-5-5",
"operation": "text-to-image",
"prompt": "A lighthouse coast at sunset, wide panorama",
"options": { "composition": "x-carousel", "aspectRatio": "16:9", "resolution": "2K", "outputCount": 1 },
"assets": []
}
}'{ "creationId": "…", "status": "generating", "remainingCredits": 290 }Get the result
Poll GET /generations/{creationId} until status is succeeded or failed, or subscribe to the generation.completed and generation.failed webhooks instead.
curl https://ximagesplitter.com/api/v1/generations/$CREATION_ID \
-H "Authorization: Bearer $API_KEY"When it has succeeded, primaryOutput.url and outputAssets hold the image URLs, and splitterLinks holds one link per image that opens it in the Image Splitter for the signed-in owner. A failed generation returns its Credits automatically.
The response values above are examples; prices and balances depend on your account and the current catalog. To add reference images (free, up to 10), upload them first with POST /uploads and pass the returned publicUrl in assets, or pass any public https URL directly.
Errors
Errors use standard HTTP status codes and one JSON shape:
{
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "Payment is required to continue.",
"request_id": "…",
"details": {}
}
}| Status | Meaning |
|---|---|
400 | The input is invalid. details.issues lists each field and the problem. |
401 | The credential is missing, invalid, expired or revoked. See WWW-Authenticate. |
402 | Not enough Credits for this generation or prompt improvement. |
403 | The credential lacks the required Scope (insufficient_scope). |
404 | Not found, including resources that belong to someone else. |
409 | The Idempotency-Key was already used with a different request body. |
429 | Too many requests. Wait for the number of seconds in Retry-After. |
5xx | A temporary problem on our side or at a model provider. Retry later. |
code is stable and safe to branch on; message is for people. Every response, successful or not, carries an x-request-id header. Quote it when you contact support.
Conventions
- Idempotency. Operations that create something you may retry (a generation, a prompt improvement, a checkout, a support or refund request) accept an
Idempotency-Keyheader. The same key with the same body returns the first result instead of acting twice. - Pagination. Lists return
{ "items": [...], "next_cursor": "…" }. Passcursor=<next_cursor>for the next page andlimit(up to 100) for the page size.next_cursorisnullon the last page. - Rate limits. Reads, writes and generations each have their own per-minute limit. A
429tells you how long to wait. - Asynchronous work. Generations finish in the background; the API returns as soon as the job is accepted.
- Hand-offs. Credit Pack checkouts (and changes to a subscription created before subscriptions stopped being sold) return a URL the account owner opens to pay or confirm. Nothing is paid through the API itself.
