Jobs
A job runs one model on one input. You create it, wait for it (a webhook or polling), and download its outputs.
Create a job
POST to the task's endpoint (table below) with exactly one input: file (a ready file's id), input_url (we fetch it) or, as multipart/form-data, the audio, image or video itself in file (up to 50 MB). Optionally add model (default: the task's default model), webhook_url and end_user. It answers 202 Accepted with the Job object and a Location: /v1/jobs/{id} header. Send an Idempotency-Key so a retry never creates a second job. The key needs jobs:write; with input_url or a multipart file it also needs files:write, because the input becomes a File (403 insufficient_scope otherwise).
| Endpoint | Task | Default model | Outputs |
|---|---|---|---|
| POST /v1/audio/denoise | audio.denoise | Noise Removal 4.1, zilapi/nr-4.1 | audio |
| POST /v1/audio/separate | audio.separate | Vocal Separation 2.5, zilapi/vms-2.5 | vocals, instrumental |
| POST /v1/audio/enhance | audio.enhance | Speech Enhancement 1.0, zilapi/se-1.0 | audio |
| POST /v1/audio/remove-fillers | audio.remove_fillers | Filler Removal 1.0, zilapi/filler-1.0 | audio, fillers |
| POST /v1/image/remove-background | image.remove_background | Background Removal 1.0, zilapi/bgr-1.0 | image, mask |
| POST /v1/video/remove-background | video.remove_background | Background Removal (Video) 1.0, zilapi/bgr-video-1.0 | mask |
With a ready file and a live key we hold the job's exact cost from your credit at once; if your available credit is lower, you get 402 insufficient_credit and nothing starts. With input_url or an uploaded file the job starts in waiting_for_file and nothing is held until the file is ready; if the credit is short then, the job fails with insufficient_credit and nothing is charged. One exception for a slightly short balance: see Pricing & billing.
curl -s https://api.zilapi.com/v1/audio/denoise -H "Authorization: Bearer $ZILAPI_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"file": "'"$FILE_ID"'", "model": "zilapi/nr-4.1"}' \
> job.json
JOB_ID=$(jq -r .id job.json)The task pages show every input form for each task: Noise Removal, Vocal Separation and Speech Enhancement. Filler Removal also returns a fillers JSON report (result.fillers on the job, or ?name=fillers), and options: {"timestamps_only": true} returns only the report. Works best on single-speaker speech; with overlapping speakers short words can occasionally be cut.
Tag jobs with your own user id
If your app runs jobs for many people, send end_user with each job: your own id for the user, team or workspace the job is for. We store it on the job, return it on the Job object, and let you list one user's jobs with GET /v1/jobs?end_user=…. It does not change the price or the limits.
- 1 to 128 characters from
A-Z,a-z,0-9and. _ : @ -. Anything else is refused with422 invalid_request. - Works on all three task endpoints, as a JSON field or as a
multipart/form-datafield next to the file. - Send an opaque id (your database id) or a hash of it. Never send a raw email address, name or phone number: job data is kept for billing and support.
{
"input_url": "https://example.com/episode-42.wav",
"end_user": "u_8c1f2a9e"
}Lifecycle
waiting_for_file (URL and uploaded inputs only) → queued → processing → succeeded or failed. A job can be canceled while it is waiting for its file or queued. succeeded, failed and canceled are final. A job that ran on slightly short credit can end its run in payment_required (not final): it becomes succeeded once it is paid, or failed if it is not paid within 72 hours. See When a job waits for payment.
| Status | Meaning | Charged |
|---|---|---|
| waiting_for_file | The input is still uploading, being fetched or checked. input.duration_seconds is null. A rejected input fails the job with the file's error.code (such as invalid_audio, invalid_image or fetch_failed; see Files). | Nothing held yet |
| queued | Waiting for a GPU. The cost is held from your credit. | Held |
| processing | Running. progress goes from 0 to 1. | Held |
| succeeded | Done. output describes the MP3; download it with /output. | Yes, the held amount |
| failed | Did not finish. error.code and error.message say why. | No, the hold is released |
| canceled | Canceled while waiting for its file or queued. | No, the hold is released |
| payment_required | The run finished on slightly short credit and its price is not covered yet. The output is locked; payment says what is due. Not final. | When paid; never if it expires |
Test-key jobs complete almost at once with a sample MP3 and cost nothing. Every job finishes within 24 hours; one that cannot is failed and not charged.
Polling
Polling always works; webhooks can also tell your server when a job finishes. Processing takes a fraction of the audio's length, so poll gently:
- Wait 2 seconds before the first poll, then multiply the wait by 1.5 after each poll, up to 30 seconds.
- Add a little random jitter, so many jobs started together do not poll in lockstep.
- Stop as soon as the status is
succeeded,failedorcanceled; keep going throughwaiting_for_file,queuedandprocessing. Onpayment_required, stop too: the job waits for a top-up (see below). - On
429, waitRetry-Afterseconds. Reads allow 1,200 requests per minute per key, shared by all your pollers. - To follow many jobs, list them (
GET /v1/jobs?status=processing) instead of polling each one.
DELAY=2
while :; do
STATUS=$(curl -s https://api.zilapi.com/v1/jobs/$JOB_ID -H "Authorization: Bearer $ZILAPI_KEY" | jq -r .status)
case "$STATUS" in waiting_for_file|queued|processing) ;; *) break ;; esac
sleep "$DELAY"
DELAY=$(( DELAY * 3 / 2 > 30 ? 30 : DELAY * 3 / 2 ))
done
echo "$STATUS" # succeeded, failed or canceledCancel
POST /v1/jobs/{id}/cancel cancels a job while it is waiting_for_file or queued: it becomes canceled, any hold on your credit is released and nothing is charged. Once a job is processing it cannot be canceled (409 job_not_cancelable); it is charged only if it succeeds. Canceling a job that is already canceled returns it unchanged.
curl -s -X POST https://api.zilapi.com/v1/jobs/$JOB_ID/cancel -H "Authorization: Bearer $ZILAPI_KEY" | jq '{status, cost}'Download the outputs
A succeeded job lists its outputs in output.files: audio for denoise and enhance, vocals and instrumental for separation, image and mask for background removal, mask for video background removal. GET /v1/jobs/{id}/output?name=<name> returns { url, expires_at, filename, name }: a signed download URL, valid for up to 1 hour; without name you get the first output. Ask for a fresh one whenever you need it. Before the job succeeds: 409 job_not_succeeded (402 payment_required while a job waits for payment). Results are deleted 7 days after the job succeeds, then 410 output_expired.
| Task | name | filename |
|---|---|---|
| Noise Removal | audio | <stem>-denoised.mp3 |
| Speech Enhancement | audio | <stem>-enhanced.mp3 |
| Vocal Separation | vocals | <stem>-vocals.mp3 |
| Vocal Separation | instrumental | <stem>-instrumental.mp3 |
| Background Removal | image | <stem>-cutout.png |
| Background Removal | mask | <stem>-mask.png |
| Background Removal (Video) | mask | <stem>-matte.mp4 |
curl -s https://api.zilapi.com/v1/jobs/$JOB_ID/output -H "Authorization: Bearer $ZILAPI_KEY" > output.json
curl -o "$(jq -r .filename output.json)" "$(jq -r .url output.json)"List jobs
GET /v1/jobs lists the jobs of the key's mode, newest first, across all tasks. Filter with status, model and end_user; page with limit (1 to 100, default 20) and cursor (the previous page's next_cursor; null on the last page).
curl -s "https://api.zilapi.com/v1/jobs?status=failed&limit=50" -H "Authorization: Bearer $ZILAPI_KEY" | jq '(.data[] | {id, error}), .next_cursor'When a job waits for payment
Once you have bought credit, one live job may run even if it costs up to $1.00 more than your available credit (see Pricing & billing for who qualifies). Nothing is held for it. If your credit covers its price by the time it finishes, it is charged and succeeds like any other job. If not, it finishes in the status payment_required:
- The output is locked:
outputandresultarenull,progressis1,cost.charged_microsisnullanderrorisnull. paymentsays what is due:amount_due_micros(the job's full price, not only the part your credit is short),display(the same, rounded to the cent) andexpires_at, 72 hours after the output was ready.paymentisnullin every other status.GET /v1/jobs/{id}/outputanswers402 payment_required; itsdetailnames the amount due.- The job cannot be canceled (
409 job_not_cancelable): the work is already done. It does not count towards your jobs-at-once limit. - Until it is paid or expires, its price counts against your credit (
available_microsinGET /v1/creditsdoes not subtract it): a new live job runs only if your available credit covers both prices. Otherwise it is refused with402 insufficient_credit, or, if it was waiting for its input, fails withinsufficient_credit; nothing is charged. GET /v1/jobs?status=payment_requiredlists the jobs waiting for payment.
{
"id": "job_9Tz4Kq7Wn2Bx",
"object": "job",
"task": "audio.denoise",
"model": "zilapi/nr-4.1",
"status": "payment_required",
"progress": 1.0,
"input": { "file": "file_8Pd2Rw5Lx7Qa", "duration_seconds": 1800.0 },
"output": null,
"result": null,
"cost": { "estimated_micros": 990000, "charged_micros": null, "display": "$0.99" },
"payment": {
"amount_due_micros": 990000,
"display": "$0.99",
"expires_at": "2026-11-15T10:31:12Z"
},
"error": null,
"mode": "live",
"created_at": "2026-11-12T10:30:00Z",
"started_at": "2026-11-12T10:30:02Z",
"finished_at": "2026-11-12T10:31:12Z"
}{
"type": "https://zilapi.com/errors/payment_required",
"title": "Payment required",
"status": 402,
"detail": "This job's output is locked until it is paid: $0.99 is due. Top up your credit, then request the output again.",
"code": "payment_required",
"request_id": "req_4Hk8Wd2Qm6Zs"
}To pay and unlock it, top up in the dashboard under Billing. There is no separate pay call: as soon as your available credit covers amount_due_micros, we charge the job and it becomes succeeded, with output filled in, cost.charged_micros set and payment back to null. Its output is then kept 7 days from that moment, like any result. A top-up pays it within seconds; credit freed another way (a hold released when another job fails or is canceled) is picked up within about a minute. GET /v1/jobs/{id}/output with an API key also tries to pay first, so asking for the output after a top-up just works.
If it is not paid by payment.expires_at, the output is deleted within about a minute and the job becomes failed with error.code payment_required; nothing is charged (cost.charged_micros is 0), and GET /v1/jobs/{id}/output answers 409 job_not_succeeded. To give the result up sooner, DELETE /v1/jobs/{id}/output does the same at once, while the job is still payment_required (if a top-up pays it during that call, you get 409 job_not_finished and the output stays; once a job is paid, DELETE deletes its output like any other). Either way, your account cannot run another job on short credit for 30 days; jobs your credit covers are not affected.
Webhooks: job.payment_required is sent when a job enters this status, but only to webhook endpoints that list it by name: endpoints subscribed to "*" and a job's own webhook_url do not get it. When the job is paid, job.succeeded follows; when it expires or you delete the output, job.failed. Those two go to every subscriber and to the job's webhook_url, as usual.
The Job object
{
"id": "job_7Hq2xV9mKp4R",
"object": "job",
"task": "audio.denoise",
"model": "zilapi/nr-4.1",
"status": "succeeded",
"progress": 1.0,
"input": { "file": "file_3Lm8QpZ2rT6w", "duration_seconds": 191.4 },
"output": {
"format": "mp3",
"bitrate_kbps": 320,
"size_bytes": 4608000,
"expires_at": "2026-10-13T14:02:31Z",
"files": [{ "name": "audio", "size_bytes": 4608000 }]
},
"cost": { "estimated_micros": 105270, "charged_micros": 105270, "display": "$0.11" },
"receipt": {
"unit": "audio_second",
"billable_ms": 191400,
"billable_units": 192,
"billable_seconds": 192,
"minimum_applied": false,
"unit_price_micros": 550,
"unit_price_micros_per_minute": 33000,
"unit_price_display": "$0.033 / audio min",
"pricing_version": 2,
"charged_micros": 105270,
"ledger_txn_id": "txn_5Rk2Vb8Lq1Zx"
},
"payment": null,
"error": null,
"mode": "live",
"end_user": "u_8c1f2a9e",
"created_at": "2026-10-06T14:02:07Z",
"started_at": "2026-10-06T14:02:09Z",
"finished_at": "2026-10-06T14:02:31Z"
}| Field | Meaning |
|---|---|
| status, progress | Where the job is; progress is 0 to 1. |
| task | The task, such as audio.denoise or image.remove_background (every task). |
| input | The file id and its measured duration_seconds (null while the job is waiting_for_file). |
| output | null until the job succeeds; then format, bitrate, when it is deleted (expires_at) and files, one { name, size_bytes } per output. Single-output jobs also keep the top-level size_bytes. |
| cost | estimated_micros (held), charged_micros (null until the job finishes or when it was canceled before it started, 0 for a failed job or a test key) and a rounded display string. |
| receipt | How the charge was worked out: see Pricing & billing. |
| payment | null, except while the job is payment_required: { amount_due_micros, display, expires_at }. See When a job waits for payment. |
| error | null, or { code, message } on a failed job. |
| mode | live or test, from the key that created the job. |
| end_user | Your own id for the user this job is for, as you sent it; null when you did not. See Tag jobs with your own user id. |