crates.io Index API

Per-crate index metadata files served over HTTP

Operations 4

GET /1/{crate} Get Index For One-Character Crate #
GET /2/{crate} Get Index For Two-Character Crate #
GET /3/{first}/{crate} Get Index For Three-Character Crate #
GET /{first_two}/{second_two}/{crate} Get Index For Four-Plus-Character Crate #

Documentation

Specifications

Schemas & Data

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/crates-io-index-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

crates-io-index-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: crates.io Sparse Index API
  description: 'The crates.io sparse index serves per-crate metadata files over HTTP rather than requiring a clone of the legacy crates.io-index Git repository. Cargo uses the sparse protocol by default since Rust 1.70 (June 2023). The index also publishes a config.json document at the root and supports HTTP cache validation via ETag and Last-Modified.

    '
  version: v1
  contact:
    name: crates.io Team
    email: help@crates.io
    url: https://crates.io
  license:
    name: Cargo Documentation (MIT/Apache-2.0)
    url: https://doc.rust-lang.org/cargo/reference/registry-index.html
servers:
- url: https://index.crates.io
  description: crates.io Sparse Index (sparse+https://index.crates.io/)
tags:
- name: Index
  description: Per-crate index metadata files served over HTTP
paths:
  /1/{crate}:
    get:
      summary: Get Index For One-Character Crate
      description: Returns the newline-delimited JSON index entries for a single-character crate name (e.g. /1/a).
      operationId: getIndexOneChar
      tags:
      - Index
      parameters:
      - name: crate
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 1
      responses:
        '200':
          description: Newline-delimited JSON index entries.
          content:
            text/plain:
              schema:
                type: string
        '304':
          description: Not modified (ETag/If-None-Match match).
        '404':
          description: Crate not found.
  /2/{crate}:
    get:
      summary: Get Index For Two-Character Crate
      description: Returns the newline-delimited JSON index entries for a two-character crate name (e.g. /2/io).
      operationId: getIndexTwoChar
      tags:
      - Index
      parameters:
      - name: crate
        in: path
        required: true
        schema:
          type: string
          minLength: 2
          maxLength: 2
      responses:
        '200':
          description: Newline-delimited JSON index entries.
          content:
            text/plain:
              schema:
                type: string
        '304':
          description: Not modified.
        '404':
          description: Crate not found.
  /3/{first}/{crate}:
    get:
      summary: Get Index For Three-Character Crate
      description: Returns the newline-delimited JSON index entries for a three-character crate name. Path uses the first character as a directory (e.g. /3/r/rng).
      operationId: getIndexThreeChar
      tags:
      - Index
      parameters:
      - name: first
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 1
      - name: crate
        in: path
        required: true
        schema:
          type: string
          minLength: 3
          maxLength: 3
      responses:
        '200':
          description: Newline-delimited JSON index entries.
          content:
            text/plain:
              schema:
                type: string
        '304':
          description: Not modified.
        '404':
          description: Crate not found.
  /{first_two}/{second_two}/{crate}:
    get:
      summary: Get Index For Four-Plus-Character Crate
      description: 'Returns the newline-delimited JSON index entries for a crate with four or more characters. Path uses the first two characters as the first directory and characters three and four as the second directory (e.g. /se/rd/serde for "serde", /to/ki/tokio for "tokio").

        '
      operationId: getIndexLong
      tags:
      - Index
      parameters:
      - name: first_two
        in: path
        required: true
        schema:
          type: string
          minLength: 2
          maxLength: 2
      - name: second_two
        in: path
        required: true
        schema:
          type: string
          minLength: 2
          maxLength: 2
      - name: crate
        in: path
        required: true
        schema:
          type: string
          minLength: 4
      responses:
        '200':
          description: Newline-delimited JSON index entries.
          content:
            text/plain:
              schema:
                type: string
              example: '{"name":"serde","vers":"1.0.0","deps":[],"cksum":"...","features":{},"yanked":false,"v":2}

                {"name":"serde","vers":"1.0.1","deps":[],"cksum":"...","features":{},"yanked":false,"v":2}

                '
        '304':
          description: Not modified.
        '404':
          description: Crate not found.