Skip to content
Docs
Quickstart

Your First API Call

Call the API for the first time: read your own profile and your organisations, with a token you already have.

Let's make your first API call to Ticketlayer!

Prerequisites#

  • A credential: an organisation API key (tlak_) or a staff access token. See Keys and authentication.
  • A Ticketlayer account with at least one organisation

Get Your User Profile#

The simplest API call is retrieving your own user profile. This one needs a staff token (it is a "who am I" call, so API keys are refused with 404); the organisation and event calls further down work with an API key too.

GET/meGet Current UserFull docs →
import { BackstageClient } from '@ticketlayer/backstage';const client = new BackstageClient({  organisationSlug: 'your-org',});client.setAccessToken('YOUR_ACCESS_TOKEN');// Get the current authenticated userconst user = await client.users.getMe();console.log(`Hello, ${user.firstName} ${user.lastName}!`);console.log(`Email: ${user.email}`);console.log(`User ID: ${user.id}`);

The SDK automatically unwraps the data field from the JSend response, so you receive the inner object directly.

Get Your Organisations#

Once you have your profile, you can retrieve the list of organisations you have access to:

GET/me/organisationsGet My OrganisationsFull docs →
import { BackstageClient } from '@ticketlayer/backstage';const client = new BackstageClient({  organisationSlug: 'your-org',});client.setAccessToken('YOUR_ACCESS_TOKEN');// Get all organisations you have access toconst organisations = await client.users.getMyOrganisations();for (const org of organisations) {  console.log(`${org.name} (${org.slug})`);}

Next Steps#

Now that you've made your first API call: