Hugging Face Data Access API

Row-level data access and preview endpoints

Operations 2

GET /first-rows Get First Rows of a Split #
GET /rows Get a Slice of Rows #

Documentation

Specifications

SDKs

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/hugging-face-data-access-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

hugging-face-data-access-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Hugging Face Dataset Viewer Data Access API
  description: Query and visualize datasets stored on the Hugging Face Hub through a lightweight REST API. Get dataset splits, preview rows, search and filter data, access Parquet files, retrieve size statistics, and obtain Croissant metadata - all without downloading the entire dataset.
  version: 1.0.0
  termsOfService: https://huggingface.co/terms-of-service
  contact:
    name: Hugging Face Support
    url: https://huggingface.co/support
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://datasets-server.huggingface.co
  description: Hugging Face Dataset Viewer production server
security:
- {}
- bearerAuth: []
tags:
- name: Data Access
  description: Row-level data access and preview endpoints
paths:
  /first-rows:
    get:
      summary: Get First Rows of a Split
      description: Get the first 100 rows of a dataset split. Useful for previewing data structure and content.
      operationId: getFirstRows
      tags:
      - Data Access
      parameters:
      - name: dataset
        in: query
        required: true
        description: The dataset ID
        schema:
          type: string
        example: squad
      - name: config
        in: query
        required: true
        description: The subset (configuration) name
        schema:
          type: string
        example: plain_text
      - name: split
        in: query
        required: true
        description: The split name
        schema:
          type: string
        example: train
      responses:
        '200':
          description: First rows of the dataset split
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RowsResponse'
              examples:
                Getfirstrows200Example:
                  summary: Default getFirstRows 200 response
                  x-microcks-default: true
                  value:
                    features:
                    - feature_idx: 10
                      name: Example Title
                      type:
                        dtype: example_value
                        _type: example_value
                    rows:
                    - row_idx: 10
                      row: example_value
                      truncated_cells:
                      - {}
                    num_rows_total: 10
                    num_rows_per_page: 10
                    partial: true
        '400':
          description: Bad request - missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Getfirstrows400Example:
                  summary: Default getFirstRows 400 response
                  x-microcks-default: true
                  value:
                    error: example_value
                    cause_exception: example_value
                    cause_message: example_value
                    cause_traceback:
                    - example_value
        '404':
          description: Dataset, config, or split not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Getfirstrows404Example:
                  summary: Default getFirstRows 404 response
                  x-microcks-default: true
                  value:
                    error: example_value
                    cause_exception: example_value
                    cause_message: example_value
                    cause_traceback:
                    - example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /rows:
    get:
      summary: Get a Slice of Rows
      description: Get a slice of rows from a dataset split with pagination support. Returns up to 100 rows per request.
      operationId: getRows
      tags:
      - Data Access
      parameters:
      - name: dataset
        in: query
        required: true
        description: The dataset ID
        schema:
          type: string
        example: squad
      - name: config
        in: query
        required: true
        description: The subset (configuration) name
        schema:
          type: string
        example: plain_text
      - name: split
        in: query
        required: true
        description: The split name
        schema:
          type: string
        example: train
      - name: offset
        in: query
        required: false
        description: Row offset to start from
        schema:
          type: integer
          default: 0
          minimum: 0
        example: 10
      - name: length
        in: query
        required: false
        description: Number of rows to return (max 100)
        schema:
          type: integer
          default: 100
          maximum: 100
          minimum: 1
        example: 10
      responses:
        '200':
          description: Slice of rows from the dataset
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RowsResponse'
              examples:
                Getrows200Example:
                  summary: Default getRows 200 response
                  x-microcks-default: true
                  value:
                    features:
                    - feature_idx: 10
                      name: Example Title
                      type:
                        dtype: example_value
                        _type: example_value
                    rows:
                    - row_idx: 10
                      row: example_value
                      truncated_cells:
                      - {}
                    num_rows_total: 10
                    num_rows_per_page: 10
                    partial: true
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Getrows400Example:
                  summary: Default getRows 400 response
                  x-microcks-default: true
                  value:
                    error: example_value
                    cause_exception: example_value
                    cause_message: example_value
                    cause_traceback:
                    - example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: example_value
        cause_exception:
          type: string
          description: Underlying exception type
          example: example_value
        cause_message:
          type: string
          description: Underlying exception message
          example: example_value
        cause_traceback:
          type: array
          items:
            type: string
          description: Stack trace (only in development)
          example: []
    RowsResponse:
      type: object
      properties:
        features:
          type: array
          items:
            type: object
            properties:
              feature_idx:
                type: integer
                description: Feature index
              name:
                type: string
                description: Column name
              type:
                type: object
                description: Column data type information
                properties:
                  dtype:
                    type: string
                  _type:
                    type: string
          description: Column definitions and types
          example: []
        rows:
          type: array
          items:
            type: object
            properties:
              row_idx:
                type: integer
                description: Row index in the split
              row:
                type: object
                additionalProperties: true
                description: Row data as key-value pairs
              truncated_cells:
                type: array
                items:
                  type: string
                description: List of cell names that were truncated
          description: Row data
          example: []
        num_rows_total:
          type: integer
          description: Total number of rows in the split
          example: 10
        num_rows_per_page:
          type: integer
          description: Number of rows per page
          example: 10
        partial:
          type: boolean
          description: Whether this is a partial result
          example: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: HF Token
      description: Optional Hugging Face API token. Required for private and gated datasets.