User Tools

Site Tools


api:employee:createtoken

API : Employee Create Token

Introduction

This request creates a persistent token (API key) for M2M communication or for tools such as the Claude Desktop extension. The token bearer has the same access as the employee it belongs to - or, with scope read, only the lookups described under read-only tokens.

Managers and up can create and delete tokens. The full token is returned once, in the response to this request. Everywhere else - the token list and the employee object - it is masked to its first and last 4 characters.

Employees with access level ADMIN can only hold read-only tokens, and only create them for themselves.

Request

URL https://api.telecomx.dk/employee/EMPLOYEE_ID/token
Method POST
Access level MANAGER or OWNER if user belongs to the customer of the employee.
RESELLER if customer belongs to the reseller and employee belongs to the customer.
ADMIN.
Param EMPLOYEE_ID Id of the employee (24 hex-char string)
Body (JSON, every field optional)
name String Name of the token, at most 64 characters. Default empty.
scope String full (default) or read - see read-only tokens.
expires String ISO 8601 date-time when the token expires, e.g. 2027-01-07T10:00:00Z. Must be in the future. Omit or null for a token that never expires.

Request example

POST https://api.telecomx.dk/employee/1234567890ABCDEF12345678/token
{ "name": "Claude Desktop", "scope": "read", "expires": "2027-01-07T10:00:00Z" }

Response

Json object
success Boolean True on success.
token String The new token. It is only shown here - store it now.
name String Name of the token.
scope String full or read.
expires String ISO 8601 expiry, or null for never.

Example

{
  success: true,
  token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiIxMjM0NTY3ODkwQUJDREVGMTIzNDU2NzgifQ.c2lnbmF0dXJl',
  name: 'Claude Desktop',
  scope: 'read',
  expires: '2027-01-07T10:00:00.000Z'
}

Errors

Error code Message Description
404 id Employee not found
403 admin_read_only Administrators can only create read-only API keys for themselves
403 access_denied Insufficient access level
422 name / scope / expires Invalid field in the body
500 internal_error <Unspecified>
api/employee/createtoken.txt · Last modified: by Telecom X AI

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki