Generate an access token

POST https://api.zenoti.com/v1/tokens

Generates a new access token using employee credentials. The access token is valid for 24 hours and must be included in the Authorization header of all subsequent API requests.

Before you begin

Permission: Manage API Keys (under Administrator) — Required to access Zenoti APIs.

Endpoint

POST /v1/tokens

Base URL: https://api.zenoti.com

Request

Headers

Header Required Description
Content-Type Yes application/json

Request body

Field Type Required Description
account_name string Yes Zenoti organization account name as it appears in the URL
user_name string Yes Employee username
password string Yes Employee password
grant_type string Yes Must be password
app_id string Yes Application ID from your backend application
app_secret string Yes Application secret from your backend application
device_id string Yes Identifier for the device making the request

Response

Success (200 OK)

{
  "credentials": {
    "access_token": "AN:orgname|$ARD#...",
    "access_token_expiry": "2026-03-08T11:19:18.701Z",
    "refresh_token": "AN:orgname|$ARD#...",
    "refresh_token_expiry": "2026-06-05T11:19:18.717Z",
    "token_type": "bearer",
    "token_id": "b2bf3b23-430a-4aba-bec4-c70c21de733a",
    "app_id": "DB6D3C87-7913-43E3-81B6-08B0F1708D09",
    "user_type": "Employee"
  },
  "error": null
}

Response fields

Field Type Description
credentials.access_token string Bearer token for API requests
credentials.access_token_expiry datetime Token expiry (24 hours from generation)
credentials.refresh_token string Token used to obtain a new access token without re-authenticating
credentials.refresh_token_expiry datetime Refresh token expiry (90 days)
credentials.token_type string Always bearer
credentials.user_type string Guest or Employee
error object null on success, error object on failure

Example

curl --request POST \
  --url 'https://api.zenoti.com/v1/tokens' \
  --header 'Content-Type: application/json' \
  --data '{
    "account_name": "{{account_name}}",
    "user_name": "{{user_name}}",
    "password": "{{password}}",
    "grant_type": "password",
    "app_id": "{{app_id}}",
    "app_secret": "{{app_secret}}",
    "device_id": "{{device_id}}"
  }'
const response = await fetch('https://api.zenoti.com/v1/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  account_name: '{{account_name}}',
  user_name: '{{user_name}}',
  password: '{{password}}',
  grant_type: 'password',
  app_id: '{{app_id}}',
  app_secret: '{{app_secret}}',
  device_id: '{{device_id}}'
})
});
const data = await response.json();
import requests

response = requests.post(
    'https://api.zenoti.com/v1/tokens',
    json={'account_name': '{{account_name}}', 'user_name': '{{user_name}}', 'password': '{{password}}', 'grant_type': 'password', 'app_id': '{{app_id}}', 'app_secret': '{{app_secret}}', 'device_id': '{{device_id}}'}
)
data = response.json()
using var client = new HttpClient();
var content = new StringContent(
    JsonSerializer.Serialize(new {
    accountName = "{{account_name}}",
    userName = "{{user_name}}",
    password = "{{password}}",
    grantType = "password",
    appId = "{{app_id}}",
    appSecret = "{{app_secret}}",
    deviceId = "{{device_id}}"
}),
    Encoding.UTF8, "application/json");
var response = await client.PostAsync(
    "https://api.zenoti.com/v1/tokens", content);
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'

uri = URI('https://api.zenoti.com/v1/tokens')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request.body = { account_name: '{{account_name}}', user_name: '{{user_name}}', password: '{{password}}', grant_type: 'password', app_id: '{{app_id}}', app_secret: '{{app_secret}}', device_id: '{{device_id}}' }.to_json
response = http.request(request)
data = JSON.parse(response.body)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.zenoti.com/v1/tokens');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['account_name' => '{{account_name}}', 'user_name' => '{{user_name}}', 'password' => '{{password}}', 'grant_type' => 'password', 'app_id' => '{{app_id}}', 'app_secret' => '{{app_secret}}', 'device_id' => '{{device_id}}']));
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);

Error codes

Status Description
400 Bad request — invalid credentials or missing fields
401 Unauthorized — incorrect username or password