Reports Endpoints
Report generation is asynchronous. You request a report, poll for its status, and download it when complete.
Request Report
Initiate a report generation job.
POST /reports/requestQuery Parameters (use one):
| Parameter | Type | Required | Description |
|---|---|---|---|
product_sku | string | Conditional | Generate a report for a specific SKU |
dps_date | string | Conditional | Generate a daily product sales report for a specific date (Y-m-d) |
last_updated_date | string | Conditional | Generate a report for records updated since this date (Y-m-d) |
Provide exactly one of the above parameters. Plus an account selection parameter.
Example Request:
bash
curl -X POST "https://app.sellerlegend.com/api/reports/request?account_title=My Store US&product_sku=MY-SKU-001" \
-H "Authorization: Bearer {ACCESS_TOKEN}"Response:
json
{
"report_id": "rpt_abc123def456",
"status": "processing",
"message": "Report generation started"
}Response Fields:
| Field | Type | Description |
|---|---|---|
report_id | string | Unique report identifier — use this to check status and download |
status | string | Initial status (processing) |
message | string | Status message |
Python SDK:
python
from sellerlegend_api import SellerLegendClient
client = SellerLegendClient(access_token="YOUR_ACCESS_TOKEN")
report = client.reports.request(
account_title="My Store US",
product_sku="MY-SKU-001"
)
print(f"Report ID: {report['report_id']}")Check Report Status
Check the progress of a report generation job.
GET /reports/statusQuery Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
report_id | string | Yes | The report ID returned from the request endpoint |
Example Request:
bash
curl -X GET "https://app.sellerlegend.com/api/reports/status?report_id=rpt_abc123def456" \
-H "Authorization: Bearer {ACCESS_TOKEN}"Response (in progress):
json
{
"status": "processing",
"progress": 45,
"message": "Processing records..."
}Response (complete):
json
{
"status": "completed",
"progress": 100,
"message": "Report is ready for download"
}Response Fields:
| Field | Type | Description |
|---|---|---|
status | string | processing or completed |
progress | integer | Percentage complete (0–100) |
message | string | Human-readable status message |
Python SDK:
python
import time
status = client.reports.get_status(
account_title="My Store US",
report_id=report['report_id']
)
while status['status'] == 'processing':
time.sleep(5)
status = client.reports.get_status(
account_title="My Store US",
report_id=report['report_id']
)
print(f"Progress: {status.get('progress', 0)}%")Download Report
Download a completed report in your preferred format.
GET /reports/downloadQuery Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
report_id | string | Yes | The report ID |
format | string | No | Download format: csv or json (default: json) |
Example Request:
bash
curl -X GET "https://app.sellerlegend.com/api/reports/download?report_id=rpt_abc123def456&format=json" \
-H "Authorization: Bearer {ACCESS_TOKEN}"Response (JSON format):
json
[
{
"sku": "MY-SKU-001",
"product_name": "My Product Name",
"units_ordered": 150,
"product_sales": 4497.00
}
]Python SDK:
python
report_data = client.reports.download(
account_title="My Store US",
report_id=report['report_id'],
format="csv"
)
with open('report.csv', 'w') as f:
f.write(report_data)WARNING
Reports are only available for download after the status shows completed. Attempting to download a report that is still processing will return an error.
Workflow
- Call
POST /reports/requestto start generation - Poll
GET /reports/statusuntilstatusiscompleted - Call
GET /reports/downloadto retrieve the data