Eventlayer / Start building
TypeScript SDK
Install Eventlayer, configure a client and handle typed API results.
Use the eventlayer package from your server. It provides typed resource methods,
result handling, pagination and webhook verification.
Install and initialise
npm install eventlayerSet EVENTLAYER_KEY in your server environment, then initialise a client:
import { Eventlayer } from "eventlayer";
const eventlayer = new Eventlayer();For a complete runnable example, issue your first ticket.
Handle typed results
HTTP responses return { data, error, response }. Check error before reading
data. Network failures where no HTTP response is received still throw.
const { data: ticket, error } = await eventlayer.tickets.get({
ticketId: "tkt_your_ticket_id",
});
if (error) {
console.error(error.code, error.requestId);
} else {
console.log(ticket.status);
}Configure the client
import { Eventlayer } from "eventlayer";
const eventlayer = new Eventlayer(undefined, {
timeout: 10_000,
maxRetries: 0,
});Passing undefined keeps the environment key. You can pass a key explicitly as
the first argument in runtimes without process.env. Read
retries and recovery before enabling retries for writes.
Find the right method
| Resource | Example method | Credential |
|---|---|---|
| Events | eventlayer.events.create() | API key |
| Attendees | eventlayer.attendees.create() | API key |
| Tickets | eventlayer.tickets.create() | API key |
| Check-in | eventlayer.tickets.checkIn() | API key |
| Wallet | eventlayer.tickets.generateAppleWalletPassSignedUrl() | API key |
| Webhook administration | eventlayer.webhookEndpoints.create() | Dashboard access token |
Methods above identify the resource operations; their required arguments are shown in the guides and API reference. Webhook administration includes endpoint management, delivery inspection and replay. API keys cannot authorize these operations. See authentication for dashboard access tokens.
Keep going
Use pagination to iterate through collections and webhook verification to validate signed events. The package documentation has the SDK’s full configuration and resource details.