Skip to content

Browser SDK

When the export is triggered by a user in a browser, you don’t call this API directly — you ship the open-source SDK and give it a publishable key. The SDK opens the session from the browser, polls it, and renders progress; your secret API key stays on your server, where it belongs.

The SDK is MIT-licensed and works without an Eazip account for local, in-browser ZIPs. A key is only needed for the cloud strategy, which moves the job server-side when the tab can’t hold it.

KeyWhere it livesWhat it’s for
zk_… (secret)Your server onlyCalling this HTTP API — Quick Start
pk_ez_… (publishable)Shipped in your JS bundleLetting a browser open an export session via the SDK

A publishable key is safe to expose — like a Stripe publishable key. What limits it is the Public App behind it: the origins it may be used from, the hosts it may fetch files from, and the per-session ceilings.

Terminal window
npm install @eazip/react # or @eazip/core for framework-agnostic JavaScript
  1. Open Public Apps in your dashboard
  2. Click Create app and give it a name your team will recognize
  3. Under Websites that can use this key, add every exact browser origin your app runs on, including http://localhost:3000 for local development
  4. Under Where the files come from, add the CDN, bucket, or asset hosts Eazip should download from — this is usually a different list from your websites
  5. Leave Advanced settings on the recommended defaults unless you need to restrict delivery mode, file count, retention, or total size
  6. Click Create app & get key. The pk_ez_… key stays readable on the app card

Both lists are edited inline: Add another… adds a row, while the button at the bottom creates or saves the app once.

The edit page uses the same two lists. Changes affect new exports immediately, and you can pause an app without deleting it or rotating its key.

'use client';
import { EazipTray, useEazip } from '@eazip/react';
function Exporter({ urls }) {
const zip = useEazip();
return (
<>
<button
onClick={() =>
zip.download({
strategy: 'cloud',
publicKey: process.env.NEXT_PUBLIC_EAZIP_KEY,
files: urls,
})
}
>
Download as ZIP
</button>
<EazipTray />
</>
);
}

<EazipTray /> narrates progress, cancellation, partial results, failures, and the finished download. Drop strategy and publicKey and the same call zips locally in the browser instead — no account involved.

Creating the session from your backend instead

Section titled “Creating the session from your backend instead”

If the frontend shouldn’t even know the file URLs — signed S3/R2 links, for example — your backend creates the session and hands the browser only { sessionId, clientSecret }. The SDK attaches to it with a createSession callback and never sees a key. See Backend-created sessions in the SDK documentation.

The SDK has its own documentation site, covering the hook, the tray, resume after reload, multi-zip splitting, and the error taxonomy: