> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trycarhub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit and retrieve jobs

> Submit work safely and retrieve asynchronous inference results.

Every inference submission creates a job. This uniform contract lets you handle fast image reads and long-running generation work in the same way.

```text theme={null}
queued → processing → succeeded
                    ↘ failed | expired | canceled
```

`succeeded`, `failed`, `expired` and `canceled` are terminal statuses.

## Submit work

Send `POST` to a model endpoint with an API key. CarHub reserves the worst-case credit price, creates the job and queues it atomically. A `202` response includes a job and a `Location` header pointing to it.

Add `?wait=true` on fast endpoints when you prefer an inline result. CarHub waits for at most 30 seconds. If work is still pending, it returns `202` and the job continues. Video, 360 and bundle endpoints reject `wait=true` with `400 wait_not_supported`.

## Poll a job

```bash theme={null}
curl -sS "$CARHUB_API_URL/v1/jobs/$JOB_ID" \
  -H "Authorization: Bearer $CARHUB_API_KEY"
```

Poll with exponential backoff. Stop when the job reaches a terminal status. On success, consume `result`; on failure, inspect `error.type`, `error.code` and `error.message` rather than parsing human-readable text. For an event-driven integration, use [webhooks](/guides/webhooks) instead.

## Make retries safe

Pass a unique `Idempotency-Key` for each logical submission. Replaying the same key and payload returns the stored original response with `Idempotent-Replayed: true`. Reusing it for a different payload returns `409 idempotency_key_reuse`.

Use the same key for transport retries. Generate a new key only when you deliberately create new work.

## Credits and settlement

At admission, CarHub reserves credits for the job. One credit equals one USD cent, so `20` credits represent `$0.20`. After processing, CarHub releases the reservation and charges actual use. A failed model job releases its reservation. If the credit balance cannot cover admission, you receive `402 insufficient_credits` and no job is created.

For endpoint-specific input and output fields, use the generated [API reference](/api-reference/overview).
