Getting started overview

Integrating with Lanyard's API involves a sequence of steps designed to enable programmatic access to event management functionalities. This guide outlines the process from initial account creation and credential acquisition to executing a test API request. The Lanyard API supports operations for event registration, attendee management, and ticketing, catering to custom event platforms and scalable solutions Lanyard documentation portal.

The core process includes:

  1. Account Creation: Establishing a Lanyard account to access the developer dashboard.
  2. API Key Generation: Obtaining the necessary credentials for authenticating API requests.
  3. First API Request: Executing a basic API call to verify setup and connectivity.

Lanyard provides official SDKs for Node.js, Python, and Ruby, along with comprehensive API reference documentation Lanyard API reference guide. These resources facilitate direct integration and reduce the boilerplate code required for API interaction.

Quick Reference Steps

Step What to Do Where
1. Sign Up Create a Lanyard account. Lanyard homepage
2. Get API Keys Navigate to API Settings and generate a new API key. Lanyard Developer Dashboard > API Settings
3. Install SDK (Optional) Install the relevant Lanyard SDK for your programming language. Lanyard SDK installation guides
4. Make First Call Send an authenticated request to a Lanyard API endpoint. Local development environment / cURL

Create an account and get keys

To begin using Lanyard's API, the first step is to create an account. Lanyard offers a Developer Plan which includes a free tier supporting up to 50 registrations per month. This plan is suitable for initial development and testing.

Account Registration

  1. Navigate to the Lanyard website.
  2. Click on the "Sign Up" or "Get Started Free" button.
  3. Provide the required information, typically an email address and password.
  4. Verify your email address if prompted. This step ensures account security and access to the dashboard.

Upon successful registration, you will be directed to the Lanyard Developer Dashboard.

Obtaining API Credentials

API keys are essential for authenticating your requests to the Lanyard API. These keys link your application to your Lanyard account and ensure that only authorized calls are processed. Lanyard uses API keys for authentication, which should be treated as sensitive credentials.

  1. From the Lanyard Developer Dashboard, locate the "API Settings" or "Developer Settings" section.
  2. Within this section, you will find an option to generate new API keys. It is common practice to generate separate keys for development and production environments.
  3. Click "Generate New Key" and provide a descriptive name for the key (e.g., "My Development Key").
  4. The API key will be displayed. Copy this key immediately, as it may not be retrievable after you navigate away from the page due to security measures. Store it securely, preferably in environment variables or a secrets management system, rather than hardcoding it directly into your application code.

For enhanced security, Lanyard's API keys typically follow industry best practices for OAuth 2.0 and API security, though Lanyard uses a direct API key authentication model. Ensure your keys are protected against unauthorized access.

Your first request

Once you have an API key, you can make your first authenticated request to the Lanyard API. This section demonstrates how to retrieve a list of events using cURL and provides examples for Node.js and Python, leveraging the official SDKs.

Base URL

All Lanyard API requests target a specific base URL, which is documented in the Lanyard API reference. Ensure you use the correct base URL for your environment (e.g., https://api.lanyard.com/v1).

Authentication Header

Lanyard API requests require your API key to be passed in the Authorization header using the Bearer scheme. For example: Authorization: Bearer YOUR_API_KEY.

Example: List Events (cURL)

This cURL command retrieves a list of events. Replace YOUR_API_KEY with your actual Lanyard API key.

curl -X GET \
  'https://api.lanyard.com/v1/events' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'

A successful response will return a JSON array of event objects. An empty array indicates no events have been created yet or are visible to your API key.

Example: List Events (Node.js SDK)

First, install the Node.js SDK:

npm install lanyard-sdk

Then, use the following JavaScript code:

const Lanyard = require('lanyard-sdk');

const lanyard = new Lanyard({ apiKey: 'YOUR_API_KEY' });

async function getEvents() {
  try {
    const response = await lanyard.events.list();
    console.log('Events:', response.data);
  } catch (error) {
    console.error('Error fetching events:', error);
  }
}

getEvents();

Example: List Events (Python SDK)

First, install the Python SDK:

pip install lanyard-sdk

Then, use the following Python code:

import os
from lanyard_sdk import Lanyard

lanyard = Lanyard(api_key=os.environ.get('LANYARD_API_KEY'))

def get_events():
    try:
        response = lanyard.events.list()
        print('Events:', response.data)
    except Exception as e:
        print('Error fetching events:', e)

if __name__ == '__main__':
    get_events()

For the Python example, it is recommended to store your API key in an environment variable named LANYARD_API_KEY for security reasons.

Common next steps

After successfully making your first API call, you can proceed with further integration and development:

  • Create Events: Use the Lanyard API to programmatically create new events, specifying details such as name, date, and capacity. Refer to the Create Event API documentation.
  • Manage Attendees: Integrate attendee registration flows by using the API to add, update, or retrieve attendee information for your events. This includes handling guest lists and registration statuses Lanyard Attendee Management API.
  • Implement Ticketing: If your event requires tickets, explore Lanyard's ticketing system API to generate, distribute, and validate tickets. This often involves creating ticket types and managing inventory.
  • Webhooks: Configure webhooks to receive real-time notifications about important events, such as new registrations or ticket purchases. Webhooks enable your application to react to changes without constant polling Lanyard Webhooks guide. For general webhook security, consider best practices for Twilio's webhook security guidelines.
  • Explore SDKs: Deepen your understanding of the available SDKs (Node.js, Python, Ruby) to streamline development. SDKs abstract away HTTP request details and provide idiomatic interfaces for interacting with the API.
  • Monitor API Usage: Utilize the Lanyard Developer Dashboard to monitor your API usage, track request volumes, and identify any potential issues.

Troubleshooting the first call

If your first API call to Lanyard encounters issues, consider the following common troubleshooting steps:

  • Incorrect API Key: Double-check that the API key provided in the Authorization: Bearer header is correct and has not expired. Ensure there are no leading or trailing spaces.
  • Missing Authorization Header: Verify that the Authorization header is present in your request. Without it, the API will reject the request as unauthorized.
  • Invalid Base URL: Confirm that you are using the correct base URL for the Lanyard API (e.g., https://api.lanyard.com/v1). Refer to the Lanyard API reference documentation for the exact endpoint.
  • Network Issues: Ensure your development environment has a stable internet connection and is not blocked by a firewall or proxy from accessing api.lanyard.com.
  • Rate Limiting: While less common for a first call, repeated failed requests can lead to temporary rate limiting. If you suspect this, wait a few minutes and try again. Lanyard's API documentation outlines its rate limiting policies.
  • Error Responses: Analyze the error message and HTTP status code returned by the API. Common status codes include:
    • 401 Unauthorized: Indicates an issue with your API key or authentication.
    • 403 Forbidden: Your API key may not have the necessary permissions for the requested action.
    • 404 Not Found: The requested resource or endpoint does not exist.
    • 429 Too Many Requests: You have exceeded the API rate limits.
    • 5xx Server Error: An issue on Lanyard's server side.
  • SDK Usage: If using an SDK, ensure it is correctly initialized with your API key and that you are calling the methods as documented in the Lanyard SDK documentation.
  • Content-Type Header: For requests sending data (e.g., creating an event), ensure the Content-Type: application/json header is set if you are sending JSON in the request body.

If problems persist, consult the Lanyard support documentation or contact their support channel for assistance.