Skip to main content
The plugin registers five HTTP endpoints on your Payload app, under the /api/storage-bunny prefix. Client uploads use Payload’s own POST /api/upload-instructions endpoint. The admin UI calls them for you. You only need this reference if you build a custom upload flow, for example a headless front end that uploads directly to Bunny, if you set up the Stream webhook, or if you call the tasks endpoint from a cron service.

Endpoints

stream/status and stream/thumbnail read the document with Payload access control, including drafts and trashed documents. :videoId must be the video of the document or of its latest draft. Any other video ID returns 404. The paths start with the API route of your Payload config (routes.api, /api by default). upload-instructions returns Bunny upload URLs only when storage.clientUploads is on:
  • For a Stream file type in a collection where bulk uploads and form saves go to Stream over TUS, it returns type: 'dispatch' with a TUS authorization for the admin UI.
  • Without client uploads, it answers 403, also for collections that store files only in Stream.
  • For any other Stream file type with client uploads, it answers 400. Custom clients upload videos with tus-auth instead.
See Custom upload clients for a full example. After a TUS upload, save the document with bunnyData.stream.videoId and bunnyData.stream.videoToken, not with a file. See Custom TUS clients. The other endpoints need these options:
  • stream/tus-auth needs stream.tus.
  • stream/webhook needs stream.webhook.
  • stream/status needs stream.status (on by default).
  • stream/thumbnail needs thumbnail on a Stream collection with Payload access control.
  • tasks needs tasks.secret.
Errors use Payload’s standard format, { "errors": [{ "message": "..." }] }. stream/webhook and tasks return { "error": "..." } instead, and stream/thumbnail passes on CDN errors as plain text.

Authentication

  • upload-instructions and stream/tus-auth run through Payload’s access control. Send them with an authenticated session, for example the payload-token cookie. clientUploads.access can only narrow Payload’s check. stream.tus.access replaces the default check.
  • stream/status needs a signed-in user of your admin user collection who passes its access.admin, and reads the document with Payload access control. It returns { "state": "processing" | "ready" | "failed", "resolutions"?: { "available", "highest" } }. resolutions is the same value as bunnyData.stream.resolutions. It is left out when none are stored. A stored ready or failed state comes from the document. Otherwise the server asks the Bunny API, at most once per video every 10 seconds (60 seconds when the library has a webhook), and stores a changed state.
  • stream/thumbnail reads the document with Payload access control. It needs no admin access, and no sign-in when the collection allows public reads, because list views show the thumbnail to anyone who can read the document. It fetches the image from the Stream CDN and passes query parameters on, or redirects to a signed CDN URL when signedUrls.staticHandler.redirect is set (302 by default, or 307). A proxied thumbnail is sent with Cache-Control: private, so shared caches do not store it. See Thumbnails.
  • tasks needs Authorization: Bearer <tasks.secret>. POST also accepts a signed-in user of your admin user collection who passes its access.admin. GET never accepts a session, so a link or an image tag cannot start a task. The plugin compares the secret in constant time.
  • stream/webhook is not a Payload-authenticated route. Bunny signs each call, and the plugin verifies an HMAC-SHA256 X-BunnyStream-Signature header against the library’s Read-Only API key (stream.webhook.secret).
Base your requests on your own app’s origin. The https://your-site.com server shown on each endpoint is a placeholder — replace it with where your Payload app runs.

Plugin options accessors

Looking for the plugin’s server-side helper functions (getBunnyStreamForCollection, getBunnyStorageForCollection, and friends) rather than HTTP endpoints? Those are documented under Accessing the resolved options.