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

# Search

> Hybrid semantic and visual search across a project drawing set.

Search answers "where does this appear?" by running hybrid semantic + keyword search across all indexed content in a project. Optionally combine with visual similarity search using a reference image.

Search is **synchronous** and returns results immediately (not an async job).

## Request

```json theme={null}
{
  "query": "elevator shaft with two hydraulic lifts",
  "limit": 20
}
```

| Field          | Type      | Required | Description                                                   |
| -------------- | --------- | -------- | ------------------------------------------------------------- |
| `query`        | string    | Yes      | Natural language search query                                 |
| `limit`        | integer   | No       | Maximum results to return (default: 20)                       |
| `source_types` | string\[] | No       | Filter by source type (`block`, `feature`, `file`)            |
| `image_url`    | string    | No       | Storage URI (`gs://` or `s3://`) for visual similarity search |

## Visual Search

When `image_url` is provided, search combines text-based results with visual similarity matching. The image must be a storage URI referencing a file within the target project.

```json theme={null}
{
  "query": "fire alarm pull station",
  "image_url": "gs://bucket/projects/prj_xxx/files/reference.png"
}
```

Text and visual results are merged and ranked by combined relevance score.

## Response

```json theme={null}
{
  "results": [
    {
      "id": "block:blk_01JABCD100",
      "content": "First floor electrical plan showing panel schedule...",
      "context": "Sheet A-101, Block: Plan View",
      "score": 0.89,
      "source_type": "block",
      "source_id": "blk_01JABCD100"
    }
  ]
}
```

| Field         | Description                                             |
| ------------- | ------------------------------------------------------- |
| `id`          | Composite identifier (`{source_type}:{source_id}`)      |
| `content`     | Matched content text                                    |
| `context`     | Human-readable location context                         |
| `score`       | Relevance score (higher is better)                      |
| `source_type` | Type of content matched (`block`, `feature`, or `file`) |
| `source_id`   | ID of the matched entity                                |


## OpenAPI

````yaml POST /projects/{project_id}/search
openapi: 3.1.0
info:
  title: Bedrock API
  version: 1.0.0
  description: >-
    REST API for construction document management and computer vision
    intelligence.
  contact:
    name: Bedrock Support
    url: https://bedrock.cv
    email: support@bedrock.cv
servers:
  - url: https://api.bedrock.cv
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /projects/{project_id}/search:
    post:
      tags:
        - Search
      summary: Search project content
      description: >-
        Hybrid semantic and keyword search across all project content (blocks,
        features, files). Optionally include visual similarity search by
        providing an image URL.
      operationId: searchProject
      parameters:
        - $ref: '#/components/parameters/ApiVersionHeader'
        - name: project_id
          in: path
          required: true
          schema:
            type: string
          description: Project ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HybridSearchRequest'
      responses:
        '200':
          description: Search results.
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Composite ID (source_type:source_id)
                        content:
                          type: string
                          description: Matched text content
                        context:
                          type: object
                          description: Source context metadata
                        score:
                          type: number
                          description: Relevance score (higher is better)
                        source_type:
                          type: string
                          enum:
                            - block
                            - feature
                            - file
                        source_id:
                          type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    ApiVersionHeader:
      name: X-API-Version
      in: header
      required: false
      schema:
        type: string
        default: '2026-01-01'
      description: API version
  schemas:
    HybridSearchRequest:
      type: object
      properties:
        query:
          type: string
        limit:
          type: number
          default: 20
        source_types:
          type: array
          items:
            type: string
            enum:
              - block
              - feature
              - file
        image_url:
          type: string
      required:
        - query
      example:
        query: fire-rated doors
        limit: 20
        source_types:
          - block
          - feature
        image_url: gs://bedrock-files/projects/prj_01JABCD123/files/reference-door.png
    ApiError:
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        code:
          type: string
        request_id:
          type: string
        instance:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      required:
        - type
        - title
        - status
        - detail
      example:
        type: https://docs.bedrock.cv/errors/bad-request
        title: Bad Request
        status: 400
        detail: One or more request fields are invalid.
        instance: /projects
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            type: https://docs.bedrock.cv/errors/bad-request
            title: Bad Request
            status: 400
            detail: One or more request fields are invalid.
            code: VALIDATION_ERROR
            request_id: req_01JABCD123
            errors:
              project_id:
                - Required field
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            type: https://docs.bedrock.cv/errors/authentication
            title: Unauthorized
            status: 401
            detail: Invalid or missing API key.
            code: UNAUTHORIZED
            request_id: req_01JABCD123
    RateLimited:
      description: Rate limited
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            type: https://docs.bedrock.cv/errors/rate-limit
            title: Rate limited
            status: 429
            detail: Rate limit exceeded. Try again in 60 seconds.
            code: RATE_LIMITED
            request_id: req_01JABCD123
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'API key prefixed with `sk_`. Example: `Authorization: Bearer sk_xxx`'
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````