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

# Quickstart

> Submit and poll your first image generation.

<Steps>
  <Step title="Create an API key">
    Sign in to Porn Factory AI and open the
    [Developer tab](https://pornfactoryai.com/account?tab=developer). Create a
    key and save both one-time values: the `pfai_` API key and the `whsec_`
    webhook secret.
  </Step>

  <Step title="Find a checkpoint">
    Query the catalog for a generator-ready checkpoint.

    ```bash theme={"system"}
    curl --request GET \
      --url 'https://pornfactoryai.com/api/v1/models?mode=text_to_image&type=checkpoint&limit=20' \
      --header 'Authorization: Bearer pfai_YOUR_KEY'
    ```

    Save the `model_id` and `version_id` from one result.
  </Step>

  <Step title="Submit a generation">
    Use a unique idempotency key for this logical request.

    ```bash theme={"system"}
    curl --request POST \
      --url 'https://pornfactoryai.com/api/v1/generations' \
      --header 'Authorization: Bearer pfai_YOUR_KEY' \
      --header 'Content-Type: application/json' \
      --header 'Idempotency-Key: tutorial-image-001' \
      --data '{
        "mode": "text_to_image",
        "prompt": "A cinematic portrait with warm window light",
        "seed_mode": "random",
        "checkpoint": {
          "model_id": "mdl_YOUR_MODEL",
          "version_id": "ver_YOUR_VERSION"
        },
        "loras": []
      }'
    ```
  </Step>

  <Step title="Poll the request">
    The submit response includes a stable `request_id` and `poll_url`. Poll
    until the status is `COMPLETED` or `FAILED`.

    ```bash theme={"system"}
    curl --request GET \
      --url 'https://pornfactoryai.com/api/v1/requests/req_YOUR_REQUEST' \
      --header 'Authorization: Bearer pfai_YOUR_KEY'
    ```
  </Step>
</Steps>

<Tip>
  Retry a timed-out submit with the same `Idempotency-Key` and the exact same
  body. The API returns the original request instead of charging twice.
</Tip>
