Skip to content

Authentication

The Leads2b API uses Bearer Token authentication. To access protected endpoints, you must include the token in the headers of your HTTP requests.

Obtaining a Token

Authentication tokens must be generated directly from the Leads2b platform interface. Follow the steps below:

  1. Go to the Settings > Integrations menu within the platform.
  2. Find the section Leads2b Integration (via API V2) - User Key and click Generate Key.
  3. Copy the generated token and store it in a secure location.

Note: Only users with an Administrator profile can generate authentication tokens.

Additionally, ensure that your subscription plan includes access to the API module. If you have any questions, please contact Leads2b support.

Using the Token in the API

All authenticated requests must include the token in the Authorization header, as shown in the example below:

bash
curl -X GET "https://api.leads2b.com/v1/exemple" \
     -H "Authorization: Bearer YOUR_TOKEN_HERE"

Example Request in JavaScript (fetch)

javascript
fetch("https://api.leads2b.com/v1/exemple", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN_HERE",
    "Content-Type": "application/json"
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error("Error:", error));

If the token is invalid or missing, the API will return a 401 Unauthorized response.

Token Renewal

Generated tokens do not renew automatically. If needed, a new token must be generated following the same steps described earlier.