Sender creation and management
You can check out the API public reference endpoints for senders at API Reference > Senders. We will talk through the endpoints one by one starting from Create a new sender
.
1. Create a new sender
You can use the endpoint https://api.brevo.com/v3/senders
for this API call with the calling method POST
. The cURL request for this endpoint will be like this:
curl --request POST \
--url https://api.brevo.com/v3/senders \
--header 'accept: application/json' \
--header 'api-key: ' \
--header 'content-type: application/json' \
--data '
{
"ips": [
{
"ip": "123.98.689.7",
"domain": "mycompany.com",
"weight": 50
}
],
The parameters for this endpoint are mentioned in the table below.
Attribute | Datatype | Description | Value |
---|---|---|---|
name | String | From Name to use for the sender | Newsletter |
email | String | From email to use for the sender. A verification email will be sent to this address. | [email protected] |
ips | Array of objects | Mandatory in case of dedicated IP. IPs to associate to the sender | IP objects |
Since ips
is an array of objects, it has sub attributes which are:
Attribute | Datatype | Description | Value |
---|---|---|---|
ip | String | Dedicated IP available in your account | 123.98.689.7 |
domain | String | Domain of the IP | mycompany.com |
weight | Int64 | Weight to apply to the IP. Sum of all IP weights must be 100. Should be passed for either ALL or NONE of the IPs. If it's not passed, the sending will be equally balanced on all IPs. | 50 |
Using ips as array of objects
You can also use multiple ips as dedicated ips which you can associate to the sender.
Response
Response code | Message | Description |
---|---|---|
201 | Sender created | Sender has been created |
400 | Bad request | Bad API request has been sent involving wrong formats for parameters. |
2. Update a sender
You can start updating your existing sender by using the endpoint https://api.brevo.com/v3/senders/{senderId}
with the calling method PUT
. To call the endpoint, the cURL request below can be used:
curl --request PUT \
--url https://api.brevo.com/v3/senders/24 \
--header 'accept: application/json' \
--header 'api-key: ' \
--header 'content-type: application/json' \
--data '
{
"ips": [
{
"ip": "123.98.689.7",
"domain": "mycompany.com",
"weight": 50
}
],
"name": "Newsletter",
"email": "[email protected]"
}
'
The attributes of Update a sender
are in two parts, path params and body params.
Path params
Attribute | Datatype | Description | Value |
---|---|---|---|
senderId | Int64 | Id of the sender | 24 |
Body params
Attribute | Datatype | Description | Value |
---|---|---|---|
name | String | From Name to use for the sender | Newsletter |
email | String | From email to use for the sender. A verification email will be sent to this address. | [email protected] |
ips | Array of objects | Mandatory in case of dedicated IP. IPs to associate to the sender | IP objects |
Since ips
is an array of objects, it has sub attributes which are:
ip | String | Dedicated IP available in your account | 123.98.689.7 |
domain | String | Domain of the IP | mycompany.com |
weight | Int64 | Weight to apply to the IP. Sum of all IP weights must be 100. Should be passed for either ALL or NONE of the IPs. If it's not passed, the sending will be equally balanced on all IPs. | 50 |
Response
Response code | Description | Message |
---|---|---|
204 | This shows a success message that the sender has been updated | Sender updated |
400 | This response is shown when there is a missing or invalid parameter etc. | Bad request |
404 | This response code is shown in case when sender ID is unavailable or wrong. | Sender ID not found |
3. Get the list of all your senders
You can use the endpoint https://api.brevo.com/v3/senders
with the calling method GET
. The cURL request for this endpoint is mentioned below:
curl --request GET \
--url 'https://api.brevo.com/v3/senders?ip=192.168.8.138&domain=mydomain.com' \
--header 'accept: application/json' \
--header 'api-key: '
The attributes for this endpoint are defined in the table below:
Attribute | Datatype | Description | Value |
---|---|---|---|
ip | String | Filter your senders for a specific ip | 192.168.8.138 |
domain | String | Filter your senders for a specific domain | mydomain.com |
Response
Response code | Message | Description |
---|---|---|
200 | List of senders | Displays the list of senders. |
400 | Bad request | This response is shown due to invalid or wrong parameters. |
Delete a sender
You can use the endpoint https://api.brevo.com/v3/senders/{senderId}
with the method DELETE
. If you want to implement this endpoint in your preferred language, you can use the below code.
The cURL request for this endpoint is below.
curl --request DELETE \
--url https://api.brevo.com/v3/senders/245 \
--header 'accept: application/json' \
--header 'api-key: '
There is only one attribute for deleting a sender which is senderId. You get the senderId after your create the sender and the API returns an Id in the response which is your senderId.
Attribute | Datatype | Description | Value |
---|---|---|---|
senderId | Int64 | Id of the sender | 245 |
Response
Response code | Message | Description |
---|---|---|
204 | Sender deleted | Sender has been deleted successfully. |
400 | Bad request | Request may have invalid or missing parameters or problems in the request etc. |
404 | Sender Id not found | Sender Id to be deleted is not found |
Updated 11 months ago