Unidy Docs

Make your first request

Complete an initial authenticated request.

Get an application access token and use it to read one page of users. This walkthrough is for a trusted backend using OAuth client credentials.

The backend sends its credentials directly to the token endpoint and receives an application access token. This exchange has no customer sign-in, browser redirect, or authorization code.

For a customer granting access to their own tickets or subscriptions, use User-authorized access. For customer sign-in and profile UI, use the SDK HTTP API.

Before you start

You need:

  • Your Unidy tenant's HTTPS host.
  • A confidential OAuth application and its client ID and secret.
  • users:read explicitly provisioned on that application.
  • A terminal with curl for this read-only example.

An administrator with global OAuth-application write permission can provision the application under Auth → OAuth Applications. Ask them to share the secret through an approved secret store. Secret access requires appropriate write permission; merely being able to open an application does not imply access to its secret.

The Info tab of an OAuth application, with the Credentials block highlighted

AUTH → OAUTH APPLICATIONS → an application → INFO — the two values you need · highlight on the Credentials block. Client ID is shown in full with a copy button; Client Secret is a masked field — click it to reveal, or use the copy button beside it.

Keep the client secret on your backend. Public browser and native applications use a different OAuth flow; they must not embed this secret or use client credentials.

1. Request an access token

Send a form-encoded request. Replace the example values locally; do not paste a real secret into shared logs, tickets, or source control.

bash
curl --fail-with-body --request POST 'https://your-tenant-host/oauth/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=client_credentials' \
  --data-urlencode 'client_id=YOUR_CLIENT_ID' \
  --data-urlencode 'client_secret=YOUR_CLIENT_SECRET' \
  --data-urlencode 'scope=users:read'

A successful response contains an access token and its lifetime:

json
{
  "access_token": "YOUR_ACCESS_TOKEN",
  "token_type": "Bearer",
  "expires_in": 7200,
  "scope": "users:read",
  "created_at": 1790899200
}

Use the returned expires_in value, not the example's lifetime. Cache the token until shortly before expiry, with a small clock-skew margin. Coordinate refresh between concurrent requests so they do not all request new tokens at once. Client credentials does not return a refresh token: request a new access token using the same grant when necessary.

Confirm that scope contains the permissions your request needs. Request only resource scopes for this grant; identity scopes such as openid, profile, and email belong to user authentication.

2. Read one page of users

Supply the token from step 1 and a date for changed_since. The filter is date-based; choose an earlier date if you want to include older accounts.

bash
curl --fail-with-body --get 'https://your-tenant-host/api/v1/users' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --data-urlencode 'changed_since=2026-01-01' \
  --data-urlencode 'page=1' \
  --data-urlencode 'limit=25'

The response has a results array and meta pagination metadata. Each user's id is its public Unidy UUID. results: [] is a successful read with no matching users, not an authentication failure.

Check the HTTP status before parsing the body. A successful JSON response proves that the token is accepted and has access to this operation. It does not prove that every resource or brand is accessible.

If the request fails

ResponseCheck
OAuth invalid_clientTenant host, client ID, secret, and confidential application configuration.
OAuth invalid_scopeRequested scope spelling and the application's provisioned scope list.
API 400Include a valid changed_since date and use an application token for this route.
API 401Token expiry or revocation; inspect WWW-Authenticate. An error body may be empty.
API 403Token scopes and applicable access restrictions. Repeating the same request with the same permissions will not fix it.
API 429Wait at least Retry-After before retrying; reduce concurrency.

Next steps

The generated Swagger UI for API V1, with the definition picker highlighted

/SWAGGER/API/HTML — the generated OpenAPI 3.1 reference · highlight on the definition picker. The same page also serves SDK API V1, which is the other surface entirely.

Was this page helpful?