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

# Enhance

> Enhance a single image.

Enhancement parameters are inferred automatically. Optionally provide
a text prompt to guide the enhancement. Returns images or signed download URLs.



## OpenAPI

````yaml https://api.photalabs.com/v1/phota/openapi.json post /v1/phota/enhance
openapi: 3.1.0
info:
  title: Phota API
  description: Create and manage profiles for photo editing and enhancement.
  version: v0.5.0
servers:
  - url: https://api.photalabs.com
security: []
tags:
  - name: Studio
    description: Image editing, generation, and enhancement.
  - name: Profiles
    description: 'Profile lifecycle: create, query, delete.'
paths:
  /v1/phota/enhance:
    post:
      tags:
        - Studio
      summary: Enhance
      description: >-
        Enhance a single image.


        Enhancement parameters are inferred automatically. Optionally provide

        a text prompt to guide the enhancement. Returns images or signed
        download URLs.
      operationId: enhance_v1_phota_enhance_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnhanceRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EditResponse'
        '400':
          description: Invalid request or content moderation violation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhotaError400Response'
        '401':
          description: Missing or invalid API key in the X-API-Key header.
        '402':
          description: Insufficient prepaid credit balance.
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhotaError404Response'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhotaError500Response'
        '503':
          description: Service temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhotaError503Response'
      security:
        - APIKeyHeader: []
components:
  schemas:
    EnhanceRequest:
      properties:
        image:
          type: string
          title: Image
          description: >-
            Input image as a raw base64 string or publicly accessible URL.
            Supported formats: JPEG, PNG, WebP, and HEIC/HEIF. Images larger
            than 4K (4096px) are automatically resized; for best results,
            provide images at 4K or below.
        profile_ids:
          items:
            type: string
          type: array
          title: Profile Ids
          description: >-
            Subset of your account's profiles relevant to this request. Your
            account holds all profiles, but only pass the ones belonging to the
            end-user whose photo is being edited. These profiles serve as
            candidates for identity preservation. The fewer profiles you pass,
            the easier it is for our system to determine which profiles are
            relevant.
        num_output_images:
          type: integer
          maximum: 4
          minimum: 1
          title: Num Output Images
          description: Number of output images to generate (1-4).
          default: 1
        output_format:
          type: string
          enum:
            - png
            - jpg
          title: Output Format
          description: >-
            Output image format (png, jpg). Default: png (will change to jpg on
            2026-05-08).
          default: png
        response_mode:
          type: string
          enum:
            - bytes
            - urls
          title: Response Mode
          description: >-
            Response delivery mode. 'bytes': return base64-encoded image data
            (default). 'urls': return signed download URLs (24-hour expiry)
            instead of image bytes.
          default: bytes
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: Optional text instructions to guide the enhancement.
      type: object
      required:
        - image
      title: EnhanceRequest
      description: >-
        Request body for the enhance endpoint.


        Enhances the provided input image without requiring a text prompt,

        aspect ratio, or resolution -- those parameters are inferred
        automatically.


        The image can be provided as a raw base64-encoded string or a publicly

        accessible URL. Both formats are accepted and detected automatically.
      examples:
        - image: https://example.com/photo.jpg
          num_output_images: 1
          profile_ids:
            - abc123
    EditResponse:
      properties:
        images:
          items:
            type: string
          type: array
          title: Images
          description: >-
            Output image(s) as raw base64-encoded strings. Format matches the
            requested output_format. Populated when response_mode='bytes', empty
            otherwise.
        download_urls:
          items:
            type: string
          type: array
          title: Download Urls
          description: >-
            Signed download URLs for each output image (24-hour expiry).
            Populated when response_mode='urls', empty otherwise.
        known_subjects:
          $ref: '#/components/schemas/KnownGeneratedSubjectCounts'
          description: >-
            Dictionary mapping a known subject's `profile_id` to the number of
            times they were generated. If multiple variations are generated,
            this will be the aggregated count across all variations.
      type: object
      required:
        - known_subjects
      title: EditResponse
      description: Response returned by the edit, generate, and enhance endpoints.
    PhotaError400Response:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message.
        code:
          type: string
          enum:
            - CONTENT_MODERATION
            - INVALID_REQUEST
          title: Code
          description: Machine-readable error code.
        request_id:
          type: string
          title: Request Id
          description: Unique request identifier for support.
      type: object
      required:
        - detail
        - code
        - request_id
      title: PhotaError400Response
      description: Error response for 400 Bad Request.
    PhotaError404Response:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message.
        code:
          type: string
          enum:
            - NOT_FOUND
            - PROFILE_NOT_FOUND
            - PROFILE_NOT_READY
          title: Code
          description: Machine-readable error code.
        request_id:
          type: string
          title: Request Id
          description: Unique request identifier for support.
      type: object
      required:
        - detail
        - code
        - request_id
      title: PhotaError404Response
      description: Error response for 404 Not Found.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PhotaError500Response:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message.
        code:
          type: string
          const: INTERNAL_ERROR
          title: Code
          description: Machine-readable error code.
        request_id:
          type: string
          title: Request Id
          description: Unique request identifier for support.
      type: object
      required:
        - detail
        - code
        - request_id
      title: PhotaError500Response
      description: Error response for 500 Internal Server Error.
    PhotaError503Response:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message.
        code:
          type: string
          const: SERVICE_UNAVAILABLE
          title: Code
          description: Machine-readable error code.
        request_id:
          type: string
          title: Request Id
          description: Unique request identifier for support.
      type: object
      required:
        - detail
        - code
        - request_id
      title: PhotaError503Response
      description: Error response for 503 Service Unavailable.
    KnownGeneratedSubjectCounts:
      properties:
        counts:
          additionalProperties:
            type: integer
          type: object
          title: Counts
          description: >-
            Mapping of profile ID to the number of times that subject was
            generated.
      type: object
      title: KnownGeneratedSubjectCounts
      description: Counts of known subjects generated, keyed by profile ID.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````