# Upload a Dataset

The `upload_dataset` method lets you upload a dataset to a workspace into a new project or to one that already exists within Roboflow.

To upload a dataset using the Python SDK, use the following code:

```python
import roboflow

rf = roboflow.Roboflow(api_key=YOUR_API_KEY_HERE)

# get a workspace
workspace = rf.workspace("WORKSPACE_URL")

# Upload data set to a new/existing project
workspace.upload_dataset(
    "./dataset/", # This is your dataset path
    "PROJECT_ID", # This will either create or get a dataset with the given ID
    num_workers=10,
    project_license="MIT",
    project_type="object-detection",
    batch_name=None,
    num_retries=0,
    is_prediction=False #optional, set to True if the dataset is not ground truth and needs approval
)
```

The `num_workers` value allows you to set how many images should be uploaded concurrently. We recommend setting a value no greater than 25.

To upload a dataset in the COCO JSON format, for example, make sure your dataset is structured like so:

```
my_dataset/
├── train/
│   ├── image1.jpg
│   ├── image2.jpg
│   ├── image3.jpg
│   └── _annotations.coco.json
├── valid/
│   ├── image4.jpg
│   └── _annotations.coco.json
└── test/
    ├── image5.jpg
    └── _annotations.coco.json
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/developer/python-sdk/upload-a-dataset.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
