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

# Delete Annotations

> Deletes all ground truth annotations on the given dataset items or scenes. This runs asynchronously and returns a job to poll.

> [!NOTE]
>
> **[Click for Python SDK](https://docs.nucleus.scale.com/en/latest/api/nucleus/index.html#nucleus.Dataset.delete_annotations)**
>
> ```
> Dataset.delete_annotations(
>     reference_ids: Optional[list] = None,
>     keep_history: bool = True
> ) -> AsyncJob
> ```

This endpoint deletes all ground truth annotations on the dataset items or scenes you name. It works per item: you can't delete a single annotation by its ID, and there's no call that deletes every annotation in a dataset.

* `reference_ids` is required and must contain at least one reference ID. Each ID can be a dataset item or a scene. If any ID isn't in the dataset, the whole request fails with a 400.
* For dataset items, this removes the item's ground truth annotations and segmentation masks. For scenes, it removes the scene's category annotations. Model predictions are not affected.
* `keep_history` defaults to `true`, which keeps the annotations' version history. Set it to `false` to delete the history as well.

Deleting annotations can take a while, so the request runs asynchronously. It returns `202` with a `job_id` before deletion has finished; use the job to check its status.

```python theme={null}
job = dataset.delete_annotations(reference_ids=["item_ref_1"], keep_history=True)
job.sleep_until_complete()
```

Re-uploading with `update=True` doesn't remove annotations: it only overwrites annotations that match on `annotation_id` and `reference_id`, and leaves the rest in place. To keep only some of an item's annotations, delete all of the item's annotations with this endpoint, wait for the job to complete, then upload the annotations you want to keep. See [Add Geometric Annotations](https://api-reference.scale.com/docs/nucleus/api-reference/add-geometric-annotations.md).


## OpenAPI

````yaml openapi/nucleus.json DELETE /annotation/{dataset_id}
openapi: 3.1.0
info:
  title: Nucleus API
  version: '1.1'
servers:
  - url: https://api.scale.com/v1/nucleus
security:
  - sec0: []
paths:
  /annotation/{dataset_id}:
    delete:
      summary: Delete Annotations
      description: >-
        Deletes all ground truth annotations on the given dataset items or
        scenes. This runs asynchronously and returns a job to poll.
      operationId: delete-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
              properties:
                reference_ids:
                  type: array
                  description: >-
                    Reference IDs of the dataset items or scenes whose ground
                    truth annotations you want to delete. At least one is
                    required. If any ID is not in the dataset, the whole request
                    fails with a 400.
                  items:
                    type: string
                  minItems: 1
                keep_history:
                  type: boolean
                  description: >-
                    Whether to keep version history. If true (the default), the
                    version history, including the deletion, is kept. If false,
                    all previous versions are deleted along with the
                    annotations.
                  default: true
              required:
                - reference_ids
      responses:
        '202':
          description: '202'
          content:
            application/json:
              examples:
                Result:
                  value:
                    job_id: job_c19xcf9mkws46gah0000
                    job_last_known_status: Running
                    job_type: ingestTasks
                    job_creation_time: '2021-07-20T18:07:13.055Z'
                    dataset_id: ds_bw6de8s84pe0vbn6p5zg
                    message: >-
                      Deleting ground truth annotations, this may take a few
                      minutes.
              schema:
                type: object
                properties:
                  job_id:
                    type: string
                    example: job_c19xcf9mkws46gah0000
                  job_last_known_status:
                    type: string
                    example: Running
                  job_type:
                    type: string
                    example: ingestTasks
                  job_creation_time:
                    type: string
                    example: '2021-07-20T18:07:13.055Z'
                  dataset_id:
                    type: string
                    example: ds_bw6de8s84pe0vbn6p5zg
                  message:
                    type: string
                    example: >-
                      Deleting ground truth annotations, this may take a few
                      minutes.
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value: {}
              schema:
                type: object
                properties: {}
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic

````