# Create a Dataset

**POST** `/v1/datasets`

Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information.

Base URL: `https://api.cohere.com`

Tags: `/datasets`

## Authorization

| Option | Scheme | Type | Sent as | Scopes |
| --- | --- | --- | --- | --- |
| Option 1 | `bearerAuth` | `http` | `Authorization: Bearer <token>` | — |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | Yes | The name of the uploaded dataset. |
| `type` | `string` | Yes | The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API. Allowed values: `embed-input`, `embed-result`, `cluster-result`, `cluster-outliers`, `reranker-finetune-input`, `single-label-classification-finetune-input`, `chat-finetune-input`, `multi-label-classification-finetune-input`, `batch-chat-input`, `batch-openai-chat-input`, `batch-embed-v2-input`, `batch-chat-v2-input`. |
| `keep_original_file` | `boolean` | No | Indicates if the original file should be stored. |
| `skip_malformed_input` | `boolean` | No | Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field. |
| `keep_fields` | `array` | No | List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail. |
| `optional_fields` | `array` | No | List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass. |
| `text_separator` | `string` | No | Raw .txt uploads will be split into entries using the text_separator value. |
| `csv_delimiter` | `string` | No | The delimiter used for .csv uploads. |

## Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Client-Name` | `string` | No | The name of the project that is making the request. |

## Request body

Optional. Media type: `multipart/form-data`

### Example request body

```json
{
  "data": "binary",
  "eval_data": "binary"
}
```

## Responses

| Status | Description | Media type |
| --- | --- | --- |
| `200` | A successful response. | `application/json` |
| `400` | This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields | `application/json` |
| `401` | This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions | `application/json` |
| `403` | This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions | `application/json` |
| `404` | This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id | `application/json` |
| `422` | This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields | `application/json` |
| `429` | Too many requests | `application/json` |
| `498` | This error is returned when a request or response contains a deny-listed token. | `application/json` |
| `499` | This error is returned when a request is cancelled by the user. | `application/json` |
| `500` | This error is returned when an uncategorised internal server error occurs. | `application/json` |
| `501` | This error is returned when the requested feature is not implemented. | `application/json` |
| `503` | This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time | `application/json` |
| `504` | This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond | `application/json` |

### Example response: 200 — A successful response.

```json
{
  "id": "string"
}
```

### Example response: 400 — This error is returned when the request is not well formed. This could be because:
  - JSON is invalid
  - The request is missing required fields
  - The request contains an invalid combination of fields

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 401 — This error indicates that the operation attempted to be performed is not allowed. This could be because:
  - The api token is invalid
  - The user does not have the necessary permissions

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 403 — This error indicates that the operation attempted to be performed is not allowed. This could be because:
  - The api token is invalid
  - The user does not have the necessary permissions

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 404 — This error is returned when a resource is not found. This could be because:
  - The endpoint does not exist
  - The resource does not exist eg model id, dataset id

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 422 — This error is returned when the request is not well formed. This could be because:
  - JSON is invalid
  - The request is missing required fields
  - The request contains an invalid combination of fields

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 429 — Too many requests

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 498 — This error is returned when a request or response contains a deny-listed token.

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 499 — This error is returned when a request is cancelled by the user.

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 500 — This error is returned when an uncategorised internal server error occurs.

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 501 — This error is returned when the requested feature is not implemented.

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 503 — This error is returned when the service is unavailable. This could be due to:
  - Too many users trying to access the service at the same time

```json
{
  "id": "string",
  "message": "string"
}
```

### Example response: 504 — This error is returned when a request to the server times out. This could be due to:
  - An internal services taking too long to respond

```json
{
  "id": "string",
  "message": "string"
}
```

## Related pages

- [/audio/transcriptions](./tags/audio-transcriptions.md)
- [/batches](./tags/batches.md)
- [/connectors](./tags/connectors.md)
- [/datasets](./tags/datasets.md)
- [/embed-jobs](./tags/embed-jobs.md)
- [/finetuning](./tags/finetuning.md)
- [/models](./tags/models.md)
- [API Reference](../../api.md)
- [Authorize with oAuth](./oauthauthorize-connector.md)
- [Cancel a batch](./cancelbatch.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
