Skip to content

Ticketing accounts

The ticketing accounts API manages two kinds of account in the ticketing product: admins (staff who use the ticketing portal) and customers (people who buy tickets). It covers ticketing sign-in, customer self-registration, password reset, profiles, and account management for staff.

Not the platform sign-in

Users of the PlayTelly consoles sign in with the Authentication API and read their profile with the Identity API. The routes on this page are only for the ticketing portal and customer app.

Resources

Resource What it is
Token pair An access token and a refresh token issued by /auth/login, used on the customer routes and on /auth/logout and /auth/validate.
Admin A staff account with a role: SYSADMIN, ADMIN or MEMBER.
Customer A ticket buyer with an email, identification number and contact number.

Authentication and permissions

Two kinds of token are in use, so check the table for each route:

  • Ticketing token: the pair returned by POST /auth/login. Send the access token as Authorization: Bearer <ACCESS_TOKEN>.
  • Platform token: the token from the Authentication API. Staff routes use it, together with a workspace permission. See Authentication.
Action Token Permission
Sign in, refresh a token, register a customer, reset a password None (refresh needs the refresh token) Public
Sign out, validate a token Ticketing token Any
Read a customer profile None Public (needs the custId)
Update own customer profile, change own customer password Ticketing token of a customer Role CUSTOMER
Read or update own admin profile, change own admin password Platform token workspace:admin-profile:manage
List, create, update or delete admins Platform token workspace:admin-management:manage
List customers Platform token workspace:customers:view

Base path

Served by CoreAPI. Paths are not under /api/v1.

https://<API_HOST>/auth/…
https://<API_HOST>/api/admin/{workspaceId}/…
https://<API_HOST>/api/customer/…

{workspaceId} is the ID of the workspace whose permission is checked. It must belong to the organization in your platform token, otherwise the request returns 403.

Capabilities

  • Admin and customer sign-in, token refresh, sign-out, token validation
  • Customer self-registration and password reset by email (both account types)
  • Admin profile: read, update, change password
  • Admin management: list, create, update, delete
  • Customer profile: read, update, change password
  • Customer list for staff, with search and paging

The admin list and the customer list cover every account, not only those of one workspace. The workspace ID in the path is used for the permission check only.

Object model

Token pair

Field Type Description
accessToken string Short-lived token for API calls.
refreshToken string Token to get a new pair from /auth/refresh-token.
tokenType string Always Bearer.
expiresIn integer Access token lifetime in seconds.
user object The account: for an admin adminId, username, role, fullName, email, contactNo, isDisabled; for a customer custId, identificationNo, role (CUSTOMER), fullName, email, contactNo, isDisabled.

Admin

Field Type Required on create Description
adminId integer Read-only Admin ID, set by the server.
username string (max 255) Yes Sign-in name. Unique. Write-once.
password string (min 8) Yes Initial password. Never returned.
fullName string (max 255) Yes Display name.
email string (email) Yes Email address.
contactNo string (max 255) Yes Phone number.
role string Yes SYSADMIN (full access including admin management), ADMIN (manage tickets, orders and customers) or MEMBER (read-only).
isDisabled boolean No true blocks sign-in. Default false.
{
  "adminId": 12,
  "username": "newadmin",
  "fullName": "New Admin",
  "email": "newadmin@example.com",
  "contactNo": "+60123456780",
  "role": "MEMBER",
  "isDisabled": false
}

Customer

Field Type Required on create Description
custId string Read-only Customer ID, set by the server.
email string (email, max 255) Yes Sign-in name. Unique.
password string (8 to 100 characters) No Optional at registration. Never returned.
identificationNo string (max 255) Yes National ID or passport number.
fullName string (max 255) Yes Display name.
contactNo string (max 255) Yes Phone number.
isDisabled boolean Read-only true blocks sign-in.
createdAt string (ISO 8601) Read-only Registration time.
{
  "custId": "CUST-001",
  "email": "user@example.com",
  "identificationNo": "900101-14-1234",
  "fullName": "Ahmad Bin Ali",
  "contactNo": "+60123456789",
  "isDisabled": false
}

Response format

These routes use the ticketing envelope, not the shape of the platform routes:

{ "respCode": 2000, "respDesc": "Success", "result": { "status": true } }

Errors return the same envelope with respCode 4000 and a reason in respDesc. Responses from the sign-in and permission checks (401, 403) are {"message": "..."} instead.

Lists

The customer list is paginated with page (from 1, default 1) and limit (default 20, maximum 100; larger values become 100), newest first, and takes a query search. The page is in result: customers, totalCount (customers matching the search), hasNext, page and limit. The admin list is not paginated: it returns every admin, in no guaranteed order. Neither list is limited to the workspace in the path.

curl "https://<API_HOST>/api/customer/{workspaceId}/management?page=1&limit=20&query=ahmad" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"
{
  "respCode": 2000,
  "respDesc": "Success",
  "result": {
    "customers": [
      {
        "custId": "CUST-001",
        "email": "user@example.com",
        "fullName": "Ahmad Bin Ali",
        "identificationNo": "900101-14-1234",
        "isDisabled": false,
        "contactNo": "+60123456789",
        "orderTicketGroups": [],
        "customersLogs": []
      }
    ],
    "totalCount": 1,
    "hasNext": false,
    "page": 1,
    "limit": 20
  }
}

The admin list has the same envelope with "result": { "admins": [ … ] }.

Errors

Status When What to do
400 A required field is missing or invalid, including userType on sign-in. respDesc names the problem. A wrong current password is also 400. Fix the request.
401 Wrong credentials or a disabled account on sign-in (respDesc says which), or an invalid, expired or missing token. Sign in again.
403 The platform token lacks the permission, the workspace belongs to another organization, or the account is not a customer. The body is {"message": "Forbidden - ..."}. Ask an administrator to grant the permission.
404 The admin or customer does not exist. Check the ID.
409 A customer email or an admin username is already in use. Use a different value.

Example bodies:

{ "respCode": 4000, "respDesc": "Invalid request body", "result": null }

400, and the same envelope for 401 on sign-in (for example "Invalid or expired token"), 404 ("Customer does not exist", "Admin not found") and 409 ("Username already exists", "A customer with this email already exists"). respCode is 4000 for every error.

{ "message": "Unauthorized - No token provided" }

401 from the token check on the routes that take a platform token or the ticketing token. The text after the dash changes with the cause.

{ "message": "Forbidden - Insufficient permissions" }

403 from the permission check and from the customer role check.

{ "respCode": 4000, "respDesc": "Could not get customers: <reason>", "result": null }

500 when a list can't be read.

Endpoints

!! SWAGGER ERROR: Cannot use 2 different swagger files with same filename in same page. !!