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 app | API key | |
|---|---|---|
| For | Partners building an app for many workspaces | One workspace connecting its own systems |
| Header | Authorization: Bearer … | X-Api-Key: … |
| Permissions | Intersection of what the app requests, what it is allowed and what the workspace grants | Chosen when the key is created |
| Lifetime | 1-hour token; request a new one when it expires | Until revoked |
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 -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:
{
"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_tokenfield 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.manageOmnichannel chat
comm.conversations.handleSales
sales.orders.viewsales.products.viewsales.customers.viewOffice
office.base.record.viewoffice.base.record.manageoffice.approval.instance.viewoffice.approval.instance.manageHR
hrm.attendance_devices.viewhrm.attendance_raw_punches.viewDMS
dms.catalog.viewdms.checkins.viewdms.daily_plans.viewdms.outlets.viewdms.orders.viewdms.routes.viewCall center
call.agents.viewcall.campaigns.viewcall.call_flows.viewcall.ivr_flows.viewcall.phone_numbers.viewcall.calls.viewcall.queues.viewMarketing
marketing.email_campaigns.viewmarketing.email_templates.viewmarketing.integrations.viewmarketing.reports.viewmarketing.sender_profiles.viewPayments
payment.intents.viewpayment.refunds.viewpayment.transactions.viewpayment.subscriptions.viewpayment.reports.viewE-invoice
einvoice.invoices.vieweinvoice.series.vieweinvoice.reports.vieweinvoice.settings.view