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

# Semantic search

> Search the brand session's library images by visual meaning, with the most similar results first. Library images have a `source` of `uploaded` (added by the user) or `scraped` (pulled in during onboarding); generated images are excluded. Images without a description or embedding are excluded from search. Pass the `cursor` from the previous response to paginate.



## OpenAPI

````yaml https://www.trybloom.ai/api/v1/spec.json post /images/search
openapi: 3.1.1
info:
  title: Bloom API
  version: 1.0.0
servers:
  - url: https://www.trybloom.ai/api/v1
security:
  - apiKey: []
  - bearer: []
tags:
  - name: Account
    description: >-
      Inspect the authenticated account — profile, credit balance, and
      accessible workspaces.
  - name: Brands
    description: Manage brands and brand identity.
  - name: Images
    description: Generate, edit, and retrieve images.
paths:
  /images/search:
    post:
      tags:
        - Images
      summary: Semantic search
      description: >-
        Search the brand session's library images by visual meaning, with the
        most similar results first. Library images have a `source` of `uploaded`
        (added by the user) or `scraped` (pulled in during onboarding);
        generated images are excluded. Images without a description or embedding
        are excluded from search. Pass the `cursor` from the previous response
        to paginate.
      operationId: images.search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                brandSessionId:
                  type: string
                  format: uuid
                  description: Brand ID to search within
                query:
                  type: string
                  minLength: 1
                  maxLength: 500
                  description: >-
                    Visual concept to search for. Plain noun phrases work best —
                    e.g., 'drone in flight', 'team working at desks', 'product
                    on white background'.
                limit:
                  type: integer
                  minimum: 1
                  maximum: 50
                  default: 10
                  description: Max results to return (default 10, max 50)
                cursor:
                  type: string
                  description: Pagination cursor from a previous response's nextCursor
                maxDistance:
                  type: number
                  minimum: 0
                  maximum: 2
                  default: 0.7
                  description: >-
                    Cosine-distance cutoff (smaller = stricter). The default of
                    0.7 works well for most queries. Use a higher value for
                    broader matching or a lower value for stricter results.
                    Distances above this threshold are excluded.
              required:
                - brandSessionId
                - query
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      query:
                        type: string
                      candidates:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                            url:
                              type: string
                            description:
                              type: string
                            width:
                              anyOf:
                                - type: number
                                - type: 'null'
                            height:
                              anyOf:
                                - type: number
                                - type: 'null'
                            aspectRatio:
                              anyOf:
                                - enum:
                                    - '1:1'
                                    - '2:3'
                                    - '3:2'
                                    - '3:4'
                                    - '4:3'
                                    - '4:5'
                                    - '5:4'
                                    - '9:16'
                                    - '16:9'
                                    - '21:9'
                                  type: string
                                - type: 'null'
                            distance:
                              type: number
                              description: Opaque relevance score; smaller = closer.
                          required:
                            - id
                            - url
                            - description
                            - width
                            - height
                            - aspectRatio
                            - distance
                      nextCursor:
                        anyOf:
                          - type: string
                          - type: 'null'
                      hasMore:
                        type: boolean
                    required:
                      - query
                      - candidates
                      - nextCursor
                      - hasMore
                required:
                  - data
        '400':
          description: '400'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImagesSearch400ErrorResponse'
        '401':
          description: '401'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImagesSearch401ErrorResponse'
        '403':
          description: '403'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImagesSearch403ErrorResponse'
        '422':
          description: '422'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImagesSearch422ErrorResponse'
        '429':
          description: '429'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImagesSearch429ErrorResponse'
          headers:
            Retry-After:
              description: >-
                Seconds until the API-key request limit resets. Present only
                when the request-rate limiter can calculate the delay.
              schema:
                type: integer
                minimum: 0
components:
  schemas:
    ImagesSearch400ErrorResponse:
      type: object
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ApiError'
            - anyOf:
                - type: object
                  properties:
                    code:
                      const: INVALID_CURSOR
                    status:
                      const: 400
                    message:
                      type: string
                      default: Invalid pagination cursor
                    data: {}
                  required:
                    - code
                    - status
                    - message
                - type: object
                  properties:
                    code:
                      type: string
                    status:
                      type: integer
                    message:
                      type: string
                    data: {}
                  required:
                    - code
                    - status
                    - message
      required:
        - error
    ImagesSearch401ErrorResponse:
      type: object
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ApiError'
            - anyOf:
                - type: object
                  properties:
                    code:
                      const: UNAUTHORIZED
                    status:
                      const: 401
                    message:
                      type: string
                      default: Invalid or missing API credentials
                    data: {}
                  required:
                    - code
                    - status
                    - message
                - type: object
                  properties:
                    code:
                      type: string
                    status:
                      type: integer
                    message:
                      type: string
                    data: {}
                  required:
                    - code
                    - status
                    - message
      required:
        - error
    ImagesSearch403ErrorResponse:
      type: object
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ApiError'
            - anyOf:
                - type: object
                  properties:
                    code:
                      const: ACCOUNT_BANNED
                    status:
                      const: 403
                    message:
                      type: string
                      default: This account has been suspended.
                    data: {}
                  required:
                    - code
                    - status
                    - message
                - type: object
                  properties:
                    code:
                      const: FORBIDDEN
                    status:
                      const: 403
                    message:
                      type: string
                      default: Plan upgrade required
                    data: {}
                  required:
                    - code
                    - status
                    - message
                - type: object
                  properties:
                    code:
                      type: string
                    status:
                      type: integer
                    message:
                      type: string
                    data: {}
                  required:
                    - code
                    - status
                    - message
      required:
        - error
    ImagesSearch422ErrorResponse:
      type: object
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ApiError'
            - anyOf:
                - type: object
                  properties:
                    code:
                      const: BRAND_NOT_FOUND
                    status:
                      const: 422
                    message:
                      type: string
                      default: Brand session not found
                    data: {}
                  required:
                    - code
                    - status
                    - message
                - type: object
                  properties:
                    code:
                      type: string
                    status:
                      type: integer
                    message:
                      type: string
                    data: {}
                  required:
                    - code
                    - status
                    - message
      required:
        - error
    ImagesSearch429ErrorResponse:
      type: object
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ApiError'
            - anyOf:
                - type: object
                  properties:
                    code:
                      const: TOO_MANY_REQUESTS
                    status:
                      const: 429
                    message:
                      type: string
                      default: Rate limit exceeded
                    data: {}
                  required:
                    - code
                    - status
                    - message
                - type: object
                  properties:
                    code:
                      type: string
                    status:
                      type: integer
                    message:
                      type: string
                    data: {}
                  required:
                    - code
                    - status
                    - message
      required:
        - error
    ApiError:
      type: object
      properties:
        code:
          type: string
        status:
          type: integer
        message:
          type: string
        data: {}
      required:
        - code
        - status
        - message
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Bloom API key, for example `x-api-key: bloom_sk_...`.'
    bearer:
      type: http
      scheme: bearer
      description: Bloom API key (`Bearer bloom_sk_...`) or Bloom OAuth access token.

````