# 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"
```

#### `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"
```

### Meta

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

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


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