JenVid API
Generate images and video from your own code with the same models, prices and wallet as the studio. All requests go to https://jenvid.com; results are served from JenVid URLs.
New integrations should use /v1/media/*: see the Async media API and the quick start. /v1/generations and /v1/quotes are kept for compatibility.
/docs is the walkthrough and this page the reference. /openapi.yaml imports into Postman, Insomnia or openapi-generator; /skill.md is the same guide for AI coding tools.
Authentication
Send your key as Authorization: Bearer gj_live_…. Keys are shown once, stored only as a hash, and can be limited by scope (generate, read, assets, redeem), model, credit budget and expiry. Rotate or revoke them any time in the API console; revoked keys stop working immediately. Keys never grant administrative access. Keep keys on your server: never ship them in a web page or app bundle.
Async media API
The simplest way to generate. POST /v1/media/generate takes model, an optional prompt, params (the values listed under each model's params) and an optional notify_url. It answers 202 with a task_id. The older strategy and custom_line_ids fields are deprecated: they are still accepted but ignored. Poll GET /v1/media/tasks/{task_id} every 5 seconds until is_final is true, or give a notify_url and we POST the same task body to it when the task is final (attempts at once, then after 10, 30 and 60 seconds). Callbacks are signed like webhooks with the secret from GET /v1/media/notify-secret.
# 1. Pick a model and read its parameters
curl https://jenvid.com/v1/media/models?type=image -H "Authorization: Bearer $JENVID_API_KEY"
# 2. Start a task (202 -> {"task_id": "...", "state": "queued", "credits_held": "0.250000"})
curl -X POST https://jenvid.com/v1/media/generate \
-H "Authorization: Bearer $JENVID_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042" \
-d '{"model":"gpt-image-2.6-flare-2k","prompt":"a lighthouse at dusk","params":{"aspect_ratio":"16:9"}}'
# 3. Poll every 5 seconds until "is_final" is true
curl https://jenvid.com/v1/media/tasks/$TASK_ID -H "Authorization: Bearer $JENVID_API_KEY"A task is queued, running, then succeeded, failed or cancelled. credits shows held, captured, refunded and net; failed and cancelled tasks are refunded in full. A 202 has a Location header with the task URL. Without a key you can browse models at GET /api/public/models (no params) or on the models page. There is no endpoint that lists tasks, so store each task_id; repeating the submit with the same Idempotency-Key returns the original task.
Output links and expiry
Each output has a url that works without signing in until url_expires_at. For generated files this is the same moment as file_expires_at: 24 hours (1 day) after the output was completed. Both are UTC timestamps in ISO 8601 format. Polling the task again returns the same URL; it does not issue a new link or extend the time. expires_at is a deprecated alias of file_expires_at.
- Anyone who has the link can download the file. Treat it as a secret: do not log it or post it publicly.
- Disabling or revoking an API key does not revoke links that were already issued.
- After
file_expires_atthe file is removed and the link answers410 OUTPUT_EXPIRED. Download what you need before then.
Cancelling
POST /v1/media/tasks/{id}/cancel answers 200 with the task, whose cancellation is a plain string, as before: cancelled (stopped before the model accepted it; the held credits are released), requested (recorded, but the model already has the job: it may still finish and be charged; the request alone does not release credits, the final outcome decides) or not_cancellable (already final). The additive cancellation_details is the object {state, requested_at} and cancellation_state repeats the string. /v1/generations/{id}/cancel keeps a top-level string cancellation with the same additive fields and answers 200 (cancelled), 202 (requested) or 409 (not_cancellable). On the GET calls, GET /v1/media/tasks/{id} and GET /v1/generations/{id}, cancellation is that object (or null when nothing was requested, never a string) and cancellation_details repeats it; while a request is pending it carries cancellation_details: {"state": "requested", "requested_at": "…"}. Stopping an accepted job is best effort: not every model can do it. For generations, the GET call returns cancellation only, without cancellation_details.
Timing
timing.timing_basis is supplier_reported when the model reported its start, and dispatch_to_finish when it did not. In that case model_queue_seconds is null (unknown, not zero) and run_seconds runs from dispatch to finish.
Prices and unknown keys
GET /v1/models/{id}/pricing returns the price of each supported option in options. The model object's pricing has a unit (per_image, per_second, per_megapixel, per_unit or per_request), an options matrix with exact totals, and quote_required, which is false only when nothing can change the total. A variable output count makes it true: the per-image price stays per image and you multiply it by the number of outputs. When quote_required is true or options.complete is false, ask POST /v1/quotes for the exact price. Every key you send must be declared by the model: an undeclared key, including an unknown top-level key, is rejected with 422 UNKNOWN_INPUT and details {"field", "suggestion"} (the suggestion is a hint, never applied). Nothing is priced, held or charged. This also covers keys inside object-type inputs: an undeclared child is rejected as field.child instead of being dropped.
Media API errors
These endpoints answer with {"error":{"code","message","retryable","request_id"}}. Retry only when retryable is true, after Retry-After. Calls from an address outside a key's IP allowlist get 403 ip_not_allowed naming the address, and are never charged.
| HTTP | Code | Retry | Meaning |
|---|---|---|---|
| 400 | invalid_request | No | Malformed or invalid request, unknown task id (404), state conflict (409). |
| 401 | unauthorized | No | Missing, wrong, revoked, disabled or expired key. |
| 402 | insufficient_balance | No | Wallet balance too low: redeem a code. |
| 402 | quota_exceeded | No | The key's budget or the account's spending limit is used up. |
| 403 | forbidden | No | Missing scope, suspended account, or a management key used on a generation endpoint. |
| 403 | model_not_allowed | No | The key may not use this model. |
| 403 | ip_not_allowed | No | The key is restricted by IP address; the message names the address we saw. Nothing is charged. |
| 403 | key_config_error | No | The key's configuration does not allow this model; check its settings in the console. |
| 404 | model_not_found | No | Unknown model id. |
| 422 | content_policy_violation | No | The prompt or the output was blocked by content moderation. |
| 422 | unknown_input | No | An input key the model does not declare; details has {field, suggestion?}. The suggestion is a hint, never applied. Nothing is charged. |
| 422 | mention_unresolved | No | An @ mention points to an image that is not attached. Nothing is charged. |
| 429 | rate_limited | Yes | Slow down; honour Retry-After. |
| 500 | server_error | Yes | Unexpected; retry with the same Idempotency-Key. |
| 502 | upstream_error | Yes | The model failed to produce a result. |
| 503 | channel_unavailable | Yes | The model is temporarily unavailable; retry later. |
| 504 | timeout | Yes | The task took too long. |
Endpoints
Each key carries scopes. A request outside the key's scopes is rejected with 403 and is never charged.
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /v1/media/models | any | Models with params and price ranges (full list, no cursor) |
| POST | /v1/media/generate | generate | Submit a task; 202 with task_id. Supports Idempotency-Key and notify_url |
| GET | /v1/media/tasks/{id} | read | Task state, outputs, credits |
| POST | /v1/media/tasks/{id}/cancel | generate | Cancel; cancellation is cancelled, requested or not_cancellable |
| GET | /v1/media/notify-secret | read | Signing secret for notify_url callbacks |
| GET | /v1/models/{id}/pricing | any | Price range, unit and per-option prices |
| GET | /v1/models | any | Published models, modes, input schemas, "from" prices |
| GET | /v1/models/{id} | any | One model (old ids resolve while their alias is live) |
| POST | /v1/quotes | generate | Validate inputs and get the exact price (quote valid 15 minutes) |
| POST | /v1/generations | generate | Submit; 202 with a status URL. Supports Idempotency-Key |
| GET | /v1/generations/{id} | read | Status, timestamps, charge state, safe error |
| GET | /v1/generations/{id}/result | read | Platform media URLs (valid until url_expires_at; the same URLs every time) |
| POST | /v1/generations/{id}/cancel | generate | Cancel: cancelled (immediate while queued), requested (may still finish and be charged) or not_cancellable |
| GET | /v1/wallet | read | Available and reserved credits, key budget |
| GET | /v1/balance | read | Wallet plus expiring credits (expiring[], next_expiry) |
| GET | /v1/usage | read | Credit history, cursor-paginated |
| POST | /v1/assets/uploads | assets | Allocate an upload for your library |
| POST | /v1/assets/{id}/complete | assets | Verify and finalize an upload |
| GET | /v1/assets | assets | Your asset library |
| POST | /v1/redeem | redeem | Redeem a voucher code (throttled) |
Idempotency and retries
Send Idempotency-Key (1-200 characters of A-Za-z0-9._:-) on POST /v1/media/generate and POST /v1/generations. Within 24 hours, repeating the request with the same key and body returns the original generation (header Idempotent-Replayed: true) and never charges twice; the same key with a different body returns 409 IDEMPOTENCY_CONFLICT, and a retry while the first request is still being processed returns 409 IDEMPOTENCY_IN_PROGRESS with Retry-After. Keys are scoped to your account (not to one API key), so a retry sent after rotating the key still replays.
Limits and retention
- 60 requests per minute per key by default (adjustable per key) and 120 per minute per account. Successful responses and 429s carry
X-RateLimit-Limit,X-RateLimit-RemainingandX-RateLimit-Reset(unix seconds); 429 also hasRetry-After. - Lists (
/v1/media/models,/v1/keys) return everything with no cursor;/v1/usageand/v1/assetsusecursor/next_cursor. - Concurrent generations per account are shared between the studio and the API.
- Redeem: 10 attempts per hour per account. Request bodies: 256 KiB.
- Files you upload are kept for 30 days. Generated files are kept for 1 day (24 hours) from completion, and their links work until
url_expires_at; download them in time. - Credits are valid for 30 days from when they are added, and the ones that expire first are spent first.
GET /v1/balancereturnsexpiring[]andnext_expiry. - Webhook delivery history is kept 30 days.
Key management
A management key (create one in the API console) can list, create, update and delete the keys of its own account with /v1/keys, and is accepted nowhere else. A key can never be given more than the key creating it has: scopes, models, budget, rate limit, IP range and expiry are all capped. A normal key with "allow changes via API" can read and tune only itself.
There is no rotate call. To rotate without downtime, POST /v1/keys for a new key, deploy it, then DELETE /v1/keys/{id} the old one. Single-key rotation in the console stops the old key at once.
Endpoint reference
Errors
Errors always look like {"error":{"code":"…","message":"…","request_id":"req_…"}} and every response has an X-Request-Id header. Codes are stable; messages are for humans.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | INVALID_JSONINVALID_REQUEST | Malformed request: body not a JSON object, missing or mistyped top-level field, bad query parameter or cursor, malformed Idempotency-Key. |
| 401 | UNAUTHENTICATED | Missing, wrong, revoked or expired key. |
| 402 | INSUFFICIENT_CREDITSKEY_BUDGET_EXCEEDEDSPEND_CAP_REACHED | Wallet, key budget or the account's daily spending limit too low: add credits with a redeem code, raise the key's budget, or raise the limit in account settings. |
| 403 | INSUFFICIENT_SCOPEMODEL_NOT_ALLOWEDBANNEDACCOUNT_SUSPENDEDGENERATION_SUSPENDEDCREDITS_ROLE_REQUIREDEMAIL_NOT_VERIFIEDEMAIL_VERIFICATION_UNAVAILABLE | Not permitted. |
| 404 | MODEL_NOT_FOUNDGENERATION_NOT_FOUNDASSET_NOT_FOUNDQUOTE_NOT_FOUNDOUTPUT_DELETED | Unknown id (other accounts' ids are reported the same way). A model that has been retired or disabled is reported the same way (MODEL_NOT_FOUND). |
| 409 | IDEMPOTENCY_CONFLICTIDEMPOTENCY_IN_PROGRESSRESULT_NOT_READYQUOTE_USEDQUOTE_EXPIREDQUOTE_MISMATCHASSET_NOT_READY | State conflict (IDEMPOTENCY_IN_PROGRESS carries Retry-After). |
| 410 | ASSET_EXPIREDOUTPUT_EXPIRED | The referenced asset has expired, or the output expired (generated files are kept 1 day). |
| 413 | PAYLOAD_TOO_LARGEFILE_TOO_LARGE | Body over 256 KiB, or upload over the size limit. |
| 415 | UNSUPPORTED_MEDIA_TYPEUNSUPPORTED_TYPE | Request body is not application/json, or upload type not accepted. |
| 422 | INVALID_INPUTUNKNOWN_INPUTMENTION_UNRESOLVEDMENTION_UNSUPPORTEDCONTENT_BLOCKEDINVALID_AMOUNTPRICE_UNAVAILABLE | Inputs rejected by the model's schema (see error.details.errors), an input key the model does not declare (UNKNOWN_INPUT, error.details {field, suggestion}; nothing is charged), an @ mention that points to no attached image (MENTION_UNRESOLVED), content blocked, or no price for these inputs. A mention the model mode cannot take (@video or @audio on a mode without such files) is rejected with MENTION_UNSUPPORTED. This also covers keys inside object-type inputs: an undeclared child is rejected as field.child instead of being dropped. |
| 429 | RATE_LIMITEDCONCURRENCY_LIMIT | Slow down; honour Retry-After. |
| 503 | MODEL_UNAVAILABLEMODEL_AT_CAPACITYCAPACITY_EXCEEDEDMAINTENANCENOT_PRICEDMODERATION_UNAVAILABLESTORAGE_UNAVAILABLEUPLOADS_UNAVAILABLEREDEEM_UNAVAILABLE | Try again later; every 503 carries Retry-After. |
| 500 | INTERNAL | Unexpected; safe to retry with the same Idempotency-Key. |
MODEL_AT_CAPACITY means the model's daily capacity is used up; CAPACITY_EXCEEDED means the model or the service is busy right now. A content refusal is content_policy_violation (media API, 422) or CONTENT_BLOCKED (generations API, 422); it is never charged. For 429 and 503 limit errors details is {"retryAfterSeconds": n}.
Webhooks
These are the account webhooks you add in the API console; the per-request notify_url of /v1/media/generate is separate (event media.task, secret from GET /v1/media/notify-secret, retries after 10, 30 and 60 seconds, same headers and signature). We POST generation.succeeded, generation.failed and generation.cancelled events with headers JenVid-Signature (v1=hex HMAC-SHA256 of timestamp + "." + raw body with your signing secret), JenVid-Timestamp, JenVid-Event-Id and JenVid-Event-Type. Reply 2xx within 10 seconds. Failed deliveries are retried after about 1 minute, 5 minutes, 30 minutes, 2, 6, 12 and 24 hours; redirects are not followed. Reject timestamps older than 5 minutes and skip event ids you already processed.
import crypto from 'node:crypto';
// Express example: use the RAW body, not re-serialized JSON.
app.post('/jenvid/webhooks', express.raw({ type: 'application/json' }), (req, res) => {
const ts = req.header('JenVid-Timestamp');
const sig = req.header('JenVid-Signature') ?? '';
if (!ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return res.sendStatus(400); // replay window
const expected = crypto.createHmac('sha256', process.env.JENVID_WEBHOOK_SECRET)
.update(`${ts}.${req.body.toString('utf8')}`).digest('hex');
const ok = sig.split(',').map((s) => s.trim()).some((s) =>
s.startsWith('v1=') && s.length === expected.length + 3 &&
crypto.timingSafeEqual(Buffer.from(s.slice(3)), Buffer.from(expected)));
if (!ok) return res.sendStatus(400);
const event = JSON.parse(req.body.toString('utf8'));
if (alreadyProcessed(event.id)) return res.sendStatus(200); // de-duplicate retries
handle(event); // generation.succeeded | generation.failed | generation.cancelled
res.sendStatus(200);
});Quick start
export JENVID_API_KEY="gj_live_xxxxxxxx_..."
# 1. Price it
curl -s https://jenvid.com/v1/quotes \
-H "Authorization: Bearer $JENVID_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-image-2.6-flare-2k","inputs":{"prompt":"a lighthouse at dusk"}}'
# 2. Submit (safe to retry with the same Idempotency-Key)
curl -s -i https://jenvid.com/v1/generations \
-H "Authorization: Bearer $JENVID_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1234" \
-d '{"model":"gpt-image-2.6-flare-2k","inputs":{"prompt":"a lighthouse at dusk"},"quote_id":"<id from step 1>"}'
# 3. Poll, then fetch the result
curl -s https://jenvid.com/v1/generations/<id> -H "Authorization: Bearer $JENVID_API_KEY"
curl -s https://jenvid.com/v1/generations/<id>/result -H "Authorization: Bearer $JENVID_API_KEY"// POST /v1/quotes -> 200
{ "id": "<quote id>", "amount": "0.120000" }
// POST /v1/generations -> 202 (Retry-After header tells you when to poll)
{
"id": "<generation id>",
"status": "queued",
"links": { "self": "https://jenvid.com/v1/generations/<id>", "result": "https://jenvid.com/v1/generations/<id>/result" }
}
// GET /v1/generations/<id>/result -> 200 (same URLs on every call; they work until url_expires_at)
{ "outputs": [{ "type": "image", "url": "https://...",
"url_expires_at": "2026-11-03T19:01:47.000Z", "file_expires_at": "2026-11-03T19:01:47.000Z" }] }
// Any error -> 4xx/5xx
{ "error": { "code": "...", "message": "...", "request_id": "req_..." } }Media inputs accept URLs of your own uploads or {"asset_id": "<uuid>"} references to ready assets in your library (upload with POST /v1/assets/uploads, then /complete). In the upload answer, upload.auth is same_as_request (send your Authorization: Bearer key with the PUT) or none (pre-signed URL: send no Authorization header). Video models also take duration, resolution, aspect_ratio and reference_images / reference_videos / reference_audios in params; see the quick start.
Statuses and charges
queued: accepted and waiting for capacity. Credits are reserved.running: the model is working on it.finalizing: output is being stored and the charge settled.reconciling: we are confirming the outcome after an interrupted hand-off; it is never submitted twice.succeeded(charge captured),failedorcancelled(reservation released) are final.
Amounts are exact decimal strings in credits with six decimals. Example: a model priced at 0.03 credits per image costs "0.120000" for 4 images. When several outputs are requested, only delivered outputs are charged.
Versioning
Within /v1 we only add fields, endpoints, error codes and enum values, so ignore unknown fields. Every response carries a JenVid-Api-Version header (a date) with the behaviour revision. Breaking changes ship as a new version with at least 6 months of overlap. Renamed model ids keep working for at least 180 days.