Skip to content

Developer API ​

The developer API lets you draw quantum entropy from your own code. Draws are charged to your Light Rider credits, and every draw returns a signed receipt.

Base URL: https://entropy.lightriderinc.com/api/v1

For Python, the SDK wraps this API and handles retries and verification.

Authentication ​

Send your Light Rider API key as a bearer token:

http
Authorization: Bearer lr_live_...

Create a key on the Developers page. See the Quickstart.

Endpoints ​

MethodPathAuthDescription
GET/sourcesAPI keySources available right now, with limits and pricing.
POST/entropyAPI keyDraw entropy from one source or a custom pool.
GET/receipts/{request_id}API keyFetch one of your receipts.
GET/public-keyNoneThe public key that signs receipts.

List sources ​

bash
curl -s https://entropy.lightriderinc.com/api/v1/sources \
  -H "Authorization: Bearer $LR_API_KEY"

The response lists each available source with its id, alias, name, type, state (ready or empty), bytes_available, and whether it can join a custom pool. It also returns the current request limits and price.

Draw entropy ​

POST /entropy supports two modes.

Single source: bytes from one named source.

json
{ "bytes": 32, "mode": "source", "id": "anu" }

Custom pool: bytes blended from 2 to 8 sources.

json
{ "bytes": 64, "mode": "custom", "ids": ["anu", "cisco"] }

Sources can be named by short name (anu) or full ID (anu_aws_001). See Sources.

Example ​

bash
curl -s https://entropy.lightriderinc.com/api/v1/entropy \
  -H "Authorization: Bearer $LR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"bytes": 32, "mode": "source", "id": "anu"}'

PowerShell:

powershell
$headers = @{ Authorization = "Bearer $env:LR_API_KEY"; "Idempotency-Key" = [guid]::NewGuid().ToString() }
$body = @{ bytes = 32; mode = "source"; id = "anu" } | ConvertTo-Json
$r = Invoke-RestMethod -Method Post -Uri https://entropy.lightriderinc.com/api/v1/entropy -Headers $headers -ContentType "application/json" -Body $body
$r.bytes_hex

Response ​

json
{
  "request_id": "...",
  "bytes": 32,
  "bytes_hex": "...",
  "commitment_salt": "...",
  "billing": { "cost_tokens": 1, "balance_tokens": 499 },
  "receipt": { ... }
}
FieldDescription
request_idID of the draw. Use it to fetch the receipt later.
bytes_hexThe drawn bytes, hex encoded.
commitment_saltSalt used to check the bytes against the receipt. See Receipts and verification.
billingCredits charged for this draw and your remaining balance.
receiptThe signed receipt, exactly as Light Rider signed it.

The bytes and the salt are returned once and are not stored. Keep them if you need to prove which bytes a receipt covers.

Idempotency ​

Send an Idempotency-Key header (1 to 200 printable characters) to retry a request safely. A repeated key never draws or charges twice. Instead, it returns 409 already_processed with the original receipt. Use a new key for each new draw.

Limits ​

LimitValue
Bytes per request1 to 4096
Sources in a custom pool2 to 8
Requests per minute60 per API key
Price1 credit ($0.01) per 256 bytes, minimum 1 credit

Errors ​

Errors return a non-2xx status and a JSON body with a stable error code and a readable message.

StatusCodeMeaning
400invalid_requestInvalid body, size, mode, or source name.
401invalid_api_keyMissing, invalid, or revoked key.
402insufficient_creditsNot enough credits. The body includes buy_url.
404not_foundNo such receipt on your account.
409already_processedThe Idempotency-Key was already used.
429rate_limitedToo many requests. Wait for the Retry-After header.
502upstream_unavailableThe entropy service could not be reached.
503source_emptyThe source's pool is empty. Try again later or use another source.
503source_unavailableThe source is offline.

A failed draw is not charged. The API never substitutes another source for the one you requested.