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

# Quickstart

> Create and poll your first APIPod image task.

This quickstart creates a GPT Image 2 task, captures its APIPod task ID, and polls the result endpoint.

<Steps>
  <Step title="Create an API key">
    Sign in to the [APIPod Console](https://www.apipod.ai/console/api-keys), create an API key, and copy it when it is displayed.
  </Step>

  <Step title="Set local environment variables">
    ```bash theme={null}
    export APIPOD_API_KEY="your-api-key"
    export APIPOD_IDEMPOTENCY_KEY="image-$(date +%s)"
    ```

    Use a stable, unique idempotency key for one logical create operation. If a network failure makes the result ambiguous, retry with the same key and unchanged JSON body.
  </Step>

  <Step title="Create an image task">
    ```bash theme={null}
    curl https://api.apipod.ai/v1/images/generations \
      -H "Authorization: Bearer $APIPOD_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $APIPOD_IDEMPOTENCY_KEY" \
      -d '{
        "model": "gpt-image-2",
        "prompt": "A clean product photograph of a translucent glass speaker, soft studio lighting",
        "aspect_ratio": "1:1",
        "resolution": "1K"
      }'
    ```

    A successful create response has this envelope:

    ```json theme={null}
    {
      "code": 200,
      "message": "success",
      "data": {
        "task_id": "img_example_task_id"
      }
    }
    ```
  </Step>

  <Step title="Poll the task">
    ```bash theme={null}
    export APIPOD_TASK_ID="img_example_task_id"

    curl "https://api.apipod.ai/v1/images/status/$APIPOD_TASK_ID" \
      -H "Authorization: Bearer $APIPOD_API_KEY"
    ```

    Continue polling while the status is `pending` or `processing`. Stop when it becomes `completed`, `failed`, or `cancelled`.
  </Step>
</Steps>

## Completed response

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "img_example_task_id",
    "status": "completed",
    "result": [
      "https://example.com/generated-image.png"
    ],
    "completed_at": 1786358400
  }
}
```

<Warning>
  HTTP `200` from the create endpoint means the task was accepted. It does not mean the image or video has finished generating.
</Warning>

<CardGroup cols={2}>
  <Card title="GPT Image 2 parameters" icon="image" href="/gpt-image-2/gpt-image-2">
    Review every supported field and all five language examples.
  </Card>

  <Card title="Task lifecycle" icon="clock-3" href="/asynchronous-tasks">
    Add production polling, webhooks, and terminal-state handling.
  </Card>
</CardGroup>
