External feeds management

This document provides a descriptive view on the public API reference for the External feed endpoints.

1. Fetch all external feeds

To call this API, you need to request the endpoint https://api.brevo.com/v3/feeds with the GET method. This endpoint performs the function of retrieving all of your created external feeds. You can use the cURL request below:

curl --request GET \
     --url 'https://api.brevo.com/v3/feeds?search=search&startDate=2022-09-04&endDate=2022-10-01&sort=desc&authType=basic&limit=50&offset=0' \
     --header 'accept: application/json' \
     --header 'api-key: '

The attributes used in the cURL request are defined below in a table.

AttributesDatatypeDescriptionValue
searchStringCan be used to filter records by search keyword on feed namesearch
startDateDateMandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date.2022-09-04
endDateDateMandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.2022-10-01
sortStringSort the results in the ascending/descending order of record creation. Default order is descending if sort is not passed.desc
authTypeStringFilter the records by authType of the feed. (Has multiple authentication types)basic
limitInt64Number of documents returned per page.50
offsetInt64Index of the first document on the page.0

Response

A sample JSON response for the request would be:

{
  "count": 3,
  "feeds": [
    {
      "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d",
      "name": "api feed token",
      "url": "https://abc.com/",
      "authType": "token",
      "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj",
      "headers": [
        {
          "name": "key",
          "value": "val"
        }
      ],
      "maxRetries": 4,
      "cache": true,
      "createdAt": "2022-10-06T05:03:47.053000000Z",
      "modifiedAt": "2022-10-06T05:03:47.053000000Z"
    },
    {
      "id": "311a71ac-bebc-42cf-963d-d8666dfe53e9",
      "name": "api feed basic",
      "url": "https://abc.com/",
      "authType": "basic",
      "username": "user",
      "password": "pass",
      "headers": null,
      "maxRetries": 2,
      "cache": false,
      "createdAt": "2022-10-06T04:48:19.767000000Z",
      "modifiedAt": "2022-10-06T04:48:19.767000000Z"
    }
  ]
}

Some response codes are defined in the table below:

Response codeMessageDescription
200External feedsDisplays the external feeds details
400Invalid parameters passedError code occurs in case of failure by passing invalid parameters or out of range parameters etc.
404Record not foundError code is displayed in case the results or records are not found. This may occur due to an incorrect request etc.

2. Create an external feed

To create an external feed, you need to call the endpoint https://api.brevo.com/v3/feeds with the POST method. You can use the cURL request below to send a request to the API.

curl --request POST \
     --url https://api.brevo.com/v3/feeds \
     --header 'accept: application/json' \
     --header 'api-key: ' \
     --header 'content-type: application/json' \
     --data '
{
  "authType": "basic",
  "headers": [
    {
      "name": "userId",
      "value": "user12345"
    }
  ],
  "maxRetries": 5,
  "cache": false,
  "name": "New feed",
  "url": "http://requestb.in/173lyyx1",
  "username": "user",
  "password": "password",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
'

The values and attributes to create a feed are mentioned below in a table:

AttributeDatatypeDescriptionValue
nameStringName of the feedNew feed
urlUrlURL of the feedhttp://requestb.in/173lyyx1
authTypeStringAuth type of the feed: basic, token or noAuthbasic
usernameStringUsername for authTypeuser
passwordStringPassword for authTypepassword
tokenStringToken for authType"Random string of letters and number"
headersArray of objectsAn array of objects which provide custom headers for the feedit has objects name and value
maxRetriesintegerMaximum number of retries on the feed url5
cachebooleanToggle caching of feed url responsefalse

As headers is an array of objects, it has two more attributes name and value:

ObjectDatatypeDescriptionValue
nameStringName of the headeruserId
valueStringValue of the headeruser12345

Response

When the request is run, the API will send you an id in the response which will be the unique id of the feed. A sample is given below:

{
  "id": "23befbae-1505-47a8-bd27-e30ef739f32c"
}

The response codes are defined below:

Response codeMessageDescription
201Successfully createdSuccessfully creates external feed and you get an id in the response which is id of the feed.
400Bad requestRequest fails due to invalid, missing parameters or an incorrect way of sending the request.

3. Get an external feed by UUID

To send a request, you need to call the endpoint https://api.brevo.com/v3/feeds/{uuid} with the GET method. You can use the cURL request below:

curl --request GET \
     --url https://api.brevo.com/v3/feeds/38f351fb-6e77-4b38-979a-a2465260449e \
     --header 'accept: application/json' \
     --header 'api-key: '

There is only one attribute which is uuid which is a universal identifier for the external feed. It is defined in the table below:

AttributeDatatypeDescriptionValue
uuidStringUUID of the feed to fetch38f351fb-6e77-4b38-979a-a2465260449e

Response

{
  "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d",
  "name": "api feed token",
  "url": "https://abc.com/",
  "authType": "token",
  "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj",
  "headers": [
    {
      "name": "key",
      "value": "val"
    }
  ],
  "maxRetries": 4,
  "cache": true,
  "createdAt": "2022-10-06T05:03:47.053000000Z",
  "modifiedAt": "2022-10-06T05:03:47.053000000Z"
}
Response codeMessageDescription
200External feedsDisplays the external fields details
400Bad requestError code occurs in case of a bad request by passing invalid parameters or out of range parameters etc.
404Feed not foundError code is displayed in case the results or feeds are not found. This may occur due to an incorrect request etc.

4. Update an external feed

You can use this endpoint https://api.brevo.com/v3/feeds/{uuid} by calling the PUT method to update an external feed. You can use the cURL request below to send the request:

curl --request PUT \
     --url https://api.brevo.com/v3/feeds/38f351fb-6e77-4b38-979a-a2465260449e \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "headers": [
    {
      "name": "userId",
      "value": "user12345"
    }
  ],
  "maxRetries": 5,
  "cache": false,
  "name": "New feed",
  "url": "http://requestb.in/173lyyx1",
  "authType": "token",
  "username": "user",
  "password": "password",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
'

There are two types of parameters to update a field path params and body params which are mentioned below:

Path params

AttributeDatatypeDescriptionValue
uuidStringUUID of the feed to update38f351fb-6e77-4b38-979a-a2465260449e

Body params

AttributeDatatypeDescriptionValue
nameStringName of the feedNew feed
urlUrlUrl of the feedhttp://requestb.in/173lyyx1
authTypeStringAuth type of the feed: basic, token, noAuthtoken
usernameStringUsername for authType basicuser
passwordStringPassword for authType basicpassword
tokenStringToken for authType tokenRandom numbers and letters
headersArray of objectsCustom headers for the feedContains objects name and value
maxRetriesIntegerMaximum number of retries on the feed url5
cacheBooleanToggle caching of feed url responsefalse

As headers is an array of objects, it contains two objects which are:

ObjectDatatypeDescriptionValue
nameStringName of headeruserId
valueStringValue of headeruser12345

Response

A sample response would show no message but with a 204 response code which shows that the external feed has been updated. Below some of the response codes and their descriptions are mentioned:

Response codeMessageDescription
204Feed updatedFeed is updated of the response code 204 is displayed.
400Bad requestBad request which fails the request due to bad or invalid parameters.
404Feed not found404is displayed when the feed cannot be found maybe due to inputting the incorrect parameters or UUID.

5. Delete an external feed

To delete a feed, you can call the endpoint https://api.brevo.com/v3/feeds/{uuid} with the DELETE method. For the deletion, you can make use of the cURL request below.

curl --request DELETE \
     --url https://api.brevo.com/v3/feeds/38f351fb-6e77-4b38-979a-a2465260449e \
     --header 'accept: application/json' \
     --header 'api-key: '

Only uuid is used as an attribute and it is defined below.

AttributeDatatypeDescriptionValue
uuidStringUUID of the feed to fetch38f351fb-6e77-4b38-979a-a2465260449e

Response

A sample JSON response would show nothing with the response code 200 which shows that the feed has been deleted.

Response codes for this endpoint are mentioned in the table.

Response codeMessageDescription
200Feed deletedFeed is deleted successfully.
400Bad requestBad request is sent to the API because of invalid or missing parameters
404Feed not foundThis response occurs when results or feeds are not found to be deleted.