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

# Edit images using prompt and mask



## OpenAPI

````yaml /api-reference/openapi.json post /v1/images/edits
openapi: 3.1.0
info:
  title: SynapsAI Inference API
  version: 1.0.0
servers:
  - url: https://api.synapsai.cloud
    description: Production server
security: []
paths:
  /v1/images/edits:
    post:
      summary: Edit images using prompt and mask
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  oneOf:
                    - type: string
                      format: binary
                    - type: string
                mask:
                  oneOf:
                    - type: string
                      format: binary
                    - type: string
                prompt:
                  type: string
                negative_prompt:
                  type: string
                'n':
                  type: integer
                  default: 1
                output_format:
                  $ref: '#/components/schemas/ImageOutputFormat'
                response_format:
                  $ref: '#/components/schemas/ImageResponseFormat'
                size:
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        type: integer
                blur_factor:
                  type: number
                padding_mask_crop:
                  type: integer
                strength:
                  type: number
                  default: 0.5
                seed:
                  type: integer
                num_inference_steps:
                  type: integer
                  default: 50
                guidance_scale:
                  type: number
                  default: 7.5
              required:
                - image
                - mask
                - prompt
          application/json:
            schema:
              $ref: '#/components/schemas/ImagesEditsRequest'
      responses:
        '200':
          description: Edited images as URLs or base64 strings
          content:
            application/json:
              schema:
                type: object
                properties:
                  model:
                    type: string
                  created:
                    type: integer
                  id:
                    type: string
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                          nullable: true
                        b64_json:
                          type: string
                          nullable: true
                  size:
                    type: string
                  output_format:
                    type: string
components:
  schemas:
    ImageOutputFormat:
      type: string
      description: Image file format for outputs.
      enum:
        - png
        - jpeg
        - webp
      default: png
    ImageResponseFormat:
      type: string
      description: Response format for image endpoints.
      enum:
        - url
        - b64_json
      default: url
    ImagesEditsRequest:
      allOf:
        - type: object
          description: Request schema to edit existing images with prompts and masks.
          properties:
            image:
              oneOf:
                - type: string
                - type: string
                  format: binary
                - type: object
              description: >-
                Original image to be edited (base64, binary upload, or
                structured object). Required.
            mask:
              oneOf:
                - type: string
                - type: string
                  format: binary
                - type: object
              description: Mask indicating which regions to edit. Required.
            prompt:
              type: string
              description: Text prompt describing the desired edit. Required.
            negative_prompt:
              type: string
              nullable: true
              description: >-
                Textual description of undesired characteristics to avoid during
                editing.
            'n':
              type: integer
              default: 1
              description: Number of edited image variations to produce.
            output_format:
              $ref: '#/components/schemas/ImageOutputFormat'
              description: Desired file format for generated images.
            response_format:
              $ref: '#/components/schemas/ImageResponseFormat'
              description: 'How edited images are returned: URLs or base64 JSON strings.'
            size:
              oneOf:
                - type: string
                  enum:
                    - 256x256
                    - 512x512
                    - 1024x1024
                    - 1792x1024
                    - 1024x1792
                - type: array
                  items:
                    type: integer
                  minItems: 2
                  maxItems: 2
              default: 1024x1024
              description: Desired size for the edited images.
            blur_factor:
              type: number
              nullable: true
              description: Amount of blur applied to the mask edges to soften transitions.
            padding_mask_crop:
              type: integer
              nullable: true
              description: Padding applied when cropping the mask before editing.
            strength:
              type: number
              default: 0.5
              description: >-
                Strength of the edit: 0 preserves the original image; 1 performs
                full edit.
            seed:
              type: integer
              nullable: true
              description: Random seed used for reproducible edits.
            num_inference_steps:
              type: integer
              default: 50
              description: Number of diffusion / denoising steps used for edits.
            guidance_scale:
              type: number
              default: 7.5
              description: Guidance scale for prompt adherence during editing.
          required:
            - image
            - mask
            - prompt

````