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

# Detail Preservation

> Repairs incorrect details in AI-generated images

## Request body

`multipart/form-data`

* `source_image` (`file`, required): Source image, max `30MB`
* `reference_images` (`file | file[]`, required): One or more reference images, each max `30MB`

## Validation rules

* `reference_images` accepts either:
  * a single image
  * an array of images
* Input is normalized to an array internally
* At least one reference image is required:
  * `"reference_images must contain at least 1 image"`


## OpenAPI

````yaml POST /v2/image-utils/detail-preservation
openapi: 3.1.0
info:
  title: TokenKit
  description: >-
    Building image agents and tools, with APIs for businesses that want to put
    them to work.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tokenkit.co
security:
  - bearerAuth: []
paths:
  /v2/image-utils/detail-preservation:
    post:
      description: Preserve source image details using one or more reference images.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DetailPreservationRequest'
      responses:
        '202':
          description: Job accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAccepted'
        '400':
          description: Validation error
        '429':
          description: Queue saturated
components:
  schemas:
    DetailPreservationRequest:
      type: object
      properties:
        source_image:
          $ref: '#/components/schemas/FileOrUrl'
        reference_images:
          oneOf:
            - $ref: '#/components/schemas/FileOrUrl'
            - type: array
              items:
                $ref: '#/components/schemas/FileOrUrl'
              minItems: 1
      required:
        - source_image
        - reference_images
    JobAccepted:
      type: object
      properties:
        data:
          type: object
          properties:
            job_id:
              type: string
              example: job_123
            links:
              $ref: '#/components/schemas/JobLinks'
          required:
            - job_id
            - links
        errors:
          nullable: true
      required:
        - data
    FileOrUrl:
      oneOf:
        - type: string
          format: binary
        - type: string
          format: uri
    JobLinks:
      type: object
      properties:
        self:
          type: string
          example: /v1/jobs/job_123
        stream:
          type: string
          example: /v1/jobs/job_123/stream
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````