Skip to main content

Setup

Navigate to the settings page in Levers app, and scroll to the API keys section. Click on Add API key. Enter the name of the key and click Create. Copy the client id and client secret and save it in a secure manner.

Integration

API Authentication

Learn how to authenticate your API requests using your client credentials.

Quickstart Code

Get started with sample code for making your first API call.

API Authentication

To authenticate with the Levers API, you need to obtain a bearer token using your client credentials.

Step 1: Get Your Access Token

Important Token Behavior:
  • Dev environment: Tokens are valid for 24 hours
  • Production: Tokens are valid for 5 minutes
Issuing a new token will invalidate all existing tokens for the same client. Ensure your application handles re-authentication gracefully.

Step 2: Use the Access Token

Include the access token in the Authorization header for all subsequent API requests:

Quickstart Code

Install the following packages:
Create a .env file in the root directory of your project and add the following variables:
Create main.py in the root directory of your project and copy the following code into it:
Run the following command to execute the code:
A contact is automatically created (or matched by phone number) the first time you call a number — there’s no separate contact-creation step. See Call single phone number for the full set of options, including linking to an existing contactUuid, promptTags, and metadata.

Integrating AI Phone Calls

Call single number

Initiate an AI call to a single phone number — best for real-time, user-triggered calls.

Call bulk numbers

Dispatch AI calls to a list of phone numbers in one request — best for outreach campaigns.