# Snowflake ID API
> Decode and build snowflake IDs — the 64-bit, time-sortable identifiers used by Twitter/X, Discord, Instagram and many distributed systems. Pass an ID and a platform and the service extracts the embedded creation timestamp (turn any Discord, Twitter/X or Instagram ID into the exact moment it was created) along with the machine and sequence components for that platform's epoch and bit layout. Supported platforms: twitter (X), discord, instagram, sony, and custom (supply your own epoch). The encode endpoint does the reverse: build the lower-bound snowflake for a given timestamp, so you can query "all IDs created at or after this moment" — the standard trick for time-based pagination on snowflake APIs. Everything is computed locally with exact 64-bit BigInt math and no network calls. Ideal for analytics, data forensics, API pagination and debugging distributed-ID systems. A snowflake-ID toolkit — distinct from UUID/ULID generation (uuid) and date/time math (datetime). No upstream key, no cache.

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

## Pricing
- **Free** (Free) — 2,160 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 42,000 calls/Mo, 8 req/s
- **Pro** ($21/Mo) — 220,000 calls/Mo, 20 req/s
- **Mega** ($54/Mo) — 830,000 calls/Mo, 50 req/s

## Endpoints

### Snowflake

#### `GET /v1/decode` — Decode a snowflake ID

**Parameters:**
- `id` (query, required, string) — Snowflake ID Example: `175928847299117063`
- `platform` (query, optional, string) — twitter, discord, instagram, sony, custom Example: `discord`
- `epoch` (query, optional, string) — Custom epoch (unix ms) when platform=custom

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/snowflake-api/v1/decode?id=175928847299117063&platform=discord"
```

**Response:**
```json
{
    "data": {
        "id": "175928847299117063",
        "epoch_ms": 1420070400000,
        "platform": "discord",
        "components": {
            "increment": 7,
            "worker_id": 1,
            "process_id": 0
        },
        "timestamp_ms": 1462015105796,
        "timestamp_iso": "2016-04-30T11:18:25.796Z"
    },
    "meta": {
        "timestamp": "2026-06-01T23:40:44.027Z",
        "request_id": "ba60688a-2c85-4ff0-94f4-4aa1123a513d"
    },
    "status": "ok",
    "message": "Snowflake decoded",
    "success": true
}
```

#### `GET /v1/encode` — Build a snowflake for a time

**Parameters:**
- `timestamp` (query, required, string) — ISO 8601 or unix time Example: `2024-01-01T00:00:00Z`
- `platform` (query, optional, string) — twitter, discord, instagram, sony, custom Example: `twitter`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/snowflake-api/v1/encode?timestamp=2024-01-01T00%3A00%3A00Z&platform=twitter"
```

**Response:**
```json
{
    "data": {
        "note": "lower-bound id (machine & sequence fields zeroed) — use for 'IDs created at/after this time' queries",
        "platform": "twitter",
        "snowflake": "1741610183685046272",
        "timestamp_ms": 1704067200000,
        "timestamp_iso": "2024-01-01T00:00:00.000Z"
    },
    "meta": {
        "timestamp": "2026-06-01T23:40:44.130Z",
        "request_id": "799c1c43-c9aa-439f-ae57-556ba1e92ca8"
    },
    "status": "ok",
    "message": "Snowflake built",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Platform epochs & layouts

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

**Response:**
```json
{
    "data": {
        "note": "Decode and build snowflake IDs — the 64-bit, time-sortable identifiers used by Twitter/X, Discord, Instagram and many distributed systems. /v1/decode?id=175928847299117063&platform=discord extracts the embedded creation timestamp (the headline use — turn any Discord/Twitter/Instagram ID into the exact moment it was created) plus the machine and sequence components for the chosen platform's epoch and bit layout. Supported platforms: twitter (X), discord, instagram, sony, and custom (pass your own epoch). /v1/encode?timestamp=2024-01-01T00:00:00Z&platform=twitter builds the lower-bound snowflake for a time, so you can query 'all IDs created at or after this moment' — the standard trick for time-based pagination on snowflake APIs. Everything is computed locally with BigInt math and no network calls. Ideal for analytics, data forensics, API pagination and debugging. A snowflake-ID toolkit — distinct from UUID/ULID generation (uuid) and date/time math (datetime). No key, no cache.",
        "endpoints": [
            "/v1/decode",
            "/v1/encode",
            "/v1/meta"
        ],
        "platforms": {
            "sony": {
                "fields": [
                    "worker_id(10b)",
                    "sequence(12b)"
                ],
                "epoch_ms": 1420070400000,
                "epoch_iso": "2015-01-01T00:00:00.000Z"
            },
            "discord": {
                "fields": [
                    "wor
…(truncated, see openapi.json for full schema)
```


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