# Quanteex RESELLER management API Base URL: https://api.quanteex.com/v1/reseller [OpenAPI](https://dashboard.quanteex.com/cabinet/assets/reseller-management.openapi.json) - The workspace owner issues a token in API keys → RESELLER management API. Select only the permissions you need. The token is shown once, lasts 90 days, and is bound to one workspace. - Keep QUANTEEX_MANAGEMENT_TOKEN on your server. A project key calls models and can also access the project’s financial API. If a client only needs models, keep the project key on your server and issue a credential for your service. Never paste secrets into an agent chat. - Before running an example, set the _ID variables to IDs from previous responses. Set each _OP variable to a saved nonzero operation UUID. Response values are illustrative. - Every POST/PATCH requires Idempotency-Key. Persist a new UUID and body before each new action. After a timeout, retry with the same UUID and unchanged body. A replay returns replayed: true; changing the body for the same UUID returns 409. - Most lists accept limit from 1 to 100 (default 50); support messages return at most 25 per page. Send money as decimal USD strings. Request bodies are limited to 16 KiB. - 401: check token expiry or revocation. 403: check the scope, ownership and RESELLER status. 404: check the ID and workspace. 409: inspect the conflict code. Back off on 429 or 503; preserve the operation UUID and body. ## GET /workspace Works with any valid management token. expires_at is the workspace’s RESELLER expiry; null means no fixed end date. It is separate from the token expiry. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/workspace" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000001", "tier": "reseller", "expires_at": "2030-02-01T12:00:00Z", "scopes": [ "read", "projects", "keys", "transfers" ] } ``` ## Common workflows ### Onboard a client Scopes: projects + transfers + keys + read. Create the project and save its ID. Check available_usd in the source, transfer funds, and issue a key. Call a model with the project key and check the result in the log. POST /projects → GET /projects/{project} → POST /transfers → POST /projects/{project}/keys → GET /projects/{project}/requests ### Reconcile spending Scope: read. Compare available funds with holds, export the CSV pages, and reconcile only state=settled rows against the daily report. Use the same days and key filters. GET /projects/{project} → GET /projects/{project}/requests.csv → GET /projects/{project}/report ### Recover after a timeout Retry the original operation with the same UUID and body. If the key secret response was lost, take the ID from the replay, revoke that key, and issue another with a new UUID. POST /projects/{project}/keys → PATCH /projects/{project}/keys/{key} → POST /projects/{project}/keys ## read — Balances, limits, catalogue and history Read-only access to projects, keys, limits, request history, reports and prices. Key secrets and supplier data are never returned. ### GET /projects List projects and save the client’s id. Pass next_cursor as before for the next page; null means the last page. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000002", "name": "Client A", "archived": false, "currency": "USD", "monthly_budget_usd": "25.00", "posted_usd": "10.00", "held_usd": "0.20", "available_usd": "9.80" } ], "next_cursor": "00000000-0000-4000-8000-000000000002" } ``` ### GET /projects/{project} posted_usd is the ledger balance, held_usd is reserved and available_usd is spendable or transferable. The monthly limit does not allocate money. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000002", "name": "Client A", "archived": false, "currency": "USD", "monthly_budget_usd": "25.00", "posted_usd": "10.00", "held_usd": "0.20", "available_usd": "9.80" } ``` ### GET /projects/{project}/limits Read an active project’s live capacity, 24 models per page. in_use counts busy slots, concurrent is the ceiling and project_in_use covers the whole project. If a shared workspace policy applies, workspace contains concurrent, in_use, requests_per_minute, starts_last_minute and expires_unix; otherwise workspace is null. There are no per-model RPM or TPM limits. Pass next_cursor as cursor. Video has a separate lifecycle. An archived project returns 409 project_archived. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/limits" ``` Example response: ```json { "sampled_at_unix": 1894017600, "default_model_concurrent": 24, "project_in_use": 3, "workspace": null, "models": [ { "model": "example-model", "concurrent": 24, "in_use": 3 } ], "next_cursor": null } ``` ### GET /projects/{project}/limits/events Each limits event is a fresh snapshot of this page with sampled_at_unix. Reconnect with the same cursor on disconnect or at the 45-second lifetime; the server sends a new snapshot. Treat old values as stale until then. On unavailable, discard the last snapshot because access changed. On 429, back off using Retry-After. ```bash curl --fail-with-body -sS -N \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Accept: text/event-stream" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/limits/events" ``` Example response: ```text event: limits retry: 1000 data: {"sampled_at_unix":1894017600,"default_model_concurrent":24,"project_in_use":3,"workspace":null,"models":[{"model":"example-model","concurrent":24,"in_use":3}],"next_cursor":null} ``` ### GET /projects/{project}/keys List key IDs, short prefixes, status and limits. This endpoint cannot recover a key secret. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/keys?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000003", "name": "Client A backend", "prefix": "example-prefix", "active": true, "monthly_budget_usd": "5.00" } ], "next_cursor": null } ``` ### GET /projects/{project}/requests Read the project log. days accepts 1–31 and key is an optional key ID. Keep filters unchanged when passing next_cursor as before. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/requests?days=7&key=${KEY_ID}&limit=50" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000004", "project_id": "00000000-0000-4000-8000-000000000002", "key_id": "00000000-0000-4000-8000-000000000003", "model": "example-model", "protocol": "chat_completions", "created_at": "2030-01-07T12:00:00Z", "state": "settled", "charge_usd": "0.012500", "outcome": "succeeded", "tokens": { "input": 120, "output": 50, "cache_read": 0, "cache_write_5m": null, "cache_write_1h": null }, "images": null, "audio_duration_seconds": null } ], "next_cursor": null } ``` ### GET /projects/{project}/requests/{request} Read one request by ID from the log. pending means the result is not final; null charge_usd is not a zero charge. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/requests/${REQUEST_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000004", "project_id": "00000000-0000-4000-8000-000000000002", "key_id": "00000000-0000-4000-8000-000000000003", "model": "example-model", "protocol": "chat_completions", "created_at": "2030-01-07T12:00:00Z", "state": "settled", "charge_usd": "0.012500", "outcome": "succeeded", "tokens": { "input": 120, "output": 50, "cache_read": 0, "cache_write_5m": null, "cache_write_1h": null }, "images": null, "audio_duration_seconds": null } ``` ### GET /projects/{project}/usage Exact settled charges for the rolling window, by project or by key. Parse charge_usd as a decimal string. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/usage?days=7&key=${KEY_ID}" ``` Example response: ```json { "project_id": "00000000-0000-4000-8000-000000000002", "key_id": "00000000-0000-4000-8000-000000000003", "days": 7, "from": "2030-01-01T12:00:00Z", "to": "2030-01-08T12:00:00Z", "currency": "USD", "settled_requests": 1, "charge_usd": "0.012500" } ``` ### GET /projects/{project}/report The same total broken down by request creation day in UTC. A later export may include newly settled requests. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/report?days=7&key=${KEY_ID}" ``` Example response: ```json { "project_id": "00000000-0000-4000-8000-000000000002", "key_id": "00000000-0000-4000-8000-000000000003", "days": 7, "from": "2030-01-01T12:00:00Z", "to": "2030-01-08T12:00:00Z", "currency": "USD", "settled_requests": 1, "charge_usd": "0.012500", "daily": [ { "date": "2030-01-07", "charge_usd": "0.012500", "settled_requests": 1 } ] } ``` ### GET /projects/{project}/reconciliation Settled requests grouped by UTC creation day, model and key, including revoked keys. USD amounts are decimal strings. Default: seven complete UTC days. Pass both from and to as RFC 3339 timestamps (inclusive start, exclusive end, at most 31 days). key and model are optional. On 422, narrow the range or filters; no partial totals are returned. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/reconciliation?key=${KEY_ID}" ``` Example response: ```json { "project_id": "00000000-0000-4000-8000-000000000002", "from": "2030-01-01T00:00:00Z", "to": "2030-01-08T00:00:00Z", "sampled_at": "2030-01-08T12:00:00Z", "currency": "USD", "key_id": "00000000-0000-4000-8000-000000000003", "model": null, "settled_requests": 1, "charge_usd": "0.012500", "rows": [ { "date": "2030-01-07", "model": "example-model", "key_id": "00000000-0000-4000-8000-000000000003", "settled_requests": 1, "charge_usd": "0.012500", "input_tokens": 120, "output_tokens": 50, "cache_read_tokens": 20, "cache_write_5m_tokens": 0, "cache_write_1h_tokens": 0, "images": 0, "audio_seconds": "0" } ] } ``` ### GET /projects/{project}/reconciliation.csv Export the same rows as CSV with the same filters. X-Report-From, X-Report-To, X-Report-Sampled-At and X-Report-Charge-USD describe this export. Requests that settle later may appear in the next export. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -D report.headers -o reconciliation.csv \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/reconciliation.csv?key=${KEY_ID}" ``` Example response: ```csv date,model,key_id,settled_requests,charge_usd,input_tokens,output_tokens,cache_read_tokens,cache_write_5m_tokens,cache_write_1h_tokens,images,audio_seconds "2030-01-07","example-model","00000000-0000-4000-8000-000000000003","1","0.012500","120","50","20","0","0","0","0" ``` ### GET /projects/{project}/requests.csv Download one CSV page. Check the HTTP status; if requests.headers contains X-Next-Cursor, pass it as before with the same filters. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -D requests.headers -o requests.csv \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/requests.csv?days=7&key=${KEY_ID}&limit=50" ``` Example response: ```csv id,project_id,key_id,model,protocol,created_at,state,charge_usd,outcome "00000000-0000-4000-8000-000000000004","00000000-0000-4000-8000-000000000002","00000000-0000-4000-8000-000000000003","example-model","chat_completions","2030-01-07T12:00:00Z","settled","0.012500","succeeded" ``` ### GET /models Your workspace’s model prices and capabilities. Check pricing.unit because it varies by model type. Pass next_cursor as cursor. Example prices are illustrative. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/models?limit=25" ``` Example response: ```json { "items": [ { "id": "example-model", "display_name": "Example model", "currency": "USD", "pricing_tier": "reseller", "input_modalities": [ "text", "image" ], "output_modalities": [ "text" ], "protocols": [ "chat_completions" ], "context_length": 128000, "max_output_tokens": 4096, "pricing": { "unit": "million_tokens", "rates": { "input": "0.42", "output": "1.30", "cache_read": "0.04", "cache_write_5m": null, "cache_write_1h": null } } } ], "next_cursor": "example-model" } ``` ## projects — Manage projects Create one project per client, set a monthly spending limit, and archive or restore projects. Listing projects and reading balances require read. ### POST /projects Save the returned id as PROJECT_ID. The project starts unfunded; a limit controls spending and does not add funds. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${CREATE_PROJECT_OP}" \ --json '{"name":"Client A","monthly_budget_usd":"25.00"}' \ "https://api.quanteex.com/v1/reseller/projects" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000002", "replayed": false } ``` ### PATCH /projects/{project} · update Include name with update, even when changing only the limit. Send null to remove the limit; omitting the field also means no limit. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${UPDATE_PROJECT_OP}" \ --json '{"action":"update","name":"Client A","monthly_budget_usd":"40.00"}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000002", "replayed": false } ``` ### PATCH /projects/{project} · archive Archiving stops new model requests and preserves balance and history. Wait for outstanding holds to clear. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${ARCHIVE_PROJECT_OP}" \ --json '{"action":"archive"}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000002", "replayed": false } ``` ### PATCH /projects/{project} · restore Make the project active again. Check its status and available balance before sending model requests. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${RESTORE_PROJECT_OP}" \ --json '{"action":"restore"}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000002", "replayed": false } ``` ## keys — Manage model keys Issue, update and revoke keys for your project. A model key and a management token are separate credentials. ### POST /projects/{project}/keys Store id as KEY_ID and key in your secret store. A replay returns the same id without key. If the secret is lost, revoke that key and issue another. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${CREATE_KEY_OP}" \ --json '{"name":"Client A backend","monthly_budget_usd":"5.00"}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/keys" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000003", "replayed": false, "key": "" } ``` ### PATCH /projects/{project}/keys/{key} · update name is required for update. Null or omitted monthly_budget_usd removes the monthly limit. Updating does not issue a new secret. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${UPDATE_KEY_OP}" \ --json '{"action":"update","name":"Client A backend","monthly_budget_usd":"8.00"}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/keys/${KEY_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000003", "replayed": false } ``` ### PATCH /projects/{project}/keys/{key} · revoke Revoke in an active project. Revocation blocks new calls with the key and preserves history and recorded charges. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${REVOKE_KEY_OP}" \ --json '{"action":"revoke"}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/keys/${KEY_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000003", "replayed": false } ``` ## transfers — Transfer between projects Move available funds between your own projects. Active holds stay in the source project. ### POST /transfers Use two different projects in the same workspace and a positive USD string with up to six decimals. The destination must be active. For transfer_smaller_amount_required, split the amount into smaller operations with new UUIDs. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${TRANSFER_OP}" \ --json "{\"source\":\"${SOURCE_PROJECT_ID}\",\"destination\":\"${PROJECT_ID}\",\"amount_usd\":\"5.00\"}" \ "https://api.quanteex.com/v1/reseller/transfers" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000008", "replayed": false, "amount_usd": "5.00" } ``` ## billing — Top-up methods and status Read available payment methods and payment states. Create invoices and pay in the cabinet. ### GET /projects/{project}/payment-methods Methods currently available to this project under the owner’s restrictions. An empty array means none are available. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/payment-methods" ``` Example response: ```json { "project_id": "00000000-0000-4000-8000-000000000002", "methods": [ "card_rub", "sbp", "crypto" ] } ``` ### GET /projects/{project}/topups Project top-up history. gross_usd is the total, fee_usd is the fee and credit_usd is the quoted net credit. Paginate with before. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/topups?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000005", "project_id": "00000000-0000-4000-8000-000000000002", "status": "credited", "gross_usd": "11.00", "fee_usd": "1.00", "credit_usd": "10.00", "created_at": "2030-01-07T12:00:00Z", "currency": "USD" } ], "next_cursor": null } ``` ### GET /projects/{project}/topups/{intent} Take TOPUP_ID from the history. Only credited confirms credit. awaiting_payment, processing and pending_review do not confirm it. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/topups/${TOPUP_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000005", "project_id": "00000000-0000-4000-8000-000000000002", "status": "credited", "gross_usd": "11.00", "fee_usd": "1.00", "credit_usd": "10.00", "created_at": "2030-01-07T12:00:00Z", "currency": "USD" } ``` ## alerts — Balance alerts Low balance preferences for the selected project and the token owner. Delivery channels must already be verified in the cabinet. ### GET /projects/{project}/balance-alert channels lists eligible delivery channels, preference has the settings, and last_notification_at is the last notification time or null. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/balance-alert" ``` Example response: ```json { "project_id": "00000000-0000-4000-8000-000000000002", "channels": { "email": true, "telegram": false }, "preference": { "enabled": false, "threshold_usd": "5", "email": false, "telegram": false, "last_notification_at": null } } ``` ### PATCH /projects/{project}/balance-alert Send all four fields. When enabled is true, select an eligible channel. The threshold is compared with the ledger balance before holds. The receipt confirms settings, not delivery. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${ENABLE_ALERT_OP}" \ --json '{"enabled":true,"threshold_usd":"10.00","email":true,"telegram":false}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/balance-alert" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000002", "replayed": false } ``` ### PATCH /projects/{project}/balance-alert Set enabled to false to switch off alerts. Confirm the setting with GET on the same path. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${DISABLE_ALERT_OP}" \ --json '{"enabled":false,"threshold_usd":"10.00","email":false,"telegram":false}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/balance-alert" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000002", "replayed": false } ``` ## team — Team and invitations Members and invitations for your workspace. These workspace roles do not grant Quanteex staff privileges. ### GET /team/members List member roles and IDs. Use id as MEMBER_ID. For the next page pass next_cursor as before. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/team/members?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000006", "name": "Client Operator", "email": "operator@example.invalid", "role": "developer" } ], "next_cursor": null } ``` ### PATCH /team/members/{user} · role Assignable roles are admin, developer, billing and viewer. Ownership changes and the owner role are unavailable through this API. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${CHANGE_MEMBER_ROLE_OP}" \ --json '{"action":"role","role":"viewer"}' \ "https://api.quanteex.com/v1/reseller/team/members/${MEMBER_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000006", "replayed": false } ``` ### PATCH /team/members/{user} · remove Remove a member from the current workspace. This endpoint cannot remove an owner. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${REMOVE_MEMBER_OP}" \ --json '{"action":"remove"}' \ "https://api.quanteex.com/v1/reseller/team/members/${MEMBER_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000006", "replayed": false } ``` ### GET /team/invitations List only unexpired invitations that have not been accepted. Use cursor, not before, for the next page. URL-encode its value. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/team/invitations?limit=25" ``` Example response: ```json { "items": [ { "email": "operator@example.invalid", "role": "developer", "expires_at": "2030-01-14T12:00:00Z" } ], "next_cursor": null } ``` ### POST /team/invitations · invite Replace the example email with the recipient’s address. Receipt id is the operation UUID, not a member ID. The user must accept the invitation. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${INVITE_MEMBER_OP}" \ --json '{"action":"invite","email":"operator@example.invalid","role":"developer"}' \ "https://api.quanteex.com/v1/reseller/team/invitations" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000009", "replayed": false } ``` ### POST /team/invitations · cancel Cancel a pending invitation by email. If it has already been accepted, manage the member via PATCH /team/members/{user}. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${CANCEL_INVITE_OP}" \ --json '{"action":"cancel","email":"operator@example.invalid"}' \ "https://api.quanteex.com/v1/reseller/team/invitations" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000010", "replayed": false } ``` ## support — Support tickets Create and read workspace tickets, add replies and resolve issues. Never put a key or token in a message. ### GET /support/tickets List tickets for this workspace. Save id as TICKET_ID. Paginate with before. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/support/tickets?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000007", "subject": "Question about a charge", "status": "open", "created_at": "2030-01-07T12:00:00Z", "updated_at": "2030-01-07T12:00:00Z" } ], "next_cursor": null } ``` ### POST /support/tickets The subject is limited to 180 UTF-8 bytes and the message to 10,000 bytes. The response contains the ticket ID. Include a request ID for reconciliation, never secrets. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${CREATE_TICKET_OP}" \ --json '{"subject":"Question about a charge","body":"Please help me reconcile the request in my client project."}' \ "https://api.quanteex.com/v1/reseller/support/tickets" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000007", "replayed": false } ``` ### GET /support/tickets/{ticket} Read ticket metadata: subject, status and timestamps. Use the messages endpoint for the conversation. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/support/tickets/${TICKET_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000007", "subject": "Question about a charge", "status": "open", "created_at": "2030-01-07T12:00:00Z", "updated_at": "2030-01-07T12:00:00Z" } ``` ### PATCH /support/tickets/{ticket} · resolve Mark the ticket resolved. The message history remains available. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${RESOLVE_TICKET_OP}" \ --json '{"action":"resolve"}' \ "https://api.quanteex.com/v1/reseller/support/tickets/${TICKET_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000007", "replayed": false } ``` ### GET /support/tickets/{ticket}/messages Up to 25 messages per page. staff identifies a staff reply without revealing the staff member. Pass next_cursor as before. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/support/tickets/${TICKET_ID}/messages?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000011", "staff": true, "body": "We are checking the request.", "created_at": "2030-01-07T12:00:00Z" } ], "next_cursor": null } ``` ### POST /support/tickets/{ticket}/messages Add a reply; the receipt id is the ticket ID. Use the same UUID for retries to avoid a duplicate message. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${REPLY_TO_TICKET_OP}" \ --json '{"body":"I can now reproduce the issue in one request."}' \ "https://api.quanteex.com/v1/reseller/support/tickets/${TICKET_ID}/messages" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000007", "replayed": false } ``` ## webhooks — Project webhooks To configure without code, select a project and open API keys → Set up a webhook. Choose an active token with the webhooks scope, then enter the URL and events. Each project can have one receiver. Install the secret on your receiver before activation. ### GET /projects/{project}/webhooks List project webhooks without secrets. pending awaits verification, active can receive events and inactive means its bound token expired or was revoked. Pass next_cursor as before. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/webhooks?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000009", "project_id": "00000000-0000-4000-8000-000000000002", "url": "https://receiver.example.com/quanteex", "events": [ "balance.low", "capacity.high", "topup.credited" ], "balance_below_usd": "5.00", "capacity": { "percent": 85, "models": [ "example-model" ] }, "state": "active", "created_at": "2030-01-07T12:00:00Z", "verified_at": "2030-01-07T12:00:00Z" } ], "next_cursor": null } ``` ### POST /projects/{project}/webhooks Replace the URL with your public HTTPS receiver without query parameters. Save signing_secret; it is shown only once. For balance.low set the posted-balance threshold in USD. For capacity.high set a percentage and up to 16 model IDs. No data is sent before webhook.verify is answered. ```bash curl --fail-with-body -sS -X POST \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${CREATE_WEBHOOK_OP}" \ --json '{"url":"https://receiver.example.com/quanteex","events":["balance.low","capacity.high","topup.credited"],"balance_below_usd":"5.00","capacity":{"percent":85,"models":["example-model"]}}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/webhooks" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000009", "replayed": false, "signing_secret": "" } ``` ### GET /projects/{project}/webhooks/{webhook}/deliveries View up to 30 days of deliveries, including attempts, outcome and HTTP status. Event IDs remain stable on retry. Deduplicate by event ID at the receiver. ```bash curl --fail-with-body -sS \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/webhooks/${WEBHOOK_ID}/deliveries?limit=25" ``` Example response: ```json { "items": [ { "id": "00000000-0000-4000-8000-000000000010", "type": "topup.credited", "state": "delivered", "attempts": 2, "last_http_status": 204, "created_at": "2030-01-07T12:00:00Z", "completed_at": "2030-01-07T12:00:00Z" } ], "next_cursor": null } ``` ### PATCH /projects/{project}/webhooks/{webhook} · revoke Revoke a webhook to stop new deliveries. To change the receiver or replace a lost secret, revoke the old webhook and create another with a new operation UUID. ```bash curl --fail-with-body -sS -X PATCH \ -H "Authorization: Bearer ${QUANTEEX_MANAGEMENT_TOKEN}" \ -H "Idempotency-Key: ${REVOKE_WEBHOOK_OP}" \ --json '{"action":"revoke"}' \ "https://api.quanteex.com/v1/reseller/projects/${PROJECT_ID}/webhooks/${WEBHOOK_ID}" ``` Example response: ```json { "id": "00000000-0000-4000-8000-000000000009", "replayed": false } ``` ## Verify a webhook at your receiver Verify the raw request bytes before parsing JSON. The secret is a UTF-8 string. For webhook.verify, return 2xx with X-Quanteex-Webhook-Proof. For other events, save the ID and apply the action atomically before returning 2xx. Acknowledge duplicates with 2xx. Delivery makes up to six attempts and events can arrive out of order. ```python import hashlib, hmac, json, time def verify(raw: bytes, signature: str, event_id: str, secret: str): parts = dict(part.split("=", 1) for part in signature.split(",")) stamp = parts["t"] if abs(time.time() - int(stamp)) > 300: raise ValueError("stale signature") def mac(message): return hmac.new(secret.encode(), message, hashlib.sha256).hexdigest() if not hmac.compare_digest(parts["v1"], mac(stamp.encode() + b"." + raw)): raise ValueError("bad signature") event = json.loads(raw) if event["id"] != event_id: raise ValueError("wrong event id") headers = {} if event["type"] == "webhook.verify": headers["X-Quanteex-Webhook-Proof"] = mac(("verify." + event_id).encode()) return event, headers ```