Authentication

Authentication is required to access protected resources in the Gatsby API. On this page, we'll explain how to authenticate with the API and retrieve your user information.

Overview

To use the Gatsby REST API, you need to:

  1. Log in with your email and password to obtain an access token
  2. Include this token in all subsequent requests in the Authorization header
  3. Include your organization slug in the organizationSlug header

All requests (except for login) require both the access token and organization slug to be present in the headers.

Authorization: Bearer {accessToken}
organizationSlug: {organizationSlug}

POST/login

Login

This endpoint allows you to authenticate with the Gatsby API using your email and password. Upon successful authentication, you will receive an access token and a list of organization slugs that you have access to.

Required attributes

  • Name
    email
    Type
    string
    Description

    Your Gatsby account email address.

  • Name
    password
    Type
    string
    Description

    Your Gatsby account password.

Request

POST
/login
curl https://rest.gatsby.events/login \
  -d '{"email":"[email protected]","password":"your-password"}'

Response

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "organizationSlugs": [
    "gatsby-labs",
    "acme-inc"
  ]
}

GET/me

Get current user

This endpoint allows you to retrieve information about the currently authenticated user. The response includes the user's name, email, role, and a list of organization slugs they have access to.

Request

GET
/me
curl https://rest.gatsby.events/me \
  -H "Authorization: Bearer {accessToken}"

Response

{
  "firstName": "John",
  "lastName": "Doe",
  "email": "[email protected]",
  "role": "admin",
  "organizationSlugs": [
    "gatsby-labs", 
    "acme-inc"
  ]
}

Was this page helpful?