Revyl Documentation

Partners

Partner API reference

Every partner endpoint, with its auth, request, responses, errors, and quotas.

The partner API lives under /api/v1/partner on your Revyl API base URL, such as https://backend.revyl.ai. To get a partner API key, email support@revyl.ai.

Requests

  • Auth: Authorization: Bearer <partner API key> on every request. The key identifies your platform; the account comes from the path or body. Keep the key on your servers.
  • Accounts: {external_account_id} is your ID for a customer account: 1 to 128 letters, digits, _, or -.
  • Request IDs: send a UUID in X-Request-Id, and Revyl returns it on the response for support.
  • Caching: responses that carry a credential or a dashboard link have Cache-Control: no-store. Don't log or cache them.

Errors

Every error the API defines has one shape. Branch on error.code, not on the message:

{
  "error": {
    "code": "not_connected",
    "message": "There's no connection for this external account."
  }
}

An already_connected error also carries connection. An unexpected 500 has no error.code; retry it with backoff.

StatusCodeMeaning
400invalid_requestThe request failed validation, requested workspace billing on automatic provisioning, or tried to change partner billing to workspace billing without fresh approval.
400authorization_pending, slow_down, access_denied, expired_tokenApproval polling outcomes. See Wait for approval.
401invalid_partner_credentialThe partner key is missing, invalid, or revoked.
403partner_not_allowedYour integration, or this account, isn't enabled in this environment.
403not_supported_for_connectionThis operation isn't available for this connection.
404not_connectedThere's no connection for this account.
409already_connectedThe account is already connected.
409connection_in_progressAnother request for this account is running. Retry after Retry-After.
409needs_supportRevyl found an inconsistent state. Contact support@revyl.ai.
429rate_limitedToo many requests this minute. Retry after Retry-After.
429daily_limit_reachedA daily cap is spent. It resets at 00:00 UTC.
503temporarily_unavailableRetry after Retry-After, with bounded backoff.

Quotas

Requests count against two per-minute buckets: one for your platform and one for each account. Responses report each bucket that was checked:

HeaderMeaning
X-RateLimit-Limit-Partner, X-RateLimit-Limit-AccountRequests allowed per UTC minute.
X-RateLimit-Remaining-Partner, X-RateLimit-Remaining-AccountRequests left this minute.
X-RateLimit-Reset-Partner, X-RateLimit-Reset-AccountWhen the window resets, in Unix seconds.

A missing header doesn't mean unlimited. The values are snapshots, so pace your requests and honor Retry-After on a 429. Two daily caps also reset at 00:00 UTC: new workspaces Revyl creates for your platform, and invitations per connection.

Endpoints

Connect an account

POST /api/v1/partner/connections

Body: external_account_id, external_account_name, organization_name, owner_email, and optional mode (auto or link_existing) and bill_to (workspace or partner). Names are 1 to 200 characters. Omitting bill_to requests workspace when approval is required and partner for a provisioned workspace. At approval, the selected organization must have an eligible paying plan for effective workspace billing; otherwise Revyl silently falls back to partner. Existing connections are unchanged. A provisioning request refuses explicit workspace billing with 400 invalid_request. Selecting the workspace previously provisioned for this account through link_existing keeps partner billing, even if it now has a paid plan. Older approval pages may omit bill_to when deciding; the server uses the mode bound to the pending row and rejects only explicit mismatches.

StatusBody
201connection (state: "connected") and credential
202connection (state: "awaiting_approval") and approval

Errors include 403 partner_not_allowed, 409 already_connected, 409 connection_in_progress, 409 needs_support, and 429 daily_limit_reached.

Collect an approved credential

POST /api/v1/partner/connections/{external_account_id}/approval/token

No body. 200 returns connection and credential, once. Until then it answers one of the 400 polling codes.

Get a connection

GET /api/v1/partner/connections/{external_account_id}

200 returns the connection:

{
  "external_account_id": "acct_123",
  "state": "connected",
  "organization": { "id": "<organization UUID>", "name": "Example Workspace" },
  "origin": "provisioned",
  "bill_to": "partner"
}

state is connected, awaiting_approval, or not_connected. organization is present only while connected. origin is provisioned when Revyl created the workspace and existing when an admin linked one. bill_to is partner or workspace: the requested mode before approval, then the effective mode resolved at approval. Read it again after approval rather than assuming the requested mode was granted. Existing connections remain partner until explicitly changed.

Change who pays

PATCH /api/v1/partner/connections/{external_account_id}/billing

Body: { "bill_to": "partner" } or { "bill_to": "workspace" }. 200 returns the updated connection. Changing workspace to partner takes effect immediately for new work. A request for the current value is idempotent. Existing work keeps its original payer.

Changing partner to workspace returns 400 invalid_request: disconnect and submit a new connect request with mode: "link_existing" and bill_to: "workspace" for fresh Owner or Admin approval. Other errors include 404 not_connected and 409 connection_in_progress.

Workspace-paid work uses the workspace's normal plan and limits. Device and build requests can return 402 when the payer's billing limits refuse new work or 503 when billing verification is temporarily unavailable. These execution errors use the execution API's detail response, not the partner management API's error.code envelope. A billing refusal is not an instruction to switch payers or charge the partner as a fallback.

Rotate the connection credential

POST /api/v1/partner/connections/{external_account_id}/credentials

No body. 201 returns credential: type: "api_key", secret, and expires_at. The replaced credential keeps working for a short grace period; older ones and session credentials stop at once. Errors include 404 not_connected and 409 connection_in_progress.

Mint a session credential

POST /api/v1/partner/connections/{external_account_id}/session-credentials

Optional body: { "ttl_seconds": 7200 }, from 60 to 14,400. 201 returns credential_id and credential: type: "session_token", secret, and expires_at. Errors include 404 not_connected.

Revoke a session credential

DELETE /api/v1/partner/connections/{external_account_id}/session-credentials/{credential_id}

204. An unknown ID also answers 204. It can also answer 409 connection_in_progress.

Invite a teammate

POST /api/v1/partner/connections/{external_account_id}/invitations

Body: { "email": "sam@example.com" }. 202 returns { "status": "sent" }, and the person joins as a Member. Revyl also answers 202 when it already invited that address this UTC day, without sending again. Errors include 400 invalid_request when Revyl rejects the invitation, 403 not_supported_for_connection for a linked organization, 404 not_connected, 409 connection_in_progress, and 429 daily_limit_reached.

POST /api/v1/partner/connections/{external_account_id}/dashboard-links

No body. 200 returns url, requires_login: true, and expires_at: null. See Dashboard links.

Read usage

GET /api/v1/partner/connections/{external_account_id}/usage?from=<ISO time>&to=<ISO time>

from and to are ISO 8601 times with a time zone, such as 2026-10-01T00:00:00Z.

200 returns period and usage: one row per feature, with seconds for device and build time and millicents for AI usage, for work started through the account's connections. The period is [from, to) and at most 93 days. Errors include 400 invalid_request and 404 not_connected for an account that was never connected.

Read billing usage

GET /api/v1/partner/usage

No parameters. Returns your partner-paid usage and cost so far in the current billing period, across every connected account. New work billed to a customer's workspace is excluded; work already started remains attributed to its original payer after a billing-mode change. Only your partner key works: connection credentials and session credentials get 401 invalid_partner_credential.

200 returns:

FieldMeaning
period.from, period.toThe current billing period, [from, to)
metersOne row for each metered feature on your plan, including features you haven't used
meters[].meterThe feature, such as ios_simulator_seconds, android_build_seconds or llm_usage_millicents
meters[].unitsecond, or millicent for AI usage (a thousandth of a cent)
meters[].quantityUnits used this period
meters[].unit_price_usdYour plan's current price for one unit
meters[].cost_usdWhat the feature has been charged this period, at the price in effect when each unit was used
total_cost_usdThe amount charged so far toward this period's invoice

Builds are metered too, as ios_build_seconds and android_build_seconds, alongside device time and AI usage. total_cost_usd is the invoice figure. After a plan change it can be slightly more than the sum of cost_usd, when usage carried over from the earlier plan was recorded before the period started. Figures can be up to a minute old. 503 temporarily_unavailable means usage couldn't be read; retry after Retry-After. Usage is never reported as zero in place of an error.

Read usage by customer

GET /api/v1/partner/usage/customers?limit=<1-100>&cursor=<cursor>

Lists your customers with each one's usage and estimated cost so far in the current billing period, limit customers per page (default 50). Only your partner key works.

200 returns:

FieldMeaning
period.from, period.toThe current billing period, the same as GET /api/v1/partner/usage
customersYour customers in external_account_id order, including customers with no usage this period and customers you've disconnected
customers[].external_account_idThe customer's account id
customers[].metersOne row for each metered feature on your plan
customers[].meters[].meter, unitThe feature and its unit, as in GET /api/v1/partner/usage
customers[].meters[].quantityUnits this customer used this period
customers[].meters[].untracked_quantityThe part of quantity not yet reflected in your billing total
customers[].meters[].unit_price_usdYour plan's current price for one unit
customers[].meters[].cost_usdquantity at unit_price_usd
customers[].total_cost_usdThe sum of the customer's cost_usd
next_cursorPass as cursor to read the next page; null on the last page

Per-customer costs are estimates of each customer's share at your plan's current prices. They are not invoice amounts, and their sum can differ from total_cost_usd in GET /api/v1/partner/usage, which is what you're invoiced. They differ when your plan's prices changed during the period, while usage is still being reported (untracked_quantity), and by rounding. 400 invalid_request means a bad limit or cursor, and 503 temporarily_unavailable means usage couldn't be read; retry after Retry-After.

Disconnect an account

DELETE /api/v1/partner/connections/{external_account_id}

204. Revokes the connection's credentials and session credentials and stops the live sessions started with them. App embeds keep working until you revoke them with DELETE /api/v1/embeds/{embed_id}. Safe to repeat. A 503 means something couldn't be stopped yet; retry to finish.

On this page