> ## Documentation Index
> Fetch the complete documentation index at: https://api-reference.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Annotations

> [!NOTE]
>
> **[Click for Python SDK](https://docs.nucleus.scale.com/en/latest/api/nucleus/index.html#nucleus.Dataset.annotate)**
>
> ```
> Dataset.annotate(
>     annotations: Sequence[Annotation],
>     update: bool = False,
>     batch_size: int = 5000,
>     asynchronous: bool = False,
>     remote_files_per_upload_request: int = 20,
>     local_files_per_upload_request: int = 10
> ) -> Union[dict, AsyncJob]
> ```

This endpoint allows you to add box, polygon, cuboid, or category annotations to a Nucleus `Dataset`.

## Definition: `BoxGeometry`

| Key | Type | Description |
| - | - | - |
| `x` | float (**required**) | The distance, in pixels, between the left border of the bounding box and the left border of the image. |
| `y` | float (**required**) | The distance, in pixels, between the top border of the bounding box and the top border of the image. |
| `width` | float (**required**) | The width in pixels of the annotation. |
| `height` | float (**required**) | The height in pixels of the annotation. |

## Definition: `Point2D`

| Key | Type | Description |
| - | - | - |
| `x` | float (**required**) | The distance, in pixels, between the point and the left border of the image. |
| `y` | float (**required**) | The distance, in pixels, between the point and the top border of the image. |

## Definition: `PolygonGeometry`

| Key | Type | Description |
| - | - | - |
| `vertices` | array of [`Point2D`](#definition-point2d) | Array of `Point2D` objects that represent vertices of the polygon. |

## Definition: `Point3D`

| Key | Type | Description |
| - | - | - |
| `x` | float (**required**) | The x coordinate of the point. |
| `y` | float (**required**) | The y coordinate of the point. |
| `z` | float (**required**) | The z coordinate of the point. |

## Definition: `CuboidGeometry`

| Key | Type | Description |
| - | - | - |
| `position` | [`Point3D`](#definition-point3d) (**required**) | The center of the cuboid. |
| `dimensions` | [`Point3D`](#definition-point3d) (**required**) | The length, width, and height of the cuboid. |
| `yaw` | float (**required**) | The rotation, in radians, about the z axis of the cuboid. |


## OpenAPI

````yaml openapi/nucleus.json POST /dataset/{dataset_id}/annotate
openapi: 3.1.0
info:
  title: Nucleus API
  version: '1.1'
servers:
  - url: https://api.scale.com/v1/nucleus
security:
  - sec0: []
paths:
  /dataset/{dataset_id}/annotate:
    post:
      summary: Add Annotations
      operationId: add-geometric-annotations
      parameters:
        - name: dataset_id
          in: path
          description: The Scale-generated ID of the Dataset.
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - annotations
              properties:
                annotations:
                  type: array
                  description: An array of `Annotation` objects.
                  items:
                    properties:
                      reference_id:
                        type: string
                        description: >-
                          User-defined ID of the image to which to apply this
                          Annotation.
                      annotation_id:
                        type: string
                        description: >-
                          Optional unique ID that uniquely identifies this
                          Annotation within its target DatasetItem. Upon ingest,
                          a matching annotation ID will be ignored by default,
                          and updated if update=True for dataset.annotate. If
                          not supplied, an annotation_id will be generated based
                          on the reference_id, label, and geometry. We do not
                          support annotation_id for category annotations.
                      label:
                        type: string
                        description: >-
                          The label for this car (e.g. car, pedestrian,
                          bicycle).
                      type:
                        type: string
                        description: One of `box`, `polygon`, `cuboid` or `category`.
                      geometry:
                        type: object
                        description: >-
                          One of [BoxGeometry](#definition-boxgeometry),
                          [PolygonGeometry](#definition-polygongeometry) or
                          [CuboidGeometry](#definition-cuboidgeometry) or an
                          empty geometry object {}. Must correspond with the
                          `type`. Set geometry to {} for category annotations
                          since category annotations have no notion of geometry.
                      metadata:
                        type: object
                        description: A metadata blob for the annotation.
                      taxonomy_name:
                        type: string
                        description: Optional name of the taxonomy for the annotation.
                    required:
                      - reference_id
                      - label
                      - type
                      - geometry
                    type: object
                update:
                  type: boolean
                  description: >-
                    Whether to overwrite existing annotations upon
                    `annotation_id` and `reference_id` collision. For category
                    annotations, determines whether to overwrite upon
                    `taxonomy_name` and `reference_id` collision.
                  default: false
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    dataset_id: ds_bw6de8s84pe0vbn6p5zg
                    annotations_processed: 3
              schema:
                type: object
                properties:
                  dataset_id:
                    type: string
                    example: ds_bw6de8s84pe0vbn6p5zg
                  annotations_processed:
                    type: integer
                    example: 3
                    default: 0
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value: {}
              schema:
                type: object
                properties: {}
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic

````