Reports via REST API

Follow

This article will provide you with the step & information if you want to take the data within Leabyte and send it to a BI or reporting software using the Rest API.


To begin with, you'll need an Administrator REST API key with the "reports" permission checked.

More information on creating a key HERE

Now that you have a REST API key with the correct permissions, you can make your REST API call to LeadByte. In your REST API settings, scroll to the bottom of the page and you’ll find a set of expandable report options.

Image_2020-07-31_at_11.11.35_AM.png

Expand the required option for instructions on how to call the REST API for each of the reports.
 

LeadByte may require a Campaign ID or Responder ID. 

Campaign ID can be found in the URL upon editing a campaign
Reponder ID can again be found in the URL when editing

Example:

LeadByte - Edit Campaign 2026-01-06 at 11.27.54 am.jpg

 

Example call

I'm looking to pull a Campaign summary report for my example Campaign for the month of July.

Below is what I would call LeadByte with:

http://YOURDOMAIN.leadbyte.com/restapi/v1.2/reports/campaign?key=abc123456abcdef&campaignId=9&from=2020-07-01T00:00:00Z&to=2020-07-31T00:00:00Z

 

The response received back would look like this:

{
  "status": "Success",
  "message": "OK",
  "data": [
    {
      "campaign": {
        "id": "9",
        "name": "Example Campaign",
        "reference": "EXAMPLE-CAMPAIGN"
      },
      "leads": 82,
      "valid": 74,
      "invalid": 8,
      "pending": 0,
      "rejections": 63,
      "approved": 11,
      "returns": 0,
      "supplierCost": 37.5,
      "emailCost": 0,
      "smsCost": 0.026,
      "validationCost": 0.0255,
      "revenue": 250,
      "profit": 212.4485,
      "currency": "GBP"
    }
  ]
}

Obviously, this call and response will change for each report you pull; however, the format will always be:

Call to LeadByte > GET

Response back from LeadByte > JSON

Please note: Each individual report call type must finish completely before another call to the same report type can be performed. Two different report types can be called at the same time, but when calling the same report, you must wait until the previous call has finished responding before sending another or you will see this response:

"Another report request is currently being processed, please wait and try again"


FAQ

1. What date presets can I use?

You can use the "datePreset" variable with the following values: 
- today / yesterday / this_week / last_7d / lastweek / last_30d / this_month / last_month.  

For example - &datePreset=last_7d

 

Was this article helpful?
0 out of 0 found this helpful

Comments