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

# Parse

> Detect and extract structured features from a sheet using legend-driven symbol matching.

Parse answers "what is on this sheet?" by running detection and extraction tasks that populate the [Drawing Index](/guides/the-drawing-index) with structured features, metadata, and relationships.

## Supported Features

The `features` array selects which tasks to run.

| Feature       | Status      | Description                                                              |
| ------------- | ----------- | ------------------------------------------------------------------------ |
| `symbols`     | Available   | Legend-driven symbol detection (doors, windows, fixtures, MEP equipment) |
| `legend`      | Coming soon | Legend block parsing (standalone)                                        |
| `rooms`       | Coming soon | Room boundary detection and labeling                                     |
| `grid`        | Coming soon | Grid line and axis detection                                             |
| `schedule`    | Coming soon | Table and schedule extraction                                            |
| `notes`       | Coming soon | General and key notes extraction                                         |
| `title_block` | Coming soon | Title block metadata extraction                                          |

Only `symbols` is currently accepted by the API. Requesting a "coming soon" feature will return a validation error.

## Target Options

Parse from an existing sheet, block, drawing, or an uploaded file:

| Target       | Description                                                              |
| ------------ | ------------------------------------------------------------------------ |
| `sheet_id`   | Parse from an existing sheet in the system                               |
| `block_id`   | Parse a specific block directly (requires `legend_block_id`)             |
| `drawing_id` | Parse all sheets in a drawing (auto-detects legends)                     |
| `file_id`    | Parse from an uploaded PDF file (creates Drawing + Sheets automatically) |

### Parsing from Uploaded Files

For new documents, use the file upload flow:

1. **Upload the file** via `POST /files` to get a signed upload URL
2. **Upload the PDF** to the signed URL
3. **Confirm the upload** via `POST /files/{file_id}/confirm`
4. **Start parsing** via `POST /parse` with `file_id`
5. **Poll or stream** for results

```json theme={null}
{
  "file_id": "fil_01JABCD111",
  "features": ["symbols"]
}
```

Parsing will automatically render PDF pages, create Drawing and Sheet records, detect blocks, then run symbol detection.

## Symbol Detection

Symbol detection is the primary feature extraction pipeline. It is always **legend-driven**: every drawing set defines its own symbols in its legend blocks, and detection uses those definitions as the source of truth.

Doors, windows, hatching patterns, and MEP equipment (valves, fixtures, etc.) are all **symbols**. They appear in the drawing's legend and are detected via this pipeline.

### Pipeline

When you request `features: ["symbols"]`, the pipeline runs:

1. **Parse legend blocks** - detect each symbol graphic in the legend with its bounding box, label, and description
2. **Crop symbol templates** - extract each legend symbol as an image crop (the exemplar)
3. **Template match on view blocks** - find instances of each legend symbol across plan views using tiled image matching
4. **Verify with embeddings** - filter false positives using DINOv2 embedding similarity
5. **Cross-symbol NMS** - resolve overlapping detections from different symbol types using LLM-based reasoning
6. **Link results** - create `defined_by` relations from each detected symbol back to its legend entry

```json theme={null}
{
  "sheet_id": "sht_xxx",
  "features": ["symbols"]
}
```

For block-level parsing, provide a `legend_block_id` so the pipeline knows which legend to use:

```json theme={null}
{
  "block_id": "blk_xxx",
  "features": ["symbols"],
  "options": {
    "symbols": {
      "legend_block_id": "blk_yyy"
    }
  }
}
```

### Matching Capabilities

The matching engine handles symbols printed at different scales across sheets (0.5x - 2.0x range). Each detection includes a `confidence` score (0-1) indicating how closely it matches the legend symbol template.

### Current Limitations

* Target symbols of scale range of **0.5x - 2.0x** relative to the legend template size
* Does not account for "suffix text" associated with a symbol (e.g., circuit numbers next to receptacles). The matcher will attempt to match the text as part of the symbol graphic, which can reduce confidence or cause misses.
* Detections are skipped for symbols smaller than **10px wide or 10px high** when rendered at 300 DPI
* Does not reliably detect symbols where the **stroke thickness** differs drastically between the plan view and the legend template

### Incremental Webhooks

Parse fires incremental webhooks as each stage completes, so you can process results as they arrive rather than waiting for the entire job. See [Webhooks](/vision-api/webhooks) for payload details.

**Legend parsed** (`parse.child.completed` with `child_job_type: "vision.legend.parse"`): Fired when a legend block finishes parsing. Includes the list of symbols detected in that legend:

```json theme={null}
{
  "type": "parse.child.completed",
  "data": {
    "job_id": "job_01JABCD125",
    "parent_job_id": "job_01JABCD123",
    "child_job_type": "vision.legend.parse",
    "status": "completed",
    "target": { "type": "block", "id": "blk_01JABCD200" },
    "results": {
      "block_id": "blk_01JABCD200",
      "symbols_detected": 24,
      "symbols_with_graphic": 18,
      "symbols": [
        {
          "feature_id": "ftr_01JABCD300",
          "label": "duplex_receptacle",
          "description": "DUPLEX RECEPTACLE",
          "has_graphic": true
        }
      ]
    }
  }
}
```

**Block symbols matched** (`parse.block.completed`): Fired when a view block finishes symbol detection. Includes per-block detection results:

```json theme={null}
{
  "type": "parse.block.completed",
  "data": {
    "job_id": "job_01JABCD126",
    "parse_job_id": "job_01JABCD123",
    "block_id": "blk_01JABCD100",
    "status": "completed",
    "results": {
      "symbols": [
        {
          "label": "duplex_receptacle",
          "description": "DUPLEX RECEPTACLE",
          "instance_count": 4,
          "instances": [
            {
              "feature_id": "ftr_01JABCD400",
              "bounds": { "x_min": 333, "y_min": 207, "x_max": 345, "y_max": 222 },
              "confidence": 0.694
            }
          ]
        }
      ],
      "summary": {
        "total_symbols_searched": 5,
        "total_instances_found": 21
      }
    }
  }
}
```

### Result Payload

When the parse job completes, the results contain the combined symbol detections across all blocks:

```json theme={null}
{
  "legend": [
    {
      "block_id": "blk_01JABCD200",
      "symbols_detected": 24,
      "symbols_with_graphic": 18,
      "symbols": [
        {
          "feature_id": "ftr_01JABCD300",
          "label": "duplex_receptacle",
          "description": "DUPLEX RECEPTACLE (NEW DEVICE, PROVIDE BACKBOX & WIRING)",
          "has_graphic": true
        }
      ]
    }
  ],
  "symbols": [
    {
      "label": "duplex_receptacle",
      "description": "DUPLEX RECEPTACLE (NEW DEVICE, PROVIDE BACKBOX & WIRING)",
      "legend_feature_id": "ftr_01JABCD300",
      "instance_count": 4,
      "instances": [
        {
          "feature_id": "ftr_01JABCD400",
          "block_id": "blk_01JABCD100",
          "bounds": { "x_min": 333, "y_min": 207, "x_max": 345, "y_max": 222 },
          "confidence": 0.694
        }
      ]
    }
  ],
  "summary": {
    "total_symbols_searched": 5,
    "total_instances_found": 21
  }
}
```

| Field                              | Description                                                                         |
| ---------------------------------- | ----------------------------------------------------------------------------------- |
| `legend[]`                         | Per-legend-block results array                                                      |
| `legend[].block_id`                | Legend block ID                                                                     |
| `legend[].symbols_detected`        | Total symbols found in this legend block                                            |
| `legend[].symbols_with_graphic`    | Symbols with a visual graphic (excludes text-only entries)                          |
| `legend[].symbols[].feature_id`    | Feature ID of the legend entry                                                      |
| `legend[].symbols[].has_graphic`   | Whether the symbol has a visual graphic for matching                                |
| `symbols[].legend_feature_id`      | Reference to the legend entry feature                                               |
| `symbols[].instances[].bounds`     | Pixel coordinates within the parent block image                                     |
| `symbols[].instances[].confidence` | Score (0-1) indicating how closely the detection matches the legend symbol template |
| `summary.total_symbols_searched`   | Unique symbol types with at least one detection                                     |
| `summary.total_instances_found`    | Total detections across all blocks                                                  |


## OpenAPI

````yaml POST /parse
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:
  /parse:
    post:
      tags:
        - Vision
      summary: Parse features
      description: >-
        Detect and extract structured features from a sheet using legend-driven
        symbol matching.
      operationId: parse
      parameters:
        - $ref: '#/components/parameters/ApiVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ParseRequest'
      responses:
        '200':
          description: Completed job result (returned when polling or via webhook).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParseResult'
        '202':
          description: Job queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/VisionJob'
              example:
                data:
                  job_id: job_01JABCD123
                  type: overlay.generate
                  status: PENDING
        '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:
    ParseRequest:
      type: object
      properties:
        sheet_id:
          type: string
        file_id:
          type: string
        block_id:
          type: string
        drawing_id:
          type: string
        features:
          type: array
          items:
            type: string
            enum:
              - symbols
        options:
          type: object
          properties:
            symbols:
              type: object
              properties:
                exemplars:
                  type: array
                  items:
                    type: object
                    properties:
                      label:
                        type: string
                      description:
                        type: string
                      image_url:
                        type: string
                      source:
                        type: object
                        properties:
                          sheet_id:
                            type: string
                          bounds:
                            type: object
                            properties:
                              x_min:
                                type: number
                              y_min:
                                type: number
                              x_max:
                                type: number
                              y_max:
                                type: number
                            required:
                              - x_min
                              - y_min
                              - x_max
                              - y_max
                        required:
                          - sheet_id
                          - bounds
                    required:
                      - label
                count:
                  type: boolean
                legend:
                  type: array
                  items:
                    type: object
                    properties:
                      label:
                        type: string
                      description:
                        type: string
                      image_url:
                        type: string
                    required:
                      - label
                legend_block_id:
                  type: string
            mep:
              type: object
              properties:
                systems:
                  type: array
                  items:
                    type: string
                    enum:
                      - hvac_duct
                      - hvac_pipe
                      - plumbing
                      - electrical
                      - fire_protection
                measure:
                  type: boolean
            dimensions:
              type: object
              properties:
                units:
                  type: string
                  enum:
                    - imperial
                    - metric
            annotations:
              type: object
              properties:
                types:
                  type: array
                  items:
                    type: string
                    enum:
                      - cloud
                      - callout
                      - redline
                      - keynote
            text:
              type: object
              properties:
                regions:
                  type: array
                  items:
                    type: string
                    enum:
                      - notes
                      - schedules
                      - specifications
      required:
        - features
      example:
        sheet_id: sht_01JABCD123
        features:
          - symbols
        options:
          symbols:
            count: true
    ParseResult:
      type: object
      description: Completed parse job result with symbol detections.
      properties:
        job_id:
          type: string
          example: job_01JABCD123
        type:
          type: string
          example: parse
        status:
          type: string
          example: Completed
        target:
          type: object
          properties:
            type:
              type: string
              example: sheet
            id:
              type: string
              example: sht_01JABCD123
        results:
          type: object
          description: Combined symbol detection results across all blocks.
          properties:
            legend:
              type: array
              description: Per-legend-block results.
              items:
                type: object
                properties:
                  block_id:
                    type: string
                    description: Legend block ID.
                  symbols_detected:
                    type: integer
                    description: Total symbols found in this legend block.
                  symbols_with_graphic:
                    type: integer
                    description: >-
                      Symbols with a visual graphic (excludes text-only
                      entries).
                  symbols:
                    type: array
                    description: Symbols parsed from this legend block.
                    items:
                      type: object
                      properties:
                        feature_id:
                          type: string
                          description: Feature ID of the legend entry.
                        label:
                          type: string
                          description: Symbol label.
                        description:
                          type: string
                          description: Description text from the legend.
                        has_graphic:
                          type: boolean
                          description: >-
                            Whether the symbol has a visual graphic for
                            matching.
            symbols:
              type: array
              items:
                type: object
                properties:
                  label:
                    type: string
                    description: Symbol label from the legend.
                  description:
                    type: string
                    description: Description text from the legend entry.
                  legend_feature_id:
                    type: string
                    description: >-
                      Feature ID of the legend entry this symbol was matched
                      from.
                  instance_count:
                    type: integer
                    description: Number of instances found.
                  instances:
                    type: array
                    items:
                      type: object
                      properties:
                        feature_id:
                          type: string
                        block_id:
                          type: string
                        bounds:
                          $ref: '#/components/schemas/BoundingBox'
                        confidence:
                          type: number
                          minimum: 0
                          maximum: 1
                          description: >-
                            Score (0-1) indicating how closely the detection
                            matches the legend symbol template.
            summary:
              type: object
              properties:
                total_symbols_searched:
                  type: integer
                  description: Unique symbol types with at least one detection.
                total_instances_found:
                  type: integer
                  description: Total detections across all blocks.
        created_at:
          type: string
          format: date-time
        completed_at:
          type: string
          format: date-time
      example:
        job_id: job_01JABCD123
        type: parse
        status: Completed
        target:
          type: sheet
          id: sht_01JABCD123
        results:
          legend:
            - block_id: blk_01JABCD200
              symbols_detected: 24
              symbols_with_graphic: 18
              symbols:
                - feature_id: ftr_01JABCD300
                  label: duplex_receptacle
                  description: DUPLEX RECEPTACLE
                  has_graphic: true
          symbols:
            - label: duplex_receptacle
              description: DUPLEX RECEPTACLE
              legend_feature_id: ftr_01JABCD300
              instance_count: 4
              instances:
                - feature_id: ftr_01JABCD400
                  block_id: blk_01JABCD100
                  bounds:
                    x_min: 333
                    y_min: 207
                    x_max: 345
                    y_max: 222
                  confidence: 0.694
          summary:
            total_symbols_searched: 5
            total_instances_found: 21
        created_at: '2024-01-15T10:00:00Z'
        completed_at: '2024-01-15T10:01:30Z'
    VisionJob:
      type: object
      properties:
        job_id:
          type: string
        type:
          type: string
        status:
          type: string
      required:
        - job_id
        - type
        - status
      example:
        job_id: job_01JABCD123
        type: overlay.generate
        status: PENDING
    BoundingBox:
      type: object
      properties:
        x_min:
          type: number
        y_min:
          type: number
        x_max:
          type: number
        y_max:
          type: number
      required:
        - x_min
        - y_min
        - x_max
        - y_max
    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

````