Sessions API
API reference for creating a Cloud session from your backend for backend-created sessions.
For backend-created sessions
This API is what your server calls when you use
backend-created sessions. Your backend
creates the session with a secret API key, and the browser SDK takes over
polling and downloads from the returned session. If the browser starts
exports with a publicKey instead, the SDK handles sessions for you and you
do not call this API.
A session is a browser-safe handle for one ZIP job. The browser can follow
the job's progress and download its ZIPs with a session ID (zs_...) and a
client secret (zcs_...), without ever seeing the source URLs or your API key.
Create a session
POST /public-apps/{public_key_id}/sessionsCreates a session under one of your public keys and starts its ZIP job. Eazip applies the key's Files from hosts, allowed modes, and limits before it starts the job, the same as for a browser that uses the key. Works on origins are not checked because the request comes from your server. The job uses your plan's quota like any other job.
Authentication
Send a secret API key in the X-API-Key header, exactly as for the
Jobs API. The public key must belong to the
same account.
public_key_id is the public key's ID (pa_...), not the pk_ez_... value.
Under Public keys in the dashboard, open the key's ⋯ menu and choose
Copy key ID.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
files | array | Yes | Files to include. Each entry is { "url": string, "filename"?: string }. Every URL must match one of the key's Files from hosts. |
mode | "stored" | "stream" | No | Delivery mode. Defaults to stored. Must be allowed on the key. See Stream vs stored. |
zip_filename | string | No | Name of the ZIP, up to 255 characters. Supports templates. |
fail_on_url_error | boolean | No | Fail the job if any source URL cannot be fetched. |
max_zip_size_bytes | integer | No | Split the output into several ZIPs of at most this size. See Auto-split. |
split_strategy | "preserve-order" | "ffd" | No | How files are assigned to ZIPs when splitting. Defaults to preserve-order. |
Sessions do not accept expires_in or metadata. Retention comes from the
key's retention setting, capped by your plan.
The number of files is limited by the key's Maximum files setting (100 by default). Raise it in the key's advanced settings for larger exports.
Example request
curl -X POST "https://api.eazip.io/public-apps/$EAZIP_PUBLIC_KEY_ID/sessions" \
-H "X-API-Key: $EAZIP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"files": [
{ "url": "https://cdn.example.com/exports/123/a.pdf", "filename": "a.pdf" },
{ "url": "https://cdn.example.com/exports/123/b.pdf" }
],
"zip_filename": "export.zip",
"mode": "stored"
}'See Backend-created sessions for the same call in Node.js, Python, Ruby, PHP, Go, Java, and C#.
Response
201 Created:
{
"success": true,
"session": {
"id": "zs_3f2c9a...",
"status": "pending",
"created_at": "2026-11-15T00:00:00.000Z",
"expires_at": "2026-11-17T00:00:00.000Z"
},
"client_secret": "zcs_..."
}| Field | Description |
|---|---|
session.id | Session ID. The SDK's sessionId. |
session.status | Initial job status. |
session.created_at | When the session was created. |
session.expires_at | When the session stops answering progress requests. |
client_secret | Secret for reading this session. Shown only once. The SDK's clientSecret. |
The response is safe to return to the user who started the export: it contains
no source URLs and no account credentials. The client_secret only reads this
one session, so do not log it or share it with other users.
Session lifetime
A session lives for the key's retention period plus one day. The extra day covers the time the job spends running, because ZIP retention starts when the job completes while the session clock starts at creation.
After expires_at, the browser SDK can no longer read the session's progress
or download links. Create a new session to export the files again.
Error codes
Errors use the same shape as the rest of the API:
{
"success": false,
"error": {
"code": "SOURCE_URL_NOT_ALLOWED",
"message": "Source URL is not allowed for this public key"
}
}| Code | HTTP | Description |
|---|---|---|
INVALID_REQUEST | 400 | Missing or invalid fields. error.issues lists each problem. |
SOURCE_URL_INVALID | 400 | A source URL is malformed or points to a blocked address. |
SOURCE_URL_NOT_ALLOWED | 400 | A source URL is outside the key's Files from hosts, or the key has none. |
MODE_NOT_ALLOWED | 400 | mode is not allowed on the key. |
PUBLIC_APP_LIMIT_EXCEEDED | 400 | More files than the key's Maximum files setting. |
UNAUTHORIZED | 401 | Missing or invalid API key. |
PUBLIC_APP_INACTIVE | 403 | The public key is paused. |
PLAN_LIMIT_EXCEEDED | 403 | The request exceeds a plan limit. |
QUOTA_EXCEEDED | 403 | Monthly quota exceeded while overage is disabled. |
NOT_FOUND | 404 | The public key does not exist or belongs to another account. |
Backend-created sessions
Keep source URLs and server authorization off the client while the SDK handles polling and downloads.
Create a ZIP from URLs with One API Call
POST a list of file URLs to the Eazip API and get back an expiring download link. No ZIP code, no bucket CORS setup, and no archive bytes through your server.