API Reference

How to authenticate Layer API requests

The Layer API uses an API Token to authenticate requests. You can view and manage your API Token in the Layer Account Dashboard.

Get Your API Token

  1. Log into your Layer account
  2. Open your user account dashboard by clicking here
  3. Scroll down to the section API and click to open the panel
  4. Inside the panel, you'll find your current API token. Copy it or generate a new token by clicking Generate New Token

Your API Token is tied directly to your user account and carries access to all of the projects you have access to, so be sure to keep it secure! Do not share your API Token in publicly accessible areas such as GitHub, client-side code, and so forth.

Using Your API Token

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

To use your token in a request, create a header parameter with the key of Authorization and the value of Bearer {YOUR_TOKEN} You will need to prepend your Token with the word Bearer followed by one space, otherwise your request will fail. Here is an example:

curl --location 'https://api.layer.team' \
--header 'Authorization: Bearer {YOUR API TOKEN}'

Generating a new Token

Tokens expire after 30 days. Because of this, you will regularly need to generate a new Token. You can do this by following these steps:

  1. Open your user account dashboard
  2. Scroll down to the section API and click to open the panel
  3. Inside the panel, you'll find your current API token as well as it's expiration date.
  4. Click the Generate New Token button to create a new token.

Note: Generating a new Token will invalidate any previous tokens

Errors

Expired Token

Tokens expire after 30 days. If you are receiving an error, it could be due to an expired token.