Authentication
Laquid uses symmetric HMAC-SHA256 request signing. There are no bearer tokens on the data plane, no refresh cycles, and no per-request network round trip for validation.
Key pair model
A credential consists of a public key identifier and a secret. The identifier travels in the clear; the secret never does. Every key is bound to an account, an environment (sandbox or live), and an explicit scope list.
| Scope | Grants |
|---|---|
rates:read | Latest rates and delayed quotes |
series:read | Historical OHLCV, any interval |
exposure:write | Exposure calculation (stateless, no persistence) |
instruments:read | Instrument metadata and venue calendars |
Scopes are additive and cannot be narrowed on the wire. Requesting an endpoint outside the key's scope returns 403 scope_denied, not 401.
Canonical payload
Four lines, joined by \n, with no trailing newline:
- Uppercase HTTP method
- Path plus query string, exactly as sent (percent-encoding preserved)
- Unix timestamp in seconds, as a decimal string
- Lowercase hex SHA-256 of the request body, or the SHA-256 of the empty string for bodyless requests
The digest of an empty body is a constant:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Reference implementation
The credentials are read from files at run time so they never appear in a process list or in shell history:
#!/bin/sh
# sign.sh — prints the three auth headers for a GET request
KEY_ID=$(cat "$HOME/.laquid/key_id")
SIGNING_KEY_FILE="$HOME/.laquid/signing_key"
PATHQ="$1"
TS=$(date +%s)
EMPTY_DIGEST=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
PAYLOAD=$(printf 'GET\n%s\n%s\n%s' "$PATHQ" "$TS" "$EMPTY_DIGEST")
SIG=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 \
-mac HMAC -macopt "key:$(cat "$SIGNING_KEY_FILE")" -hex | awk '{print $NF}')
printf 'X-Laquid-Key: %s\nX-Laquid-Timestamp: %s\nX-Laquid-Signature: %s\n' \
"$KEY_ID" "$TS" "$SIG"
For POST bodies, substitute the body digest and keep everything else identical. Note that openssl dgst must receive the payload via stdin, not as an argument, or trailing-whitespace handling will differ between shells.
Clock skew
Signatures are valid for ±300 seconds. NTP drift beyond that produces 401 signature_expired with a server_time field in the error body; use it to compute the offset rather than trusting local time.
{
"error": "signature_expired",
"server_time": 1795765314,
"skew_seconds": 431
}
Rotation
Two keys may be active per environment simultaneously. Rotate without downtime:
- Create the replacement key.
- Deploy it to your secret store and cut traffic over.
- Wait at least 24 hours.
- Revoke the old key.
Revocation takes effect within 60 seconds of propagation. Requests in flight on a revoked key complete normally.
What we log
Access logs retain key identifier, timestamp, path, status, and response size. They do not retain signatures, secrets, request bodies, or query values for account-scoped endpoints. Log retention is 30 days for the live environment and 7 days for sandbox.