For AI agents: this page is also available as Markdown at https://docs.refabric.com/api-reference/platform/jobs/read-a-job.md, and the index of every page is https://docs.refabric.com/llms.txt.
Platform API › Jobs
Read a job
Where one job is: lifecycle, outcome (null until it ends), progress, and the error of a job that failed — cheap enough to poll.
https://api.refabric.com/v1/jobs/{job_id}import os
import requests
url = "https://api.refabric.com/v1/jobs/{job_id}"
headers = {"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}"}
response = requests.get(url, headers=headers)
print(response.json()){
"job_id": "9b2f4c1d0e8a",
"task": "image.expand",
"lifecycle": "running",
"outcome": null,
"progress": {
"done": 0,
"phase": "",
"total": 1
},
"metrics": {
"queued_at": "2026-10-05T09:30:00Z"
},
"error": null,
"api_key_id": "key_8f3a",
"charge": {
"credit_type": "refabric_credits",
"credits": 12,
"state": "charged"
},
"events": [
{
"at": "2026-10-05T09:30:00Z",
"message": "Accepted.",
"phase": "queued"
}
],
"input": {
"body": {
"prompt": "A linen summer dress"
},
"truncated": false
}
}Expansions
input— the request body that started the job, as you sent it (masked, cut at the kept size). Requests are kept 30 days; after that, and for a job started in the app,inputisnull.
Authentication. A key with jobs:read: a job and its files are your account's.
Common use cases
- Poll a job until it ends, then read its result.
- See which key started a job and what it sent.
See also
GET /v1/jobs/{job_id}/resultPUT /v1/jobs/{job_id}/cancel
Authorization
Authorization: Key $REFABRIC_API_KEYScope: jobs:read
Parameters
Path parameters
- stringrequired
Query parameters
- booleanoptionalDefault:
false1: addevents[]— the job's log{at, phase, message, file?, field?}. - array<string>optionalnullable
input: addinput— the request body that started the job, as you sent it (masked, and cut at the kept size, which the answer says).nullwhen the job was started in the app or its request is no longer kept.
Header parameters
- stringoptional
The contract version you wrote against (a date). Absent: the current version.
format: date
- stringoptional
Your own id for this request; we answer it back under X-Client-Request-ID.
max length 128
Response
200 — Done: the answer is in the body.
- stringrequired
The job.
Example:
9b2f4c1d0e8a - stringrequired
The task the job runs.
Example:
image.expand - stringrequired
Where the job is.
Values
queued— Accepted and waiting to start.running— Being made.terminal— Ended.outcomesays how.
Example:
running - stringrequirednullable
How the job ended —
nulluntil itslifecycleisterminal.Values
succeeded— It finished; its files are ready.failed— It ended without its result;errorsays why.cancelled— You cancelled it.
- objectrequired
How far the job got.
Example:
{"done":0,"phase":"","total":1}- integerrequired
Files delivered so far.
Example:
2 - integerrequirednullable
Files the job plans to deliver;
nulluntil it is known.Example:
4 - stringrequired
What the job is doing now; may be empty.
Example:
- objectrequired
When it was queued and started, and how long it ran.
Example:
{"queued_at":"2026-10-05T09:30:00Z"}- stringrequirednullable
When it was accepted, ISO-8601 in UTC.
Example:
2026-10-05T09:30:00Z - stringrequirednullable
When it started;
nullwhile it is queued.Example:
2026-10-05T09:30:02Z - integerrequirednullable
How long it ran, once it has ended;
nullbefore.Example:
21000
- objectrequirednullable
Why it failed or that it was cancelled, in the shape of every error;
nullotherwise.- stringrequired
The catalogued code.
- stringrequired
What kind of failure.
Values
invalid_request— The request cannot be used as sent; fix it and send again.authentication— No valid API key was sent.permission— Your key or your plan does not allow this.not_found— Nothing of yours has this address, or it was removed.conflict— The request conflicts with the current state of what it names.insufficient_credits— Your balance does not cover this request.rate_limited— Too many requests; wait and retry.content_refused— The inputs were refused.processing_failed— The job ran and failed.internal— Something went wrong on our side.warning— Not an error: a note on a job that succeeded.
- stringrequired
What happened, in words.
- booleanrequired
Whether the same request may succeed later.
- stringoptional
The request field it is about, when one is.
- stringoptional
The code's page; absent while the docs have no address.
- stringoptional
The request's id, to quote to support.
- objectoptional
Facts about this error, by the keys its code declares (
GET /v1/errors); absent when there are none. Ignore a key you do not know.- integeroptional
The credits this request needs.
- integeroptional
The credits your balance holds now.
- integeroptional
Seconds to wait before the next call.
- anyoptional
What you sent for
field, shortened; absent when it is not echoed (a file, an object or a secret never is). - stringoptional
The job that failed, when a run waited for it (
Prefer: wait) and it ended in this error. Read it again atGET /v1/jobs/{job_id}; absent on every other error. - integeroptionaldeprecated
Deprecated: read
ctx.required(same value). - integeroptionaldeprecated
Deprecated: read
ctx.balance(same value).
- stringrequirednullable
The key that started it;
nullfor work started in the Refabric app.Example:
key_8f3a - objectrequirednullable
What it costs and whether that is final;
nullfor a job that costs nothing.Example:
{"credit_type":"refabric_credits","credits":12,"state":"charged"}- integerrequired
The credits: the most the job can take while
reserved, what it took oncecharged,0oncerefunded.Example:
12 - stringrequirednullable
Which kind of credit an amount is counted in.
Values
refabric_credits— Spent by tasks.model_credits— Credits for model training.
Example:
refabric_credits - stringrequired
Whether the amount a job costs is held or final.
Values
reserved— Held while the job runs:creditsis the most it can cost. It settles tochargedorrefundedonce the job has ended.charged— Final:creditsis what the job cost.refunded— Final: the hold was returned; the job cost nothing.
Example:
charged
- array<object>optionalnullable
With
logs=1: the job's log, oldest first.Example:
[{"at":"2026-10-05T09:30:00Z","message":"Accepted.","phase":"queued"}]- stringrequirednullable
When it happened, ISO-8601 in UTC.
Example:
2026-10-05T09:30:02Z - stringrequired
What happened.
Values
queued— The job was accepted and queued.running— The job started.delivered— The job delivered a file;filenames it.warning— A note on what was not made;fieldnames the input.succeeded— The job finished.failed— The job failed; the message is its error's.cancelled— The job was cancelled.
Example:
running - stringrequired
What happened, in words.
Example:
Started. - stringoptionalnullable
The file delivered (
delivered).Example:
art:3f2a - stringoptionalnullable
The input it is about, when one is.
Example:
poses[1]
- objectoptionalnullable
With
expand=input: the request that started the job;nullwhen it was started in the app or its request is no longer kept.Example:
{"body":{"prompt":"A linen summer dress"},"truncated":false}- object | string | nullrequired
The request body you sent to start the job, masked: an object when it is JSON, its text when it was cut.
Example:
{"prompt":"A linen summer dress"} - booleanrequired
Whether the body was cut at the kept size.
Example:
false
- 400 — The request cannot be read as it was sent (a header, the URL or the body's form).
- 401 — No valid API key was sent.
- 403 — Your key or your plan does not allow this.
- 404 — Nothing has this address.
- 422 — A field is missing or has a value this operation cannot use.
- 429 — Too many requests: wait for the number of seconds in the Retry-After header.
- 500 — Something went wrong on our side; retry, and quote the request id if it keeps happening.