Skip to main content
Cohere

Search documentation

Type to search this documentation.

Create a Dataset

POST/v1/datasetsCreate a Dataset

Create a dataset by uploading a file. See 'Dataset Creation' for more information.

Parameters

namestringqueryrequired

The name of the uploaded dataset.

typestringqueryrequired

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.

one of "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"

one of "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_filebooleanquery

Indicates if the original file should be stored.

skip_malformed_inputbooleanquery

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_fieldsarrayquery

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_fieldsarrayquery

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_separatorstringquery

Raw .txt uploads will be split into entries using the text_separator value.

csv_delimiterstringquery

The delimiter used for .csv uploads.

X-Client-Namestringheader

The name of the project that is making the request.

Request body

multipart/form-data
object
datastring · binaryrequired

The file to upload

eval_datastring · binary

An optional evaluation file to upload

Example request
{
  "data": "binary",
  "eval_data": "binary"
}

Responses

200A successful response.application/json
object
idstring

The dataset ID

Example response
{
  "id": "string"
}
400This 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
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
401This 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
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
403This 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
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
404This 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
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
422This 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
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
429Too many requestsapplication/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
498This error is returned when a request or response contains a deny-listed token. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
499This error is returned when a request is cancelled by the user. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
500This error is returned when an uncategorised internal server error occurs. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
501This error is returned when the requested feature is not implemented. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
503This 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
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
504This 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
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
Documentation menu