# Bitrate & Transfer API
> Media, file-size and data-transfer maths as an API. The file-size endpoint relates bitrate, duration and file size: give any two and it computes the third — so you can find the size of a video at a given bitrate and length, the bitrate of a file of known size and length, or how long a file will play. The transfer-time endpoint computes how long a file takes to download or upload over a given bandwidth (with optional protocol overhead), or the bandwidth needed to move it within a target time. The storage endpoint works out how many hours of media at a bitrate, or how many items of a given size, fit in a storage capacity. Bitrates use decimal units (kbps, Mbps, Gbps) and sizes are reported in both decimal (KB/MB/GB/TB) and binary (KiB/MiB/GiB/TiB). Everything is computed locally and deterministically, so it is instant and private. Ideal for video and audio encoding, streaming and CDN planning, storage and backup sizing, and download-time estimates. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 4 endpoints. This is bitrate and transfer maths; for plain byte-unit conversion use a bytes API.

## 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/bitrate-api/..."
```

## Pricing
- **Free** (Free) — 8,435 calls/Mo, 2 req/s
- **Starter** ($10/Mo) — 17,950 calls/Mo, 8 req/s
- **Pro** ($30/Mo) — 230,500 calls/Mo, 20 req/s
- **Mega** ($68/Mo) — 1,195,000 calls/Mo, 50 req/s

## Endpoints

### Bitrate

#### `GET /v1/file-size` — Bitrate / duration / size

**Parameters:**
- `bitrate` (query, optional, string) — Value Example: `5`
- `bitrate_unit` (query, optional, string) — bps|kbps|Mbps|Gbps Example: `Mbps`
- `duration` (query, optional, string) — Seconds Example: `3600`
- `size` (query, optional, string) — Value
- `size_unit` (query, optional, string) — B|KB|MB|GB|TB Example: `MB`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitrate-api/v1/file-size?bitrate=5&bitrate_unit=Mbps&duration=3600&size_unit=MB"
```

**Response:**
```json
{
    "data": {
        "duration": {
            "hours": 1,
            "human": "1h 0m 0s",
            "minutes": 60,
            "seconds": 3600
        },
        "file_size": {
            "gb": 2.25,
            "kb": 2250000,
            "mb": 2250,
            "tb": 0.00225,
            "gib": 2.09548,
            "mib": 2145.77,
            "tib": 0.00204636,
            "bytes": 2250000000
        },
        "bitrate_bps": 5000000
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:04.126Z",
        "request_id": "46ae1b70-3c6a-4a9c-9475-7e6bd696098b"
    },
    "status": "ok",
    "message": "File size",
    "success": true
}
```

#### `GET /v1/storage` — Capacity: recording hours / item count

**Parameters:**
- `capacity` (query, required, string) — Value Example: `1`
- `capacity_unit` (query, optional, string) — GB|TB Example: `TB`
- `bitrate` (query, optional, string) — For recording time Example: `5`
- `item_size` (query, optional, string) — For item count

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitrate-api/v1/storage?capacity=1&capacity_unit=TB&bitrate=5"
```

**Response:**
```json
{
    "data": {
        "capacity": {
            "gb": 1000,
            "kb": 1000000000,
            "mb": 1000000,
            "tb": 1,
            "gib": 931.323,
            "mib": 953674,
            "tib": 0.909495,
            "bytes": 1000000000000
        },
        "bitrate_bps": 5000000,
        "recording_time": {
            "hours": 444.444,
            "human": "444h 26m 40s",
            "minutes": 26666.7,
            "seconds": 1600000
        }
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:04.228Z",
        "request_id": "b92d548b-8cd0-4b99-b961-87662aa2b5a5"
    },
    "status": "ok",
    "message": "Storage",
    "success": true
}
```

#### `GET /v1/transfer-time` — Download / upload time

**Parameters:**
- `size` (query, required, string) — Value Example: `1`
- `size_unit` (query, optional, string) — unit Example: `GB`
- `bandwidth` (query, optional, string) — Speed Example: `100`
- `bandwidth_unit` (query, optional, string) — Mbps Example: `Mbps`
- `time` (query, optional, string) — Or target seconds

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitrate-api/v1/transfer-time?size=1&size_unit=GB&bandwidth=100&bandwidth_unit=Mbps"
```

**Response:**
```json
{
    "data": {
        "file_size": {
            "gb": 1,
            "kb": 1000000,
            "mb": 1000,
            "tb": 0.001,
            "gib": 0.931323,
            "mib": 953.674,
            "tib": 0.000909495,
            "bytes": 1000000000
        },
        "bandwidth_bps": 100000000,
        "transfer_time": {
            "hours": 0.0222222,
            "human": "1m 20s",
            "minutes": 1.33333,
            "seconds": 80
        },
        "overhead_percent": 0
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:04.305Z",
        "request_id": "f84ca3f9-7910-461a-afa8-d1ac85b8a9b5"
    },
    "status": "ok",
    "message": "Transfer time",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

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

**Response:**
```json
{
    "data": {
        "name": "Bitrate & Transfer API",
        "notes": "Bitrates are decimal (1 Mbps = 1,000,000 bits/s); 8 bits = 1 byte. Sizes shown in decimal and binary units. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/file-size",
                "params": {
                    "size": "value",
                    "bitrate": "value",
                    "duration": "seconds",
                    "size_unit": "B|KB|MB|GB|TB|MiB|GiB (give any two)",
                    "bitrate_unit": "bps|kbps|Mbps|Gbps"
                },
                "returns": "the missing one of bitrate/duration/size"
            },
            {
                "path": "/v1/transfer-time",
                "params": {
                    "size": "value",
                    "time": "or a target time in s",
                    "bandwidth": "speed",
                    "size_unit": "…",
                    "bandwidth_unit": "Mbps",
                    "overhead_percent": "optional"
                },
                "returns": "the transfer time (or required bandwidth)"
            },
            {
                "path": "/v1/storage",
                "params": {
                    "bitrate": "for recording time",
                    "capacity": "value",
                    "item_size": "for item count",
                    "capacity_unit": "GB"
                },
                "returns": "recording hours or item count"
   
…(truncated, see openapi.json for full schema)
```


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