Unidy Docs

REST API v2

Connect with API keys or delegated OAuth, select a brand, and use the v2 contract.

REST API v2 provides a consistent interface for data, customer profiles and supported brand configuration. It is available on installations with API v2 enabled. Feature availability still depends on the selected brand and the caller's permissions; a server merge does not establish availability on your instance.

Existing REST API v1 integrations keep their own credentials, scopes and response formats. Moving to v2 requires an explicit client migration.

Make a first read

Ask an administrator to enable API v2 and provision an API key with read permission for the required resources and brands. In the dashboard, open Developer → API Keys, create the key, assign its roles and brand restrictions, and store its token securely. A valid key with no relevant permission cannot read customer data.

bash
curl 'https://YOUR_BRAND_HOST/api/v2/data/users?page=1&per_page=25' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Inspect records and meta.pagination. Save meta.request_id when reporting a failure, with credentials and customer data removed.

Authentication and brand selection

CredentialActs asRequirements
API keyThe key's own role assignmentsEnabled, unexpired key with the required resource permissions. A personal key additionally identifies its owner for /me.
OAuth access token with api_v2The authorizing user's current permissionsAPI v2 and its MCP/OAuth capability enabled; application explicitly configured for api_v2; Authorization Code with S256 PKCE. Client credentials cannot obtain this delegated access.

An SDK application key and an ordinary v1 OAuth token do not substitute for these credentials. Delegated OAuth has additional restrictions on account-security operations and ticket movement; see Customer data and /me.

Data requests normally use the brand matching the request host. To select another permitted brand, send its name:

bash
curl 'https://YOUR_BRAND_HOST/api/v2/data/tickets?page=1' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'X-Unidy-Brand: partners'

The header selects a brand within the caller's allowed brands; it grants no additional access. An empty, unknown or inaccessible brand produces 404 not_found, rather than falling back to the host. Missing or invalid credentials produce 401 unauthorized before brand lookup.

Brand configuration routes select their brand from the URL instead.

Request and response contract

JSON writes wrap fields in payload.data. Operation options belong beside data, and optional attribution belongs in root meta.source:

json
{
  "payload": {
    "data": { "first_name": "Alex" }
  },
  "meta": { "source": "customer-portal" }
}

Send Content-Type: application/json. Single reads and most writes return { "record": ..., "meta": ... }; collections return { "records": [...], "meta": ... }. Follow the operation for successful empty responses.

Errors use identifier, a details array and meta.request_id. Details can name a nested field, a stable code, and a batch entry index. Human-readable messages can be translated; branch on identifiers and codes.

StatusTypical identifierRecovery
400bad_request, invalid_queryCorrect JSON, pagination, filters or query values.
401unauthorizedCheck the credential and its expiry/revocation.
403forbidden, feature_not_enabled, real_email_requiredCheck roles, operation restrictions and the required account step.
404not_foundVerify the host, brand and accessible resource identifier.
409conflict, multiple_matchesInspect the operation-specific conflict; do not assume success.
422unprocessable_content, field_not_findableCorrect the named fields or lookup constraints.
429rate_limitedHonor Retry-After.

After a timeout or server failure, reconcile a write before retrying. V2 has no universal idempotency-key guarantee; loyalty award ingestion has its own explicit contract.

Continue by task

On your selected instance, open /swagger/v2/html for the interactive reference or download /swagger/v2/json. These routes require API v2 to be enabled. The older /api-docs/v2 URL redirects to the current viewer. Use the schema from the instance you call; enabled resources and deployed versions can differ.

Was this page helpful?