Eazip

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}/sessions

Creates 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

FieldTypeRequiredDescription
filesarrayYesFiles to include. Each entry is { "url": string, "filename"?: string }. Every URL must match one of the key's Files from hosts.
mode"stored" | "stream"NoDelivery mode. Defaults to stored. Must be allowed on the key. See Stream vs stored.
zip_filenamestringNoName of the ZIP, up to 255 characters. Supports templates.
fail_on_url_errorbooleanNoFail the job if any source URL cannot be fetched.
max_zip_size_bytesintegerNoSplit the output into several ZIPs of at most this size. See Auto-split.
split_strategy"preserve-order" | "ffd"NoHow 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_..."
}
FieldDescription
session.idSession ID. The SDK's sessionId.
session.statusInitial job status.
session.created_atWhen the session was created.
session.expires_atWhen the session stops answering progress requests.
client_secretSecret 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"
  }
}
CodeHTTPDescription
INVALID_REQUEST400Missing or invalid fields. error.issues lists each problem.
SOURCE_URL_INVALID400A source URL is malformed or points to a blocked address.
SOURCE_URL_NOT_ALLOWED400A source URL is outside the key's Files from hosts, or the key has none.
MODE_NOT_ALLOWED400mode is not allowed on the key.
PUBLIC_APP_LIMIT_EXCEEDED400More files than the key's Maximum files setting.
UNAUTHORIZED401Missing or invalid API key.
PUBLIC_APP_INACTIVE403The public key is paused.
PLAN_LIMIT_EXCEEDED403The request exceeds a plan limit.
QUOTA_EXCEEDED403Monthly quota exceeded while overage is disabled.
NOT_FOUND404The public key does not exist or belongs to another account.

On this page