> ## Documentation Index
> Fetch the complete documentation index at: https://docs.destined.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload Dataset

> Upload a CSV dataset for bulk TTS generation

## Request

Upload a CSV file with `multipart/form-data`:

<ParamField body="file" type="file" required>
  CSV file with columns: `text`, `speaker_id` (optional)
</ParamField>

<ParamField body="name" type="string" required>
  Name for this dataset
</ParamField>

<ParamField body="generate_audio" type="boolean" default="false">
  Automatically start TTS generation after upload
</ParamField>

## CSV Format

```csv theme={null}
text,speaker_id
"Hello, this is the first sentence.",speaker-1
"This is another sentence to synthesize.",speaker-2
"Third example text here.",
```

<Note>
  If `speaker_id` is empty, a random speaker will be assigned.
</Note>

## Response

<ResponseField name="dataset_id" type="string" required>
  Unique dataset identifier
</ResponseField>

<ResponseField name="name" type="string" required>
  Dataset name
</ResponseField>

<ResponseField name="row_count" type="integer" required>
  Number of rows in the dataset
</ResponseField>

<ResponseField name="job_id" type="string">
  Job ID if `generate_audio` was true
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.destined.ai/v1/datasets/upload" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "file=@dataset.csv" \
    -F "name=My Dataset" \
    -F "generate_audio=true"
  ```

  ```typescript TypeScript theme={null}
  const formData = new FormData();
  formData.append("file", csvFile);
  formData.append("name", "My Dataset");
  formData.append("generate_audio", "true");

  const result = await client.datasets.uploadDatasetV1DatasetsUploadPost({
    file: csvFile,
    name: "My Dataset",
    generateAudio: true,
  });
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "dataset_id": "ds_abc123",
    "name": "My Dataset",
    "row_count": 150,
    "job_id": "job_xyz789",
    "created_at": "2024-01-15T10:30:00Z"
  }
  ```
</ResponseExample>
