Overview
This API can be used to retrieve an aggregated summary of Sunbit transactions. The report will include total revenue generated and conversion rates, among other data.
Summary with aggregated values
Request Headers
Property |
Required |
Type |
Description |
sunbit-key |
yes |
text |
Provided to you by Sunbit |
sunbit-secret |
yes |
text |
Provided to you by Sunbit |
Body
Attribute |
Required |
Type |
Description |
location |
no |
text |
If not provided, the response will include all locations of the partner |
fromDate |
yes |
date |
Format: YYYY-MM-DD |
toDate |
yes |
date |
Format: YYYY-MM-DD |
Response
Attribute |
Type |
Description |
fromDate |
Date |
The result start date. format: YYYY-MM-DD |
toDate |
Date |
The result end date. format: YYYY-MM-DD |
records |
SummaryReport[] |
Array of SummaryReport aggregate per location |
SummaryReport
Attribute |
Type |
Description |
location |
text |
|
totalAmountOfPurchases |
number |
The total amount purchased |
numberOfPurchases |
number |
The number of purchases |
conversionRate |
number |
Conversion Rate (purchases/purchases + approvals) |
Example
Request
curl -X POST 'https://api-sandbox.sunbit.com/reports/api/v1/summary' \
-H 'Content-Type: application/json' \
-H 'sunbit-key: YOUR_KEY' \
-H 'sunbit-secret: YOUR_SECRET' \
-d '{
"fromDate": "2024-04-01",
"toDate": "2024-04-15",
"location": "sandbox"
}'
Response
{
"fromDate": "2024-04-01",
"toDate": "2024-04-15",
"records": [
{
"location": "sandbox",
"totalAmountOfPurchases": 32573.33,
"numberOfPurchases": 104,
"conversionRate": 100.0
}
]
}
Error Code |
Message |
Description |
404 |
Resource Not Found |
Location was not found |
403 |
Bad Credentials |
sunbit-key and/or sunbit-secret do not match any alliance credentials |
500 |
Internal Server Error |
Something went wrong on Sunbit’s side |