Apps & OAuth

There are two ways to authenticate. Building an app for many customers? Use OAuth: each workspace installs the app and grants permissions. Connecting your own workspace's systems? Use an API key.

Pick an authentication method

OAuth appAPI key
ForPartners building an app for many workspacesOne workspace connecting its own systems
HeaderAuthorization: Bearer …X-Api-Key: …
PermissionsIntersection of what the app requests, what it is allowed and what the workspace grantsChosen when the key is created
Lifetime1-hour token; request a new one when it expiresUntil revoked

API key →

Get an access token (client credentials)

Once a workspace installs your app, your server exchanges client_id + client_secret for a token per workspace.

curl
curl -X POST https://api.nextx.vn/api/v1/iam/oauth2/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET" \
  -d "workspace_id=WORKSPACE_GUID" \
  -d "scope=crm.contacts.view sales.orders.view"

Response:

JSON
{
  "access_token": "eyJhbGciOiJSUzI1Ni...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "crm.contacts.view sales.orders.view"
}
  • The granted scope = requested ∩ allowed (app) ∩ granted (workspace consent).
  • The response carries a refresh_token field but it is always empty — it cannot renew anything. When the token expires, call this endpoint again.
  • workspace_id = the GUID of the workspace that installed the app (one token per workspace).

Install link and consent

Workspaces install your app from its install link; the consent screen lists exactly the scopes the app requests. Try it on your own workspace in Development mode, then Publish so other customers can install it.

See the steps in the Quickstart →

Scopes (permissions)

A scope is a permission code shaped like service.resource.verb, where the verb is view (read) or manage (write). The app only requests scopes; only the workspace can grant them.

CRM

crm.contacts.viewcrm.contacts.createcrm.opportunities.viewcrm.opportunities.managecrm.reports.viewcrm.tasks.manage

Omnichannel chat

comm.conversations.handle

Sales

sales.orders.viewsales.products.viewsales.customers.view

Office

office.base.record.viewoffice.base.record.manageoffice.approval.instance.viewoffice.approval.instance.manage

HR

hrm.attendance_devices.viewhrm.attendance_raw_punches.view

DMS

dms.catalog.viewdms.checkins.viewdms.daily_plans.viewdms.outlets.viewdms.orders.viewdms.routes.view

Call center

call.agents.viewcall.campaigns.viewcall.call_flows.viewcall.ivr_flows.viewcall.phone_numbers.viewcall.calls.viewcall.queues.view

Marketing

marketing.email_campaigns.viewmarketing.email_templates.viewmarketing.integrations.viewmarketing.reports.viewmarketing.sender_profiles.view

Payments

payment.intents.viewpayment.refunds.viewpayment.transactions.viewpayment.subscriptions.viewpayment.reports.view

E-invoice

einvoice.invoices.vieweinvoice.series.vieweinvoice.reports.vieweinvoice.settings.view