Back

Sendinblue API Essential Guide

Aug 9, 20246 minute read

What type of API does Sendinblue provide?

Sendinblue has a REST API.

Key points:

  • Sendinblue provides a RESTful API for integrating their email marketing and automation services into applications.
  • The API allows developers to programmatically manage contacts, send transactional emails, create and send email campaigns, manage SMS campaigns, and more.
  • It uses standard HTTP methods like GET, POST, PUT, DELETE and returns responses in JSON format.
  • Authentication is done via an API key that needs to be included in the request headers.
  • The API is versioned, with v3 being the current stable version.

Best practices:

  • Use HTTPS for all API requests to ensure data security.
  • Include proper error handling in your integration to gracefully handle any API errors or rate limiting.
  • Cache API responses where appropriate to reduce unnecessary calls.
  • Use the API documentation and SDKs provided by Sendinblue to simplify integration.

While Sendinblue's primary API is REST-based, it's worth noting that they may offer additional integration options for specific use cases. However, the core public API that most developers would interact with is a RESTful API.

Does the Sendinblue API have webhooks?

Webhook Support

Yes, the official Sendinblue API does support webhooks.

Event Types

You can subscribe to the following types of events for transactional emails:

  • Sent
  • Delivered
  • Opened
  • Clicked
  • Soft Bounce
  • Hard Bounce
  • Invalid Email
  • Deferred
  • Complaint
  • Unsubscribed
  • Blocked
  • Error

Setting Up Webhooks

  1. You can set up webhooks through the Sendinblue dashboard or via API calls.

  2. You need to provide a notification URL (webhook endpoint) where Sendinblue will send event data.

  3. For each event type you want to track, you need to enable it when setting up the webhook.

Webhook Payload

The webhook payload will contain event-specific data, including:

  • Event type
  • Recipient email
  • Message ID
  • Timestamp
  • Subject line
  • Custom headers
  • IP address used to send
  • Template ID (if applicable)
  • Tags associated with the message

Security

Sendinblue provides IP ranges that you can whitelist to secure your webhook endpoint.

Additional Notes

  • Sendinblue also offers webhooks for marketing campaigns and SMS, in addition to transactional emails.
  • The datetime parameters in webhook payloads use different timezones, so pay attention to the format when processing events.

In summary, Sendinblue's API offers comprehensive webhook support for tracking various email-related events, allowing you to receive real-time notifications about the status and engagement of your transactional emails.

Rate Limits and other limitations

Here are the key points about the API rate limits for the Sendinblue (now Brevo) API:

General Rate Limits

  • Most endpoints have a limit of 100 requests per hour (RPH) [1]

  • The main transactional email endpoint (POST /v3/smtp/email) has a much higher limit of 3,600,000 RPH or 1,000 requests per second (RPS) [1]

  • The SMS endpoint (POST /v3/transactionalSMS/sms) has a limit of 540,000 RPH or 150 RPS [1]

  • The events endpoint (POST /v3/events) has a limit of 36,000 RPH or 10 RPS [1]

  • Endpoints under /v3/contacts/ have a limit of 36,000 RPH or 10 RPS [1]

Enterprise Rate Limits

  • Enterprise plans have higher limits, for example:
    • 7,200,000 RPH / 2,000 RPS for the main email endpoint
    • 720,000 RPH / 200 RPS for SMS
    • 72,000 RPH / 20 RPS for events and contacts endpoints [1]

Key Points

  • Rate limits are enforced per API key [1]

  • Exceeding the limit results in a 429 HTTP error code [1][2]

  • Headers are provided to track remaining requests and reset time [1]

  • Enterprise plans can request further increased limits as an add-on [1]

  • The batch sending email endpoint was increased to 5 requests per minute, allowing up to 30,000 emails per hour [5]

Best Practices

  • Distribute requests evenly across the time period to avoid bursts [1]

  • Implement retry logic with exponential backoff for 429 errors [1]

  • Consider moving to a higher tier plan if consistently hitting limits [1]

  • Use webhooks for high-volume operations like fetching statistics [1]

The rate limits are designed to allow high throughput for critical operations like sending emails, while maintaining platform stability. Enterprise customers have significantly higher limits, with options for further increases if needed.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the Sendinblue API:

  1. The most recent version of the Sendinblue API is v3 [1].

  2. Key points to consider:

    • Sendinblue has rebranded to Brevo, but the API is still referred to as Sendinblue API v3 in most documentation [3].

    • The API v2 was officially deprecated in December 2022 [3].

    • The latest version of the Java SDK is 7.0.0, released on April 27, 2023 [2].

    • The latest version of the Node.js SDK is 8.5.0, released on December 26, 2022 [4].

  3. The API is accessed via HTTPS requests to the endpoint: https://api.brevo.com/v3/.

  4. API requests must include the headers 'content-type: application/json' and 'api-key' [1].

  5. Sendinblue provides SDKs for various programming languages including Java, PHP, Python, Ruby, Node.js, Go, and C# [1].

  6. The API supports features such as transactional messaging (email, SMS, WhatsApp), contact management, and more [1].

In summary, the most recent version of the Sendinblue (now Brevo) API is v3, with the latest SDK versions being 7.0.0 for Java and 8.5.0 for Node.js. The API provides a wide range of functionality for managing contacts and sending transactional messages across various channels.

How to get a Sendinblue developer account and API Keys?

Here's how to get a developer account for Sendinblue to create an API integration:

  1. Create a Sendinblue account:

    • Go to the Sendinblue signup page and create a free account.
    • Confirm your account by verifying your email address.
  2. Access your API key:

    • Log into your Sendinblue account.
    • Click on your name at the top-right corner of the screen.
    • Go to the "SMTP & API" section in your account settings.
  3. Generate an API key:

    • In the "SMTP & API" section, you'll find your API key.
    • If you don't see an API key, you may need to generate a new one.
  4. Use the API key for authentication:

    • The API key will be used to authenticate your requests to the Sendinblue API.
    • Include this API key in the headers of your API requests.

Key points to consider:

  • Keep your API key secure and don't share it publicly.
  • Sendinblue offers different API versions, so make sure you're using the correct endpoint URLs for your integration.
  • Familiarize yourself with Sendinblue's API documentation to understand the available endpoints and request/response formats.

Code example:

Here's a basic example of how you might use the Sendinblue API key in a request using JavaScript and the axios library:

import axios from 'axios'; const apiKey = 'YOUR_API_KEY_HERE'; axios.get('https://api.sendinblue.com/v3/account', { headers: { 'api-key': apiKey, 'content-type': 'application/json' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error:', error); });

Best practices:

  1. Store your API key securely, preferably as an environment variable.
  2. Implement proper error handling in your API requests.
  3. Respect Sendinblue's API rate limits to avoid being blocked.
  4. Keep your integration up to date with any changes in Sendinblue's API.

By following these steps, you'll be able to set up a developer account with Sendinblue and start creating your API integration.

What can you do with the Sendinblue API?

Here are the key data models you can interact with using the Sendinblue API:

  • Contacts

    • Get contact details
    • Create/update contacts
    • Delete contacts
    • Manage contact attributes
    • Add/remove contacts from lists
  • Lists

    • Create/update lists
    • Delete lists
    • Get list details and statistics
    • Add/remove contacts from lists
  • Campaigns

    • Create and send email campaigns
    • Get campaign details and statistics
    • Schedule/reschedule campaigns
    • Test campaigns
  • Transactional Emails

    • Send transactional emails
    • Get email logs and statistics
  • SMS

    • Send SMS messages
    • Get SMS logs and statistics
  • Automation Workflows

    • Create/update automation workflows
    • Get workflow details and statistics
    • Start/pause workflows
  • Reports

    • Get aggregated statistics and reports
  • Account

    • Get account information and usage statistics
  • Webhooks

    • Create/manage webhooks for various events

The API allows you to perform CRUD operations on most of these data models, as well as retrieve detailed information and statistics. You can manage contacts and lists, create and send campaigns, handle transactional communications, set up automation workflows, and access various reports and account details.