API Reference
Downloads and Secure Delivery API
Contract-backed secure delivery documentation for entitlement-gated file streaming and legacy download compatibility routes.
SoundSync
Verified delivery endpoint
This is the canonical current route for entitlement-gated delivery.
/api/delivery/entitlements/:entitlementId/files/:fileIndex
Authorizes an active customer entitlement and redirects to short-lived signed R2 delivery.
- Auth
- Customer library/download token
- Scope
- Entitlement, customer identity, product, source/sourceId, expansion rule, and file-index scoped.
- Request fields
- query token: string
- query download_token: string
- query libraryToken: string
- Returns
- 302 redirect to a short-lived signed R2 download URL, or JSON error for missing token, invalid entitlement/file index, inactive entitlement, expansion block, missing file, upstream failure, or delivery failure.
- Side effects
- Logs delivery and updates legacy serial download count when the entitlement metadata includes a serialId.
- Notes
- This endpoint keeps authorization and download accounting in SoundSync while R2 serves the file bytes directly. fileIndex is zero-based. Token ownership, active entitlement, expansion rules and file existence are checked before redirect. Do not persist the storage URL as a permanent download. When account-token session verification is unavailable, fail closed with 503 SESSION_VERIFICATION_UNAVAILABLE. Retry after recovery; do not treat it as authorization or confirmed revocation. A verified revoked account session returns 401 LIBRARY_SESSION_REVOKED. Shared library tokens follow their own token/ownership checks.
Request, response and error reference
Query and header parameters
[
{
"name": "token",
"in": "query",
"schema": {
"type": "string"
},
"required": false,
"description": ""
},
{
"name": "download_token",
"in": "query",
"schema": {
"type": "string"
},
"required": false,
"description": ""
},
{
"name": "libraryToken",
"in": "query",
"schema": {
"type": "string"
},
"required": false,
"description": ""
}
]
No request body fields are read by this operation.
HTTP 302 response headers
{
"Location": {
"schema": {
"type": "string",
"format": "uri"
},
"description": "Short-lived authorized private download URL."
}
}
Documented failures: 400, 500, 401, 503.
Operation errors: SESSION_VERIFICATION_UNAVAILABLE, LIBRARY_SESSION_REVOKED.
SoundSync
Download example
The token is a temporary customer/library token. Do not place product plugin credentials in browser download links.
curl -L "$SOUNDSYNC_API_BASE/api/delivery/entitlements/1042/files/0" \
-H "Authorization: Bearer $CUSTOMER_LIBRARY_TOKEN" \
-o NebulaKeysInstaller.zip
SoundSync
Delivery behavior
Documented exactly from the route/controller.
| Case | Response | Client behavior |
|---|---|---|
| Missing token | 401 JSON { message: Missing token } | Prompt customer to sign in or refresh library token. |
| Invalid entitlement id or file index | 400 JSON error | Treat as integration or stale-link bug. |
| Entitlement not found | 404 JSON error | Refresh customer library and do not retry file URL blindly. |
| Entitlement inactive | 403 JSON error | Block download; explain refund, expiration, or revoked access where known. |
| File index missing | 404 JSON error | Refresh library product file list/version. |
| Unmanaged external file | 409 JSON EXTERNAL_FILE_NOT_IMPORTED | Prompt the developer to re-import the file with Upload by Link. |
| Successful managed R2 file | 302 redirect to short-lived signed R2 URL | Let the browser follow the redirect and save the file; do not expose backing object keys in library payloads. |
Signed URL note
The verified canonical entitlement route does not expose raw storage URLs in library payloads. It generates signed R2 delivery only after a customer starts an authorized download, with short expiry and no-store cache headers.
Current delivery versus legacy download helpers
Use the entitlement-delivery and customer-library flows for new integrations. Deprecated serial download counters and confirmation helpers now require a signed-in customer account, an owned active serial, and, for confirmation, a file belonging to its product. They record/check download activity; they do not authorize file access.
Keep customer-account tokens, library/download links, private serial download tokens, and public download codes distinct. Invoice access and review submission require the supported customer-account identity, not an arbitrary shared library link. Follow the authentication and product checks for the actual file request.
