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

# Export Slice

> [!NOTE]
>
> **[Click for Python SDK](https://docs.nucleus.scale.com/en/latest/api/nucleus/index.html#nucleus.Slice.items_and_annotation_generator)**
>
> ```
> Slice.items_and_annotation_generator(
>     use_mirrored_images: bool = False
> ) -> Iterable[
>     Dict[str, Union[
>         DatasetItem,
>         Dict[str, List[Annotation]]]
>     ]
> ]
> ```

This endpoint exports all DatasetItems and associated Annotations of a Slice for use with model training page-by-page.

In order to speed up the export, the following Annotation attributes are not included in the payload:

* Annotation IDs
* Annotation-level metadata
* Reference IDs for annotations (since they are pulled down for the DatasetItem already)

## Pagination

Each response has two fields:

* `data`: the items of this page, each with its annotations grouped by type.
* `nextPageToken`: pass it as `pageToken` in the next request. When it is empty or missing, you have received the last page.

Send the first request without a `pageToken`. `pageSize` is at most 10000 items; lower it if a request times out.


## OpenAPI

````yaml openapi/nucleus.json POST /slice/{slice_id}/exportForTrainingPage
openapi: 3.1.0
info:
  title: Nucleus API
  version: '1.1'
servers:
  - url: https://api.scale.com/v1/nucleus
security:
  - sec0: []
paths:
  /slice/{slice_id}/exportForTrainingPage:
    post:
      summary: Export Slice
      operationId: export-slice
      parameters:
        - name: slice_id
          in: path
          description: The Scale-generated ID of the Slice.
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                pageToken:
                  type: string
                  description: >-
                    The `dataset_item_id` after which to start fetching items in
                    the next page. Can be null (fetches the first page of
                    items).
                pageSize:
                  type: integer
                  description: The size of the fetched page. The maximum is 10000 items.
                  default: 10000
                  format: int32
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    data:
                      - item:
                          dataset_item_id: di_zwyt15cag2301b902cw0
                          reference_id: image_ref_300000
                          original_image_url: https://your-bucket/example.png
                          metadata: {}
                        annotations:
                          box:
                            - label: car
                              type: box
                              geometry:
                                x: 648.2
                                'y': 264.3
                                width: 70.6
                                height: 50.6
                    nextPageToken: di_zwyt15cag2301b902cw0
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: >-
                      The items of this page with their annotations, grouped by
                      annotation type.
                    items:
                      type: object
                  nextPageToken:
                    type: string
                    description: >-
                      Pass this value as `pageToken` in the next request. When
                      it is empty or missing, the last page has been returned.
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic

````