Get loyalty points export download link
Get a temporary download URL for a completed export.
- Method
- GET
- Path
https://api.returning.ai / v1/ loyalty-exports/ {exportId}/ download - Permission
- customerSuccess
- Retries
- Safe to repeat while the file remains available; links do not extend file retention.
When to use this
- Download a completed CSV or JSON report into your reporting system.
- Replace an expired download link while the file remains available.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- customerSuccessShown in the dashboard as Customer Success.
Use a Community API key with customerSuccess, shown as Customer Success in the dashboard. Keep the key on your backend and send Authorization: Bearer <API_KEY>. The key selects the community; do not send a community ID. Personal API keys are not supported.
All three calls use https://api.returning.ai and return Cache-Control: no-store. They accept no query parameters. A valid community key with the required permission can read that community's export jobs, including jobs created by another key in the same community.
Successful responses contain meta, message and data. Read job state from data.status. An HTTP 200 means the status request succeeded, even when the job is failed. Errors put their machine-readable code in meta.code; do not branch on message.
Behaviour#
Download the returned URL without forwarding your API key:
curl --fail --output points.csv '<TEMPORARY_DOWNLOAD_URL>'
The URL is sensitive: anyone holding it may download the file while it remains valid. Do not put it in logs, support tickets or client-side source. The response contains only filename, url and url_expires_at; no checksum or file size is returned here.
Links are generated with an expiry of at most five minutes, bounded by the file's availability. Files have an API availability window of 24 hours after completion. Request a new link if the old one expires while the file remains available. Repeated link requests do not extend the file's availability.
CSV filenames use the export creation time in Unix milliseconds: points-<timestamp>.csv. JSON downloads use points.json.
An unfinished, failed or cancelled job returns 409 EXPORT_NOT_READY. Check status; wait only for queued or processing jobs. An expired file returns 410 EXPORT_EXPIRED.
Request#
Path parameters#
Rule24 hex characters
Eg66f000000000000000000701
Headers#
RuleBearer <API_KEY>
curl --request GET \
--url https://api.returning.ai/v1/loyalty-exports/66f000000000000000000701/download \
--header 'Authorization: Bearer <API_KEY>'
Response#
Download the file with a plain HTTPS GET. Check Create loyalty points export for CSV columns, JSON fields and daily-load guidance.
Verify and store the file
Compare the downloaded byte length with file_size_bytes from the completed status. For CSV, parse it with a CSV library and count data records, excluding the header; fields can be quoted, so counting newline characters is not a reliable row count. For JSON, count objects in the array. Compare that count with total_rows.
Store the file only after the transfer and parsing checks succeed. Keep customer data private and apply your own retention policy. The API's 24-hour availability is a download window, not a retention policy for files you have saved yourself.
Two different expiry times
| What expires | Window | Recovery |
|---|---|---|
| A download URL | At most five minutes, shown by url_expires_at | Request another link for the same completed export. |
| The export file | 24 hours after completion | Create a deliberately new export. Replaying the original create does not extend availability. |
A file-host HTTP 403 may mean the temporary URL expired or was copied incompletely. Get a fresh link and copy it exactly. If a fresh link also fails, stop retrying it repeatedly and contact support with the export ID and API request ID. Do not send support the API key, signed URL or raw customer file.
The file host's errors are not the API's JSON error envelope. Use the status and download-link endpoints to distinguish an unfinished job, an expired artifact and a temporary download failure.
Eg{ ... }
Rulesuccess
Eg200
Eg"example-request"
Eg"Loyalty export download success."
Eg{ ... }
Eg"points-1788397200000.csv"
Eg"https://download.example.com/temporary-file"
Eg"2026-09-03T01:07:00.000Z"
{
"meta": {
"status": "success",
"statusCode": 200,
"requestId": "example-request"
},
"message": "Loyalty export download success.",
"data": {
"filename": "points-1788397200000.csv",
"url": "https://download.example.com/temporary-file" ,
"url_expires_at": "2026-09-03T01:07:00.000Z"
}
}
Errors#
Fix the request08
VALIDATION_ERRORFix the requestAUTHENTICATION_REQUIREDFix the requestAPI_KEY_PERMISSION_DENIEDFix the requestCOMMUNITY_ACCESS_DENIEDFix the requestFix the data05
COMMUNITY_NOT_FOUNDFix the dataEXPORT_NOT_FOUNDFix the dataEXPORT_EXPIREDFix the dataRetry with backoff07
EXPORTS_UNAVAILABLERetry with backoffAUTHENTICATION_FAILEDRetry with backoffEXPORT_NOT_READYRetry with backoffEXPORT_ARTIFACT_UNAVAILABLERetry with backoffEXPORT_STORAGE_UNAVAILABLERetry with backoffEXPORT_SIGNING_UNAVAILABLERetry with backoff{
"meta": {
"status": "error",
"statusCode": 400,
"code": "VALIDATION_ERROR",
"requestId": "req_example"
},
"message": "Loyalty export request error.",
"detail": "Invalid request or unsupported query parameters."
}