> This page is for version v1 API.
> For other versions, use one of these documentation indexes:
> - v2 API (default): https://docs.cohere.com/v2/llms.txt
> - v1 API: https://docs.cohere.com/v1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cohere.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cohere.com/_mcp/server.

# Get a Dataset

GET https://api.cohere.com/v1/datasets/{id}

Retrieve a dataset by ID. See ['Datasets'](https://docs.cohere.com/docs/datasets) for more information.

Reference: https://docs.cohere.com/reference/get-dataset

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `id` (string, required)

### Headers

- `X-Client-Name` (string, optional) — The name of the project that is making the request.

## Response

### 200

A successful response.

- `dataset` (Dataset, required)

## Errors

### 400 Bad Request Error

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

- `message` (string, optional)
- `id` (string, optional)

### 401 Unauthorized Error

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

- `message` (string, optional)
- `id` (string, optional)

### 403 Forbidden Error

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

- `message` (string, optional)
- `id` (string, optional)

### 404 Not Found Error

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

- `message` (string, optional)
- `id` (string, optional)

### 422 Unprocessable Entity Error

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

- `message` (string, optional)
- `id` (string, optional)

### 429 Too Many Requests Error

Too many requests

- `message` (string, optional)
- `id` (string, optional)

### 498 Invalid Token Error

This error is returned when a request or response contains a deny-listed token.

- `message` (string, optional)
- `id` (string, optional)

### 499 Client Closed Request Error

This error is returned when a request is cancelled by the user.

- `message` (string, optional)
- `id` (string, optional)

### 500 Internal Server Error

This error is returned when an uncategorised internal server error occurs.

- `message` (string, optional)
- `id` (string, optional)

### 501 Not Implemented Error

This error is returned when the requested feature is not implemented.

- `message` (string, optional)
- `id` (string, optional)

### 503 Service Unavailable Error

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

- `message` (string, optional)
- `id` (string, optional)

### 504 Gateway Timeout Error

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

- `message` (string, optional)
- `id` (string, optional)

## Types

### Dataset

- `id` (string, required) — The dataset ID
- `name` (string, required) — The name of the dataset
- `created_at` (string, required) — The creation date
- `updated_at` (string, required) — The last update date
- `dataset_type` (enum, required) — The type of the dataset
  - 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`
- `validation_status` (enum, required) — The validation status of the dataset
  - Allowed values: `unknown`, `queued`, `processing`, `failed`, `validated`, `skipped`
- `validation_error` (string, optional) — Errors found during validation
- `schema` (string, optional) — the avro schema of the dataset
- `required_fields` (list of string, optional)
- `preserve_fields` (list of string, optional)
- `dataset_parts` (list of DatasetPart, optional) — the underlying files that make up the dataset
- `validation_warnings` (list of string, optional) — warnings found during validation
- `parse_info` (ParseInfo, optional)
- `metrics` (Metrics, optional)

### DatasetPart

- `id` (string, required) — The dataset part ID
- `name` (string, required) — The name of the dataset part
- `url` (string, optional) — The download url of the file
- `index` (integer, optional) — The index of the file
- `size_bytes` (integer, optional) — The size of the file in bytes
- `num_rows` (integer, optional) — The number of rows in the file
- `original_url` (string, optional) — The download url of the original file
- `samples` (list of string, optional) — The first few rows of the parsed file

### ParseInfo

- `separator` (string, optional)
- `delimiter` (string, optional)

### Metrics

- `finetune_dataset_metrics` (FinetuneDatasetMetrics, optional)

### FinetuneDatasetMetrics

- `trainable_token_count` (long, optional) — The number of tokens of valid examples that can be used for training.
- `total_examples` (long, optional) — The overall number of examples.
- `train_examples` (long, optional) — The number of training examples.
- `train_size_bytes` (long, optional) — The size in bytes of all training examples.
- `eval_examples` (long, optional) — Number of evaluation examples.
- `eval_size_bytes` (long, optional) — The size in bytes of all eval examples.
- `reranker_data_metrics` (RerankerDataMetrics, optional)
- `chat_data_metrics` (ChatDataMetrics, optional)
- `classify_data_metrics` (ClassifyDataMetrics, optional)

### RerankerDataMetrics

- `num_train_queries` (long, optional) — The number of training queries.
- `num_train_relevant_passages` (long, optional) — The sum of all relevant passages of valid training examples.
- `num_train_hard_negatives` (long, optional) — The sum of all hard negatives of valid training examples.
- `num_eval_queries` (long, optional) — The number of evaluation queries.
- `num_eval_relevant_passages` (long, optional) — The sum of all relevant passages of valid eval examples.
- `num_eval_hard_negatives` (long, optional) — The sum of all hard negatives of valid eval examples.

### ChatDataMetrics

- `num_train_turns` (long, optional) — The sum of all turns of valid train examples.
- `num_eval_turns` (long, optional) — The sum of all turns of valid eval examples.
- `preamble` (string, optional) — The preamble of this dataset.

### ClassifyDataMetrics

- `label_metrics` (list of LabelMetric, optional)

### LabelMetric

- `total_examples` (long, optional) — Total number of examples for this label
- `label` (string, optional) — value of the label
- `samples` (list of string, optional) — samples for this label

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "dataset": {
    "id": "dset-9f8b7c6a5e4d3f21",
    "name": "Customer Support Chat Logs",
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-04-10T12:45:00Z",
    "dataset_type": "chat-finetune-input",
    "validation_status": "validated",
    "validation_error": "",
    "schema": "{\"type\":\"record\",\"name\":\"ChatExample\",\"fields\":[{\"name\":\"context\",\"type\":\"string\"},{\"name\":\"response\",\"type\":\"string\"}]}",
    "required_fields": [
      "context",
      "response"
    ],
    "preserve_fields": [
      "metadata",
      "timestamp"
    ],
    "dataset_parts": [
      {
        "id": "part-001",
        "name": "chat_logs_jan.csv",
        "url": "https://storage.cohere.com/datasets/dset-9f8b7c6a5e4d3f21/part-001.csv",
        "index": 0,
        "size_bytes": 2048576,
        "num_rows": 15000,
        "original_url": "https://originalsource.com/chat_logs_jan.csv",
        "samples": [
          "{\"context\":\"Hello, I need help with my order.\",\"response\":\"Sure, can you provide your order ID?\"}",
          "{\"context\":\"My internet is not working.\",\"response\":\"Have you tried restarting your router?\"}"
        ]
      }
    ],
    "validation_warnings": [
      "Some rows contain missing timestamps",
      "Detected inconsistent newline characters"
    ],
    "parse_info": {},
    "metrics": {
      "finetune_dataset_metrics": {
        "trainable_token_count": 1250000,
        "total_examples": 15000,
        "train_examples": 12000,
        "train_size_bytes": 1800000,
        "eval_examples": 3000,
        "eval_size_bytes": 450000,
        "reranker_data_metrics": {
          "num_train_queries": 0,
          "num_train_relevant_passages": 0,
          "num_train_hard_negatives": 0,
          "num_eval_queries": 0,
          "num_eval_relevant_passages": 0,
          "num_eval_hard_negatives": 0
        },
        "chat_data_metrics": {
          "num_train_turns": 48000,
          "num_eval_turns": 12000,
          "preamble": "Customer support chat logs for fine-tuning chat models."
        },
        "classify_data_metrics": {
          "label_metrics": [
            {
              "total_examples": 15000,
              "label": "support",
              "samples": [
                "How do I reset my password?",
                "My shipment is delayed."
              ]
            }
          ]
        }
      }
    }
  }
}
```

**SDK Code**

```go Cohere Go SDK
package main

import (
	"context"
	"log"
	"os"

	client "github.com/cohere-ai/cohere-go/v2/client"
)

func main() {
	co := client.NewClient(client.WithToken(os.Getenv("CO_API_KEY")))

	resp, err := co.Datasets.Get(context.TODO(), "dataset_id")

	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%+v", resp)
}

```

```python Sync
import cohere

co = cohere.Client()

# get dataset
response = co.datasets.get(id="<<datasetId>>")

print(response)

```

```python Async
import cohere
import asyncio

co = cohere.AsyncClient()


async def main():
    response = await co.datasets.get(id="<<datasetId>>")

    print(response)


asyncio.run(main())

```

```java Cohere java SDK
/* (C)2024 */
import com.cohere.api.Cohere;
import com.cohere.api.resources.datasets.types.DatasetsGetResponse;

public class DatasetGet {
  public static void main(String[] args) {
    Cohere cohere = Cohere.builder().clientName("snippet").build();

    DatasetsGetResponse response = cohere.datasets().get("dataset_id");

    System.out.println(response);
  }
}

```

```typescript Cohere TypeScript SDK
import { CohereClient } from 'cohere-ai';

const cohere = new CohereClient({});

(async () => {
  const datasets = await cohere.datasets.get('<<datasetId>>');

  console.log(datasets);
})();

```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cohere.com/v1/datasets/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Client-Name"] = 'my-cool-project'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.cohere.com/v1/datasets/id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Client-Name' => 'my-cool-project',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cohere.com/v1/datasets/id");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Client-Name", "my-cool-project");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Client-Name": "my-cool-project",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cohere.com/v1/datasets/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```