# Export Dataset

This endpoint exports all DatasetItems and associated Annotations of a Dataset for use with model training.

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)

This endpoint will time out for very large datasets or slices (>200k items) for now, but an async endpoint is coming soon.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Nucleus API",
    "version": "1.1"
  },
  "servers": [
    {
      "url": "https://api.scale.com/v1/nucleus"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/dataset/{dataset_id}/exportForTraining": {
      "get": {
        "summary": "Export Dataset",
        "description": "This endpoint exports all DatasetItems and associated Annotations of a Dataset for use with model training.\n\nIn order to speed up the export, the following Annotation attributes are not included in the payload:\n* Annotation IDs\n* Annotation-level metadata\n* Reference IDs for annotations (since they are pulled down for the DatasetItem already)\n\nThis endpoint will time out for very large datasets or slices (>200k items) for now, but an async endpoint is coming soon.",
        "operationId": "export-dataset",
        "parameters": [
          {
            "name": "dataset_id",
            "in": "path",
            "description": "The Scale-generated ID of the Dataset.",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "[\n  {\n    \"item\": {\n      \"original_image_url\": \"https://your-bucket/example.png\",\n      \"dataset_item_id\": \"di_zwyt15cag2301b902cw0\",\n      \"reference_id\": \"image_ref_300000\",\n      \"metadata\": {\n        \"License Plate\": \"ZPH-J27\",\n        \"Recording Date\": \"2019-09-15\",\n        \"Recording Time\": \"14:24:21\",\n        \"weather\": \"sunny\",\n        \"camera\": \"back\"\n      }\n    },\n\n    \"annotations\": {\n      \"box\": [\n        {\n          \"label\": \"car\",\n          \"type\": \"box\",\n          \"geometry\": {\n            \"x\": 648.1969604492188,\n            \"y\": 264.34417724609375,\n            \"width\": 70.560546875,\n            \"height\": 50.55670166015625\n          }\n        },\n        {\n          \"label\": \"car\",\n          \"type\": \"box\",\n          \"geometry\": {\n            \"x\": 720.8001098632812,\n            \"y\": 246.6089324951172,\n            \"width\": 139.6986083984375,\n            \"height\": 114.38755798339844\n          }\n        }\n      ]\n    }\n  }\n]"
                  }
                },
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "item": {
                        "type": "object",
                        "properties": {
                          "original_image_url": {
                            "type": "string",
                            "example": "https://your-bucket/example.png"
                          },
                          "dataset_item_id": {
                            "type": "string",
                            "example": "di_zwyt15cag2301b902cw0"
                          },
                          "reference_id": {
                            "type": "string",
                            "example": "image_ref_300000"
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {
                              "License Plate": {
                                "type": "string",
                                "example": "ZPH-J27"
                              },
                              "Recording Date": {
                                "type": "string",
                                "example": "2019-09-15"
                              },
                              "Recording Time": {
                                "type": "string",
                                "example": "14:24:21"
                              },
                              "weather": {
                                "type": "string",
                                "example": "sunny"
                              },
                              "camera": {
                                "type": "string",
                                "example": "back"
                              }
                            }
                          }
                        }
                      },
                      "annotations": {
                        "type": "object",
                        "properties": {
                          "box": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "label": {
                                  "type": "string",
                                  "example": "car"
                                },
                                "type": {
                                  "type": "string",
                                  "example": "box"
                                },
                                "geometry": {
                                  "type": "object",
                                  "properties": {
                                    "x": {
                                      "type": "number",
                                      "example": 648.1969604492188,
                                      "default": 0
                                    },
                                    "y": {
                                      "type": "number",
                                      "example": 264.34417724609375,
                                      "default": 0
                                    },
                                    "width": {
                                      "type": "number",
                                      "example": 70.560546875,
                                      "default": 0
                                    },
                                    "height": {
                                      "type": "number",
                                      "example": 50.55670166015625,
                                      "default": 0
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "60a66ff6bfbc7000736519dd:61b1daae77a06202280a32d8"
}
```