# 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

## OpenAPI Specification

```yaml
openapi: 3.1.1
info:
  title: Get a Dataset
  version: endpoint_datasets.get
paths:
  /v1/datasets/{id}:
    get:
      operationId: get
      summary: Get a Dataset
      description: >-
        Retrieve a dataset by ID. See
        ['Datasets'](https://docs.cohere.com/docs/datasets) for more
        information.
      tags:
        - - subpackage_datasets
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: >-
            Bearer authentication of the form `Bearer <token>`, where token is
            your auth token.
          required: true
          schema:
            type: string
        - name: X-Client-Name
          in: header
          description: |
            The name of the project that is making the request.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/datasets_get_Response_200'
        '400':
          description: >
            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
          content: {}
        '401':
          description: >
            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
          content: {}
        '403':
          description: >
            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
          content: {}
        '404':
          description: >
            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
          content: {}
        '422':
          description: >
            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
          content: {}
        '429':
          description: Too many requests
          content: {}
        '498':
          description: >
            This error is returned when a request or response contains a
            deny-listed token.
          content: {}
        '499':
          description: |
            This error is returned when a request is cancelled by the user.
          content: {}
        '500':
          description: >
            This error is returned when an uncategorised internal server error
            occurs.
          content: {}
        '501':
          description: >
            This error is returned when the requested feature is not
            implemented.
          content: {}
        '503':
          description: >
            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
          content: {}
        '504':
          description: >
            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
          content: {}
components:
  schemas:
    DatasetType:
      type: string
      enum:
        - value: embed-input
        - value: embed-result
        - value: cluster-result
        - value: cluster-outliers
        - value: reranker-finetune-input
        - value: single-label-classification-finetune-input
        - value: chat-finetune-input
        - value: multi-label-classification-finetune-input
        - value: batch-chat-input
        - value: batch-openai-chat-input
        - value: batch-embed-v2-input
        - value: batch-chat-v2-input
    DatasetValidationStatus:
      type: string
      enum:
        - value: unknown
        - value: queued
        - value: processing
        - value: failed
        - value: validated
        - value: skipped
    DatasetPart:
      type: object
      properties:
        id:
          type: string
          description: The dataset part ID
        name:
          type: string
          description: The name of the dataset part
        url:
          type: string
          description: The download url of the file
        index:
          type: integer
          description: The index of the file
        size_bytes:
          type: integer
          description: The size of the file in bytes
        num_rows:
          type: integer
          description: The number of rows in the file
        original_url:
          type: string
          description: The download url of the original file
        samples:
          type: array
          items:
            type: string
          description: The first few rows of the parsed file
      required:
        - id
        - name
    ParseInfo:
      type: object
      properties:
        separator:
          type: string
        delimiter:
          type: string
    RerankerDataMetrics:
      type: object
      properties:
        num_train_queries:
          type: integer
          format: int64
          description: The number of training queries.
        num_train_relevant_passages:
          type: integer
          format: int64
          description: The sum of all relevant passages of valid training examples.
        num_train_hard_negatives:
          type: integer
          format: int64
          description: The sum of all hard negatives of valid training examples.
        num_eval_queries:
          type: integer
          format: int64
          description: The number of evaluation queries.
        num_eval_relevant_passages:
          type: integer
          format: int64
          description: The sum of all relevant passages of valid eval examples.
        num_eval_hard_negatives:
          type: integer
          format: int64
          description: The sum of all hard negatives of valid eval examples.
    ChatDataMetrics:
      type: object
      properties:
        num_train_turns:
          type: integer
          format: int64
          description: The sum of all turns of valid train examples.
        num_eval_turns:
          type: integer
          format: int64
          description: The sum of all turns of valid eval examples.
        preamble:
          type: string
          description: The preamble of this dataset.
    LabelMetric:
      type: object
      properties:
        total_examples:
          type: integer
          format: int64
          description: Total number of examples for this label
        label:
          type: string
          description: value of the label
        samples:
          type: array
          items:
            type: string
          description: samples for this label
    ClassifyDataMetrics:
      type: object
      properties:
        label_metrics:
          type: array
          items:
            $ref: '#/components/schemas/LabelMetric'
    FinetuneDatasetMetrics:
      type: object
      properties:
        trainable_token_count:
          type: integer
          format: int64
          description: >-
            The number of tokens of valid examples that can be used for
            training.
        total_examples:
          type: integer
          format: int64
          description: The overall number of examples.
        train_examples:
          type: integer
          format: int64
          description: The number of training examples.
        train_size_bytes:
          type: integer
          format: int64
          description: The size in bytes of all training examples.
        eval_examples:
          type: integer
          format: int64
          description: Number of evaluation examples.
        eval_size_bytes:
          type: integer
          format: int64
          description: The size in bytes of all eval examples.
        reranker_data_metrics:
          $ref: '#/components/schemas/RerankerDataMetrics'
        chat_data_metrics:
          $ref: '#/components/schemas/ChatDataMetrics'
        classify_data_metrics:
          $ref: '#/components/schemas/ClassifyDataMetrics'
    Metrics:
      type: object
      properties:
        finetune_dataset_metrics:
          $ref: '#/components/schemas/FinetuneDatasetMetrics'
    Dataset:
      type: object
      properties:
        id:
          type: string
          description: The dataset ID
        name:
          type: string
          description: The name of the dataset
        created_at:
          type: string
          format: date-time
          description: The creation date
        updated_at:
          type: string
          format: date-time
          description: The last update date
        dataset_type:
          $ref: '#/components/schemas/DatasetType'
        validation_status:
          $ref: '#/components/schemas/DatasetValidationStatus'
        validation_error:
          type: string
          description: Errors found during validation
        schema:
          type: string
          description: the avro schema of the dataset
        required_fields:
          type: array
          items:
            type: string
        preserve_fields:
          type: array
          items:
            type: string
        dataset_parts:
          type: array
          items:
            $ref: '#/components/schemas/DatasetPart'
          description: the underlying files that make up the dataset
        validation_warnings:
          type: array
          items:
            type: string
          description: warnings found during validation
        parse_info:
          $ref: '#/components/schemas/ParseInfo'
        metrics:
          $ref: '#/components/schemas/Metrics'
      required:
        - id
        - name
        - created_at
        - updated_at
        - dataset_type
        - validation_status
    datasets_get_Response_200:
      type: object
      properties:
        dataset:
          $ref: '#/components/schemas/Dataset'
      required:
        - dataset

```

## SDK Code Examples

```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()