# Rust Crates API
> The crates.io registry — home of the Rust ecosystem — as an API. Look up any Rust crate for its description, latest and recent versions, total and recent download counts, license, repository, documentation and homepage links, keywords and categories; search and rank the whole registry by relevance, downloads, recent downloads, recent updates or newest; and inspect the dependency tree of a crate's newest (or any) version. Live from the official crates.io API. Ideal for package dashboards, dependency tooling, security/supply-chain analysis, developer portals and Rust ecosystem analytics. Open data from crates.io.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/crates-api/..."
```

## Pricing
- **Free** (Free) — 3,550 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 48,500 calls/Mo, 8 req/s
- **Pro** ($12/Mo) — 238,500 calls/Mo, 20 req/s
- **Mega** ($33/Mo) — 1,196,000 calls/Mo, 50 req/s

## Endpoints

### Crates

#### `GET /v1/crate` — Full metadata for a crate

**Parameters:**
- `name` (query, required, string) — Crate name, e.g. serde, tokio Example: `serde`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/crates-api/v1/crate?name=serde"
```

**Response:**
```json
{
    "data": {
        "crate": {
            "name": "serde",
            "homepage": "https://serde.rs",
            "keywords": [
                "no_std",
                "serde",
                "serialization"
            ],
            "downloads": 1038977678,
            "categories": [
                "no-std::no-alloc",
                "no-std",
                "encoding"
            ],
            "created_at": "2014-12-05T20:20:39.487502Z",
            "repository": "https://github.com/serde-rs/serde",
            "updated_at": "2025-09-27T16:51:35.265429Z",
            "description": "A generic serialization/deserialization framework",
            "crates_io_url": "https://crates.io/crates/serde",
            "documentation": "https://docs.rs/serde",
            "newest_version": "1.0.228",
            "recent_downloads": 195730353,
            "max_stable_version": "1.0.228"
        },
        "recent_versions": [
            {
                "num": "1.0.228",
                "yanked": false,
                "license": "MIT OR Apache-2.0",
                "downloads": 249111895,
                "created_at": "2025-09-27T16:51:35.265429Z",
                "rust_version": "1.56"
            },
            {
                "num": "1.0.227",
                "yanked": false,
                "license": "MIT OR Apache-2.0",
                "downloads": 1600935,
                "created_at": "2025-09-25T23:43:08.742811Z",
                "rust_version": "1.56"
      
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/dependencies` — Dependencies of a crate's version

**Parameters:**
- `name` (query, required, string) — Crate name, e.g. tokio Example: `tokio`
- `version` (query, optional, string) — Version (default: newest)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/crates-api/v1/dependencies?name=tokio"
```

**Response:**
```json
{
    "data": {
        "count": 36,
        "crate": "tokio",
        "version": "1.52.3",
        "dependencies": [
            {
                "req": "^0.3",
                "kind": "dev",
                "crate": "async-stream",
                "optional": false,
                "default_features": true
            },
            {
                "req": "^0.3.58",
                "kind": "dev",
                "crate": "backtrace",
                "optional": false,
                "default_features": true
            },
            {
                "req": "^0.3.0",
                "kind": "dev",
                "crate": "futures",
                "optional": false,
                "default_features": true
            },
            {
                "req": "^7.6.3",
                "kind": "dev",
                "crate": "futures-concurrency",
                "optional": false,
                "default_features": true
            },
            {
                "req": "^0.3.31",
                "kind": "dev",
                "crate": "futures-test",
                "optional": false,
                "default_features": true
            },
            {
                "req": "^0.2.168",
                "kind": "dev",
                "crate": "libc",
                "optional": false,
                "default_features": true
            },
            {
                "req": "^0.7",
                "kind": "dev",
                "crate": "loom",
                "opt
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/search` — Search / rank the registry

**Parameters:**
- `q` (query, optional, string) — Search term Example: `http`
- `sort` (query, optional, string) — relevance | downloads | recent-downloads | recent-updates | new | alpha
- `limit` (query, optional, string) — Results per page (1-100, default 20) Example: `20`
- `page` (query, optional, string) — Page number Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/crates-api/v1/search?q=http&limit=20&page=1"
```

**Response:**
```json
{
    "data": {
        "page": 1,
        "sort": "relevance",
        "count": 20,
        "limit": 20,
        "query": "http",
        "total": 17149,
        "results": [
            {
                "name": "http",
                "homepage": null,
                "keywords": [],
                "downloads": 736312657,
                "categories": [],
                "created_at": "2014-11-20T23:30:38.809367Z",
                "repository": "https://github.com/hyperium/http",
                "updated_at": "2026-05-25T19:27:52.247144Z",
                "description": "A set of types for representing HTTP requests and responses.\n",
                "crates_io_url": "https://crates.io/crates/http",
                "documentation": "https://docs.rs/http",
                "newest_version": "1.4.1",
                "recent_downloads": 171043657,
                "max_stable_version": "1.4.1"
            },
            {
                "name": "tigr_asgi_contract_artifacts_rs",
                "homepage": null,
                "keywords": [],
                "downloads": 117,
                "categories": [],
                "created_at": "2026-04-21T05:49:07.570398Z",
                "repository": null,
                "updated_at": "2026-04-24T08:18:20.727497Z",
                "description": "Canonical contract artifacts for the Tigr ASGI contract",
                "crates_io_url": "https://crates.io/crates/tigr_asgi_contract_artifacts_rs",
                "documentation"
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Source & sort options

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/crates-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "Live Rust crate registry data. /v1/crate = full metadata + recent versions + download counts for a crate; /v1/search = search/rank the registry (sort by downloads, recent-downloads, recent-updates, new, alpha); /v1/dependencies = the dependencies of a crate's newest (or a given) version.",
        "source": "crates.io (the Rust community crate registry)",
        "endpoints": [
            "/v1/crate",
            "/v1/search",
            "/v1/dependencies",
            "/v1/meta"
        ],
        "sort_options": [
            "relevance",
            "downloads",
            "recent-downloads",
            "recent-updates",
            "new",
            "alpha"
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T10:14:06.320Z",
        "request_id": "a2e3127f-7657-4617-bd89-21fc36aaa150"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/crates-api
OpenAPI spec: https://www.oanor.com/api/crates-api/openapi.json
