crates.io Index API

Per-crate index metadata files served over HTTP

GitHub OpenAPI

Operations 4

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /1/{crate} Get the index for a one-letter crate · Get Index For One-Character Crate #
Ask an LLM
“How do I read the index entries for a single-character crate like a or z?”
“What does the sparse index return for a one-letter crate name?”
Tell an agent
Get the index for one-letter crate {crate}.
Read the sparse index entries for crate {crate}.
GET /2/{crate} Get the index for a two-character crate · Get Index For Two-Character Crate #
Ask an LLM
“What does the sparse index contain for a crate whose name is only two characters?”
“Where are the index lines for a short two-letter crate?”
Tell an agent
Get the sparse index for the two-character crate {crate}.
Show the index lines of {crate}.
GET /3/{first}/{crate} Get the index for a three-letter crate · Get Index For Three-Character Crate #
Ask an LLM
“How do I read the index for a three-letter crate name?”
“What does the sparse index return for a three-character crate like rng?”
Tell an agent
Get the index for three-letter crate {crate} under first letter {first}.
Read the sparse index entries for crate {crate} starting with {first}.
GET /{first_two}/{second_two}/{crate} Get the index for a long crate name · Get Index For Four-Plus-Character Crate #
Ask an LLM
“How do I read the sparse index entries for a crate longer than four characters?”
“What path do long crate names use in the sparse index?”
Tell an agent
Get the sparse index entries for {first_two}/{second_two}/{crate}.
Show the index lines of crate {crate} under folder {first_two} {second_two}.

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:crates-io-index-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. 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.