Authentication#
The Partner API supports three authentication modes depending on the endpoint.
JWT Bearer token#
Used by logged-in partners (for example, from the partner dashboard or a personal script). Sign in with your terraquant.tech username and password to receive an access token:
curl -X POST https://api.terraquant.tech/api/login \
-H "Content-Type: application/json" \
-d '{"username": "partner_user", "password": "<password>"}'
The response contains access_token, refresh_token and the user record. Send the access token on every request:
If the account has two-step verification turned on, POST /login returns a short-lived totp_token instead of tokens. Exchange it, within five minutes, with a current code (or a recovery code) at POST /login/totp:
curl -X POST https://api.terraquant.tech/api/login/totp \
-H "Content-Type: application/json" \
-d '{"totp_token": "<totp_token>", "code": "123456"}'
Repeated failed sign-ins lock the account temporarily (status 423, with a Retry-After header), and sign-in is rate limited.
The authenticated user must have the partner or admin privilege. Requests from
accounts without these privileges are rejected.
All referral-link and API-key management endpoints use this mode — see Referral Links & API Keys.
API key (X-API-Key)#
Used for server-to-server automation, where logging in interactively isn't practical. Generate
a key with POST /partner/api-keys (which requires a JWT, see above), then send it on requests:
The raw key is shown only once
The plaintext token is returned only in the response to POST /partner/api-keys.
It cannot be retrieved again. If you lose it, revoke the key and create a new one.
Listing keys (GET /partner/api-keys) returns token: null.
Each successful API-key request updates the key's last_used timestamp.
Currently the only API-key endpoint is POST /partner/api/referral-links.
Public (no authentication)#
The end-user trial endpoints require no authentication, since the user does not yet have an account:
GET /partner/referral/{code}/validatePOST /partner/trial/claim
The claim endpoint is rate-limited to 5 requests per hour per IP address. See Trial Claim.