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

# Get Image

> Retrieve an existing image by id using the same account’s API key. Useful for legacy image integrations that return a pending record. The query parameter is imageId (camelCase). The response is a single object; read image_url at the top level.

Use this endpoint when Generate Image returns an image record whose `image_url` is empty, or to retrieve an existing image. Pass its `id` as the camelCase query parameter `imageId`.

```bash theme={null}
curl --fail-with-body 'https://easy-peasy.ai/api/get-image?imageId=12345' \
  -H 'x-api-key: YOUR_API_KEY'
```

The response is a single object. Read `image_url` at the top level. Use the same account's API key that created the image.

For pending images, poll every 15–30 seconds with a bounded timeout. Stop on HTTP errors and retain the ID on timeout. This endpoint has no normalized job status field, so an empty URL alone cannot distinguish processing from a failed generation. Do not automatically submit another paid generation when polling stops.


## OpenAPI

````yaml GET /api/get-image
openapi: 3.0.1
info:
  title: Easy-Peasy.AI API
  description: >-
    API for Easy-Peasy.AI text, image, video, audio, and chat features.
    Authenticate with an API key from https://easy-peasy.ai/settings/api.
    Individual endpoints document public access and alternative authentication
    methods.
  version: 1.0.5
servers:
  - url: https://easy-peasy.ai
security:
  - apiKeyAuth: []
paths:
  /api/get-image:
    get:
      summary: Get Image
      description: >-
        Retrieve an existing image by id using the same account’s API key.
        Useful for legacy image integrations that return a pending record. The
        query parameter is imageId (camelCase). The response is a single object;
        read image_url at the top level.
      operationId: getImage
      parameters:
        - name: imageId
          in: query
          required: true
          schema:
            type: integer
          description: The id from a Generate Image response.
          example: 12345
      responses:
        '200':
          description: Image record
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetImageResponse'
              example:
                id: 12345
                image_url: https://yourcdn.com/generated-image.png
                model: Midjourney V7
                prompt: A cat in a garden
                used_credits: 2
        '400':
          description: Missing or invalid imageId.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or missing API key, or blocked account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Image missing or not accessible to this account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Could not retrieve image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    GetImageResponse:
      type: object
      description: >-
        Image record returned directly, without an image wrapper. Additional
        record fields may be present.
      properties:
        id:
          type: integer
        image_url:
          type: string
          nullable: true
          description: Image URL when ready; empty or null while pending.
        model:
          type: string
        prompt:
          type: string
        used_credits:
          type: number
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          oneOf:
            - type: string
            - type: object
              properties:
                message:
                  type: string
                status:
                  type: integer
          description: >-
            Error text, or an object with message and optional status for some
            provider integrations.
          example: Invalid API key
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get yours at
        https://easy-peasy.ai/settings/api

````