> ## 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.

# Generate masks for an image



## OpenAPI

````yaml /api-reference/openapi.json post /v1/images/mask-generation
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/mask-generation:
    post:
      summary: Generate masks for an image
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MaskGenerationRequest'
      responses:
        '200':
          description: Masks
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                  description: mask in base64 or URL
components:
  schemas:
    MaskGenerationRequest:
      allOf:
        - type: object
          description: >-
            Request parameters for mask generation tasks (e.g., segmentation
            proposals).
          properties:
            image:
              oneOf:
                - type: string
                - type: array
                  items: {}
                - type: string
                  format: binary
              description: >-
                Image to generate masks for (base64, object or binary).
                Required.
            mask_threshold:
              type: number
              default: 0
              description: Threshold to binarize mask logits into mask regions.
            pred_iou_thresh:
              type: number
              default: 0.88
              description: IoU threshold used to filter predicted mask proposals.
            stability_score_thresh:
              type: number
              default: 0.95
              description: >-
                Threshold on the stability score to determine high-quality
                masks.
            stability_score_offset:
              type: integer
              default: 1
              description: Offset parameter to adjust stability score thresholds.
            crops_nms_thresh:
              type: number
              default: 0.7
              description: NMS threshold for cropping proposals during mask generation.
            crops_n_layers:
              type: integer
              default: 0
              description: >-
                Number of cropping layers to apply for multi-scale mask
                generation.
            crop_overlap_ratio:
              type: number
              default: 0.3413
              description: Overlap ratio used when cropping the image for mask proposals.
            crop_n_points_downscale_factor:
              type: integer
              default: 1
              description: >-
                Downscale factor to reduce number of sample points in cropped
                regions.
            timeout:
              type: number
              nullable: true
              description: Maximum time allowed for mask generation processing.
          required:
            - image

````