File Downloads
Secure, time-limited download links for digital products, PDFs, and protected files. Generate tokens that expire after a set time or number of uses. Track downloads per file and visitor.
Endpoints (5)
Generate a secure download token for a file. Returns the token and a ready-to-use download URL. The token is hashed server-side — only the plain token is returned to the caller.
| Field | Type | Required | Description |
|---|---|---|---|
asset_url |
string | ✓ Yes | The CDN URL or PAPI asset path to protect. Example: "https://cdn.websitepublisher.ai/project22492/files/ebook.pdf" or "/files/ebook.pdf". |
filename |
string | No | Display filename for the download (Content-Disposition). If omitted, extracted from asset_url. |
expires_in_hours |
integer | No | Hours until the token expires (default: 24). Set 0 for no expiry. |
max_uses |
integer | No | Maximum number of downloads (default: 1). Set 0 for unlimited. |
visitor_id |
string | No | SAPI Visitor Auth ID to bind this token to a specific user. If set, only this visitor can use the token. |
metadata |
object | No | Custom metadata to attach to the download token (e.g. order_id, product_name). |
Verify a download token and get the real file URL. Increments use_count. Returns the asset URL on success, or an error explaining why the token is invalid (expired, used up, wrong visitor, revoked).
| Field | Type | Required | Description |
|---|---|---|---|
token |
string | ✓ Yes | The download token to verify. |
visitor_id |
string | No | SAPI Visitor Auth ID of the requesting user (for visitor-bound tokens). |
ip |
string | No | IP address of the requesting user (for logging). |
List download tokens with usage statistics. Filter by status, asset, or visitor. Shows use_count, last download time, and remaining uses.
| Field | Type | Required | Description |
|---|---|---|---|
status |
string | No | Filter: "active" (valid tokens), "expired", "exhausted" (max uses reached), "revoked", or "all" (default: "all"). |
asset_url |
string | No | Filter by specific asset URL. |
visitor_id |
string | No | Filter by visitor. |
limit |
integer | No | Results per page (default: 20, max: 100). |
offset |
integer | No | Pagination offset. |
Revoke a download token so it can no longer be used. Irreversible.
| Field | Type | Required | Description |
|---|---|---|---|
token |
string | ✓ Yes | The download token to revoke. |
Download statistics: total tokens generated, total downloads, active tokens, expired tokens, top downloaded files.
| Field | Type | Required | Description |
|---|---|---|---|
days |
integer | No | Number of days to look back (default: 30). |
MCP Tool Names
When using this integration through an AI assistant (Claude, ChatGPT, Cursor, etc.), the endpoints are available as MCP tools:
| Endpoint | MCP Tool Name |
|---|---|
| generate-token | file-downloads_generate_token |
| verify-token | file-downloads_verify_token |
| list-downloads | file-downloads_list_downloads |
| revoke-token | file-downloads_revoke_token |
| get-stats | file-downloads_get_stats |