Skip to content

For developers

Build against the TVNID API.

Generate, convert, and validate identifiers over plain HTTP. The public API requires no API key, authentication, or account registration. The base URL is https://tvnid.dev/api/v1.

9 sections

Start

What the API does

TVNID provides one identifier in two representations. The Numeric ID is an 8-byte integer for storage and indexing. The Visual ID is a 12-character alphanumeric identifier for interfaces, URLs, logs, and messages. Every newly generated Visual ID starts with a lowercase letter and contains at least one digit. This rule applies to /generate; supported Format v1 conversions remain compatible. Both representations identify the same record and convert exactly. In JSON, the Visual ID travels in the visual_id field; that name is kept for compatibility.

Numeric ID

Machine-oriented representation

27684557326419404

Decimal digits

  • 8-byte integer, stored as a BIGINT
  • Native integer primary keys, indexes, sorting, and lookups
  • Sent as a decimal string in JSON (wire field numeric_id)
Exact conversion, no lookup table

Visual ID

Human- and agent-readable reference

469pb6g35qme

Lowercase letters and digits

  • 12-character alphanumeric identifier for interfaces, URLs, logs, and messages
  • Converts exactly to its Numeric ID through the API
  • Wire field visual_id, kept for compatibility
One identifier, two representations. Store the Numeric ID and use the Visual ID when people or agents need a readable reference. The example pair illustrates conversion only; it is not an issued ID.

Start

Base URL, access, and API keys

Published API base URL: https://tvnid.dev/api/v1. The public API requires no authentication, API key, or account registration. API keys are not issued or enforced; managed accounts and authenticated key management are under development. Do not send credentials, tokens, or Authorization headers.

API access
Open, rate limited
API key issuance
Not available
API key enforcement
Not enforced
Account sign-in
Not available

HTTP API

Endpoints

Six POST operations and two GET resources. Request bodies are JSON with Content-Type: application/json. Numeric IDs are always decimal strings in JSON, in both requests and responses. The inspect endpoints return timestamp information computed by the API, including for batches of up to 1000 Numeric IDs.

MethodPathBodyReturns
POST/api/v1/generate{ "count": 1 to 1000 }{ ids: [{ numeric_id, visual_id }], count, api_version, format_version }
POST/api/v1/convert/to-visual{ "numeric_id": "<decimal string>" }{ numeric_id, visual_id }
POST/api/v1/convert/to-numeric{ "visual_id": "<12 characters>" }{ numeric_id, visual_id }
POST/api/v1/validate{ "value": "<Numeric ID or Visual ID>" }{ valid, message, format_version }
POST/api/v1/inspect{ "value": "<Numeric ID or Visual ID>" }{ numeric_id, visual_id, timestamp_ns, datetime_utc, format_version, valid }
POST/api/v1/inspect/batch{ "numeric_ids": [1 to 1000 decimal strings] }{ items: [timestamp details in request order] }
GET/api/v1/specNo bodyMachine-readable service description
GET/api/healthzNo body{ status }

HTTP API

Request examples

Generate, convert in both directions, validate, and read the service description and health. The example pair 27684557326419404 / 469pb6g35qme illustrates conversion; it is not an issued ID.

shell / curl
# No credentials are required; do not send them.
API_BASE="https://tvnid.dev/api/v1"

curl -sS -X POST "$API_BASE/generate" \
  -H "Content-Type: application/json" -d '{"count": 1}'

curl -sS -X POST "$API_BASE/convert/to-visual" \
  -H "Content-Type: application/json" -d '{"numeric_id": "27684557326419404"}'

curl -sS -X POST "$API_BASE/convert/to-numeric" \
  -H "Content-Type: application/json" -d '{"visual_id": "469pb6g35qme"}'

curl -sS -X POST "$API_BASE/validate" \
  -H "Content-Type: application/json" -d '{"value": "469pb6g35qme"}'

curl -sS -X POST "$API_BASE/inspect" \
  -H "Content-Type: application/json" -d '{"value": "28693394859722295"}'

curl -sS -X POST "$API_BASE/inspect/batch" \
  -H "Content-Type: application/json" -d '{"numeric_ids": ["28693394859722295"]}'

curl -sS "$API_BASE/spec"
curl -sS "https://tvnid.dev/api/healthz"
python / requests over HTTP
import time, requests

API_BASE = "https://tvnid.dev/api/v1"

def post(path, body, retry_503=False, attempts=4):
    for attempt in range(attempts):
        r = requests.post(f"{API_BASE}{path}", json=body, timeout=10)
        retryable = r.status_code == 429 or (r.status_code == 503 and retry_503)
        if retryable and attempt < attempts - 1:
            wait = max(0, float(r.headers.get("Retry-After", 2 ** attempt)))
            if wait > 120:
                r.raise_for_status()  # stop rather than retry before Retry-After
            time.sleep(wait)
            continue
        r.raise_for_status()  # 400 and 413: fix the request, do not retry unchanged
        return r.json()

# Do not retry /generate automatically after 503 or timeout; it is not idempotent.
# A 429 is rejected before the operation, so waiting for Retry-After is safe.
pair = post("/generate", {"count": 1})["ids"][0]
numeric_id = int(pair["numeric_id"])   # store this (BIGINT)
visual_id = pair["visual_id"]           # wire field for the Visual ID

back = post("/convert/to-numeric", {"visual_id": visual_id}, retry_503=True)
assert int(back["numeric_id"]) == numeric_id

HTTP API

Response shapes

Generate returns ids, count, api_version, and format_version. Each generated visual_id starts with a lowercase letter and contains at least one digit; conversion endpoints return the exact Format v1 pair, which can begin with a digit. Inspect returns timestamp fields; validate reports format only and does not prove an ID was issued.

json
# POST /api/v1/generate (values vary per call)
{"ids":[{"numeric_id":"<decimal string>","visual_id":"<12-character Visual ID>"}],"count":1,"api_version":"v1","format_version":1}

# POST /api/v1/convert/to-visual and /convert/to-numeric
{"numeric_id":"27684557326419404","visual_id":"469pb6g35qme"}

# POST /api/v1/validate
{"valid":true,"message":"Valid format does not prove issuance.","format_version":1}

# POST /api/v1/inspect
{"numeric_id":"<decimal string>","visual_id":"<12-character Visual ID>","timestamp_ns":"<Unix nanoseconds>","datetime_utc":"<ISO 8601 timestamp>","format_version":1,"valid":true}

# POST /api/v1/inspect/batch
{"items":[{"numeric_id":"<decimal string>","visual_id":"<12-character Visual ID>","timestamp_ns":"<Unix nanoseconds>","datetime_utc":"<ISO 8601 timestamp>","format_version":1,"valid":true}]}

# GET /api/healthz
{"status":"ok"}

HTTP API

Limits

POST requests are limited to 60 per minute per client address per server process, with a shared ceiling of 600 per minute. A single generate request accepts count from 1 to 1000.

HTTP API

Errors and retries

For 400 or 413, correct the request. For 429, wait for Retry-After. Use bounded retries for conversion and validation, but do not automatically retry /generate after a 503 or timeout: generation is not idempotent, and the outcome may be unknown.

400
Invalid input
Fix the request body. Do not retry it unchanged.
413
Body too large
Send a smaller JSON body. Keep count at 1000 or below.
429
Rate limited
Wait for the Retry-After header, then retry.
503
Temporarily unavailable
Do not automatically retry /generate; its outcome may be unknown. Use bounded retries for conversion and validation.

Integration

Storing IDs

Keep numeric_id as its JSON decimal string until it can be bound or parsed exactly as a database BIGINT. Never convert it to a JavaScript Number. Keep visual_id for display or convert it on demand. When a Visual ID arrives from a user or agent, convert it to the Numeric ID and query the index.

sql
CREATE TABLE tasks (
  id    BIGINT PRIMARY KEY,   -- numeric_id, parsed from its decimal string
  title TEXT NOT NULL
);

-- On receipt of a Visual ID, convert it with POST /api/v1/convert/to-numeric,
-- then query by the indexed integer key.
SELECT title FROM tasks WHERE id = 27684557326419404;