Skip to main content

How we check a signed request

We run these checks on each signed request, top to bottom. The first check that fails decides the error.
signing_api::verify(request)
body within capBodyTooLarge413
novig-key-id is a UUIDKeyIdRequired | MalformedKeyId401
novig-timestamp is digitsTimestampRequired | MalformedTimestamp401
base64::decode(signature)SignatureRequired | MalformedSignature401
|now − ts| ≤ 30 sTimestampTooOld | TimestampTooFarInFuture401
the key readDatabaseError500
live key rowKeyNotFound401
!expiredKeyExpired401
key.verify(canonical, sig)VerificationFailed401
scope.grants::<Route>()ScopeInsufficient403
Principalthe handler runs
Only a request that passes every check reaches the route’s handler. Each rejection is a SignatureRejection variant. The code in the response depends only on the status, so branch on the code, not on the variant.
  • VerificationFailed is the only rejection that means your canonical string is wrong.
  • A 403 means your signature verified. We check scope last.
  • A 500 isn’t caused by your request. Retry it unchanged.

400 Bad Request

A key refusal answers INVALID_BODY. A limit or transfer id refusal answers ACCOUNT_RULE_REFUSED. To export a public key as SPKI, run openssl pkey -pubout and send the output with its newlines. Generate an Ed25519 or P-256 keypair, and set algorithm to match the key material. Address a subaccount by one of its trading key IDs. A subaccount is permanent, so relabel an existing one instead of opening another. A transfer id is unique per trader.

401 Unauthorized

When novig-timestamp or novig-signature is missing, the first message names that header instead. We accept a timestamp within ±30 s of our clock, so check your clock too. api key not found means a wrong key ID, the wrong environment, or a revoked key. A key route answers Authentication required. when the request has no novig-key-id header. For signature verification failed, sign a test vector. Diff your canonical string against its string_to_sign. If you still get a 401, find your symptom below.
  • A 401 on every call. A header, the clock, the key, or the canonical string is wrong. Read message, then sign a published vector and diff your string against it on Sign a request.
  • GET works, but POST returns a 400 INVALID_BODY. You sent no Content-Type: application/json. Send that header on every request with a body.
  • Every POST fails, and the body looks right. Your client re-serialized the JSON after you hashed it. Send the exact bytes you hashed.
  • Every path fails. You signed the URL, or dropped the mount prefix. Sign the path only, with the mount prefix included.
  • A P-256 signature never verifies. You sent a raw r‖s signature. Send DER instead, as Algorithms describes.
  • api key not found, but the key exists. You’re on the wrong environment, since a key works only in its own. Check the host on Environments.

403 Forbidden

A scope error means the key has the wrong family or level. See scopes. KYC is our identity check. You need it to create a key, to open or fund a subaccount, to place an order, or to run an RFQ maker. Cancels still work without it. A trading or trading::read key that names a sibling subaccount gets a 404 SUBACCOUNT_NOT_FOUND. To read a sibling, use a key with management::read.

404 Not Found

We answer Key not found., Subaccount not found, or Transfer not found. when we can’t find the ID. An ID that belongs to another trader gets the same reply.

409 Conflict

  • A live key with this public key already exists. A public key is unique across Novig.
  • This trader already has a live management key… Revoke the live management key first.
  • This subaccount already has a live trading key… Revoke the live trading key first, or create a trading::read key.
The codes are KEY_EXISTS, MANAGEMENT_KEY_EXISTS, and TRADING_KEY_EXISTS. A declined transfer is not an error. The route answers 202, and the transfer then reads status: "Rejected". See Funding.

413 Content Too Large

The exchange buffers each request body before it parses it. It refuses a body over 100 KiB with a 413 and PAYLOAD_TOO_LARGE, before it reads the signature. A full batch of orders fits under it, at about 90 bytes an order. To fix it, split the batch. The cap counts the raw bytes you send.

423 Locked

Most 423 codes don’t clear on their own. Contact support.
  • SYSTEM_LOCKED means the exchange has halted trading. It blocks every trading, catalog, key, and subaccount route, reads included. GET /v3/exchange/status still answers, and returns the reason.
  • ACCOUNT_LOCKED and ACCOUNT_EXCLUDED block every trading, catalog, key, and subaccount route, reads included.
  • SELF_EXCLUDED blocks placing orders, creating a key, opening a subaccount, moving funds, and running an RFQ maker while the key holder is self-excluded.
  • EMPLOYEE_ACCOUNT blocks placing and canceling when the key belongs to a Novig employee.
  • LIQUIDATION_ONLY blocks placing orders. Cancels still work.
  • When we apply LIQUIDATION_ONLY to your account, we cancel your resting orders, then cancel again about 75 seconds later.
  • DEPOSIT_RETURN_HOLD blocks placing orders after your bank returns one of your deposits or your card issuer charges it back. Cancels still work.
  • DEPOSIT_RETURN_HOLD lifts on its own if the dispute is decided in your favor. Otherwise, contact support.
  • If your account has both LIQUIDATION_ONLY and DEPOSIT_RETURN_HOLD, you get LIQUIDATION_ONLY.
  • EVENT_LOCKED and MARKET_LOCKED block new orders in a locked event or market. Cancels still work.
To see which events and markets are locked, call GET /v3/exchange/locks, or send query_locks on your websocket. To check whether trading is paused, call GET /v3/exchange/status.
trading is OPEN or PAUSED. While trading is paused, reason holds our note on why. It’s absent while trading is open.

429 Too Many Requests

RATE_LIMIT_EXCEEDED means you sent requests too fast. Wait Retry-After seconds before you retry. See Throttling. TOO_MANY_SOCKETS means the key already has 10 RFQ sockets open. Close one before you open another. See Socket.

451 Geolocation Unavailable

Geolocation is the location check the Novig app runs for the key holder. A 451 means the request, or the key holder’s location, didn’t pass it.
  • GEOLOCATION_OUT_OF_BOUNDARY: the key holder’s device must be inside a permitted state.
  • GEOLOCATION_BLOCKED_NETWORK: turn off the VPN, proxy, or iCloud Private Relay on the device, then open the app.
  • GEOLOCATION_BLOCKED_SOFTWARE: close the remote-desktop or location-spoofing software, then open the app.
ANONYMIZED_NETWORK means the request came over a VPN, a proxy, or a Tor exit. A data-center address is fine. Creating a key, opening a subaccount, and issuing a subaccount key also screen the request’s network when you sign in with a session, so each can answer ANONYMIZED_NETWORK or RESTRICTED_NETWORK_REGION. The restricted states are Arizona, Michigan, and Nevada. The first two codes judge the request’s network. The rest judge the key holder’s device. For those, the key holder must open the app. A cancel never returns a 451. A read admits a stale geolocation, so only a placement returns GEOLOCATION_EXPIRED.

Blocked requests

We block a request because of where it comes from, not because of what it says. Find what you see, then follow its fix. Each check is separate. A request can pass the account’s geolocation and still fail on its IP address, and the reverse. Fixing one doesn’t fix the other.
On any 451, stop and fix the cause before you retry. A client that keeps retrying a 451 can get the account locked with a 423.

Anonymized network

ANONYMIZED_NETWORK means our compliance provider classifies the request’s IP address as a VPN, a proxy, a Tor exit, or another anonymizer. The block is on the IP address, not the key. A new key won’t help, and we can’t allowlist or review an IP address for this check. It usually blocks order, position, and account routes. Some routes, like GET /v3/time, can still work. So a key that works on some routes and fails on others is normal for this error. These are the causes we see most:
  • A VPN, iCloud Private Relay, or Cloudflare WARP that’s still on.
  • An app that shares or sells your bandwidth. It turns your connection into a proxy.
  • A router with a built-in VPN, privacy, or proxy feature.
  • A home IP address that a proxy service used before. Home addresses change hands, and the lists can be out of date.
  • A shared outbound address that many customers use, like Railway’s shared static IPs or a Cloudflare-fronted proxy.
To fix it:
1

Turn off anonymizers

Turn off any VPN, iCloud Private Relay, WARP, or proxy on the machine and the network. Unset HTTP_PROXY and HTTPS_PROXY.
2

Remove bandwidth-sharing apps

Uninstall any app that shares your connection. Its IP address can stay flagged for a while after.
3

Check the router

Turn off any VPN, privacy, or proxy feature on the router.
4

Test from a phone hotspot

If the request works there, your key is fine. Only your network’s IP address is flagged.
5

Get a new IP address

Restart the modem or router, or ask your ISP for a new address. A restart doesn’t always change it.
6

Use a dedicated server address

On a server, use a dedicated static IP in a US region, like AWS EC2 with an Elastic IP. Test it with a read first.

Restricted network region

RESTRICTED_NETWORK_REGION means the request’s IP address is in a region we can’t serve. The restricted states are Arizona, Michigan, and Nevada. It blocks reads, like GET /v3/portfolio/positions, as well as placements. It most often hits hosted runners whose IP address changes, like GitHub Actions or a serverless platform. Each run can land in a different data center, so the error comes and goes. To fix it, run your client from a fixed IP address you control. A home or office connection works, and so does a dedicated static cloud IP. Don’t use a hosted runner’s rotating addresses.

Edge 403

A 403 with an HTML body means our network edge stopped the request before it reached the API. It isn’t a key or signing problem. You can tell it’s this error when:
  • The body is an HTML page that says “Request blocked” or “The request could not be satisfied”, not JSON.
  • The headers include Server: CloudFront, X-Cache: Error from cloudfront, and x-amz-cf-id.
  • An unsigned public route, like GET /v3/public/catalog/events, is blocked too.
  • Paper works while production fails.
These are the causes we’ve seen:
  • Some data-center and shared-hosting addresses, like DigitalOcean, Railway, or Hostinger.
  • Bursts of requests above the rate limits.
  • An HTTP library’s default User-Agent, like the one Python’s urllib sends.
  • Some home ISP address ranges.
To fix it:
1

Confirm the error

Check for the HTML body and the CloudFront headers.
2

Set a User-Agent

Send a User-Agent header that names your client, like acme-trader/1.4.
3

Slow down

Stay within the rate limits, and back off after an error. Don’t retry in a tight loop.
4

Test another network

Try a phone hotspot or another ISP.
5

Change hosts

On a cloud host, try another provider or a dedicated static IP.
We don’t allowlist customer IP addresses at the edge. Every client meets the same rules, so the steps above are the fix. If you’re still blocked, contact us.

Geolocation

A GEOLOCATION_* code is about the account’s location check, not the request’s IP address. An API key has no location of its own. It uses the location check of the account that owns it.
  • Refresh the check. Open the Novig app in a permitted state. That refreshes the check for every key on the account.
  • Refresh often enough. A placement needs a check from the past days. Reads and cancels still work after it lapses.
  • Use the app. Opening the Novig app is the only supported way to geolocate.
  • Check when it lapses. GET /v3/account/geolocation returns when the account’s last check expires, and the code a placement gets now. It answers even while the check refuses your other requests.
  • Close remote-access tools. Remote desktop, a virtual machine, or location-spoofing software returns GEOLOCATION_BLOCKED_SOFTWARE.
For each code, see 451. Contact us if the account still shows GEOLOCATION_FAILED or a 423 after you fix your client.

Before you contact us

Email developers@novig.com with:
  • The x-amz-cf-id header for an edge 403, or the JSON body for a 451.
  • The UTC timestamp of the request.
  • The route you called.
  • The public IP address the request came from.
  • Your ISP or hosting provider.
  • Whether the request works from a phone hotspot.
To find your public IP address, run this on the machine that sends the request.

Trading and catalog errors

Every trading and catalog error has a code and a message. Branch on the code. The message is for a human, and it can change. A body that doesn’t parse answers INVALID_BODY. Its message names the field and the reason, like qty: invalid value: integer `-1`, expected u32.
  • 403 KYC_REQUIRED applies to placing orders and to RFQ makers only. The key holder’s KYC lapsed after the key was created, so finish verification in the app.
  • 423 means SELF_EXCLUDED, EMPLOYEE_ACCOUNT, LIQUIDATION_ONLY, DEPOSIT_RETURN_HOLD, or a lock with no code. See 423.
  • A reject from the matching engine isn’t an HTTP error. It arrives on the private stream after the 201.