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

# Get an APIMart-compatible task



## OpenAPI

````yaml /openapi/gateway-openapi.json get /apimart/v1/tasks/{id}
openapi: 3.1.0
info:
  title: YIR Async AI Gateway
  version: 1.0.0-stage3a2
  description: >-
    Source-compatible asynchronous image generation routes certified by YIR.
    Authenticate every request with a YIR API key. Provider credentials are
    managed by YIR and must never be sent by clients.
servers:
  - url: https://gateway.yir.ai
    description: YIR production Gateway
security:
  - BearerAuth: []
tags:
  - name: KIE GPT Image 2
  - name: APIMart GPT Image 2
paths:
  /apimart/v1/tasks/{id}:
    get:
      tags:
        - APIMart GPT Image 2
      summary: Get an APIMart-compatible task
      operationId: getAPIMartGPTImage2Task
      parameters:
        - name: id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PositiveTaskID'
      responses:
        '200':
          description: Current task state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIMartTaskResponse'
        default:
          $ref: '#/components/responses/APIMartError'
      security:
        - BearerAuth: []
components:
  schemas:
    PositiveTaskID:
      type: string
      pattern: ^[1-9][0-9]*$
      description: Positive decimal YIR task ID
    APIMartTaskResponse:
      type: object
      additionalProperties: false
      required:
        - code
        - data
      properties:
        code:
          type: integer
          const: 200
        data:
          $ref: '#/components/schemas/APIMartTaskData'
    APIMartTaskData:
      type: object
      additionalProperties: false
      required:
        - id
        - status
        - progress
      properties:
        id:
          $ref: '#/components/schemas/PositiveTaskID'
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
        progress:
          type: integer
          minimum: 0
          maximum: 100
        result:
          type: object
          additionalProperties: false
          required:
            - images
          properties:
            images:
              type: array
              items:
                type: object
                additionalProperties: false
                required:
                  - url
                properties:
                  url:
                    type: array
                    items:
                      type: string
                      format: uri
        cost:
          type: number
        credits_cost:
          type: number
        error:
          type: object
          additionalProperties: false
          properties:
            code:
              type: string
            message:
              type: string
    APIMartErrorResponse:
      type: object
      additionalProperties: false
      required:
        - code
        - error
      properties:
        code:
          type: integer
          description: HTTP status code
        error:
          type: object
          additionalProperties: false
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable YIR or admission reason code
            message:
              type: string
              description: Safe public error message
  responses:
    APIMartError:
      description: APIMart-compatible safe error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/APIMartErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: YIR_API_KEY
      description: >-
        Use Authorization: Bearer <YIR_API_KEY>. Upstream provider keys are not
        accepted.

````