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

# Use and edit results

> Poll each job and pass completed image IDs into the next operation.

Creation returns `202` and one job per output. Save every job ID before polling `GET /v1/jobs/{id}`.

| Status                     | What to do                                             |
| -------------------------- | ------------------------------------------------------ |
| `pending`, `generating`    | Poll again with a bounded delay, such as five seconds. |
| `completed`                | Use `result.url`, `result.id`, and `result.type`.      |
| `failed`, `policy_blocked` | Stop polling and show `error.message`.                 |

`result` is null until there is a completed output. `error` is null unless processing failed or was blocked. Handle new error codes with a general failure message. A client timeout does not cancel processing; retain the ID and resume polling later.

## Credits used

Each job includes `credits_used` in **display credits**, the units shown in Studio. For example, `"credits_used": 1.5` means **1.5 credits**. Use this value directly; no unit conversion is needed.

For multiple outputs, each job reports its own charge. Sum the latest value from each distinct job to get the request total. Polling reflects completed refunds as `0`. Creation responses are snapshots; replaying an idempotent request returns that original snapshot, so poll for the latest value.

The legacy image API uses internal units for its `credits_used` field: **100 internal units = 1 display credit**. Keep that conversion limited to legacy responses; do not apply it to v1 job responses.

## Chain image operations

Take the `result.id` of a completed result whose `type` is `image` and place it directly in the next operation’s URL:

```bash theme={null}
curl "https://api.bitstudio.ai/v1/images/$RESULT_IMAGE_ID/edit" \
  -H "Authorization: Bearer $BITSTUDIO_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: white-background-001' \
  -d '{"prompt":"Change the background to white. Keep the person and outfit."}'
```

This creates one new job and preserves the source. Wait for the edit, then use its result ID for the next step. You do not need a version ID or a version-history endpoint.

IDs are opaque; do not rely on a job ID equalling a media ID. Use `result.id` when a completed output is required. The `image_id` response field remains as a compatibility alias. Video results cannot be passed to image-only operations.
