Skip to main content
bannerify-js is the Bannerify client for JavaScript and TypeScript. It has types for every option and returns errors as values, so a failed request does not throw.

Install

Create a client

You need an API key. Create one on the API Keys page of the dashboard and keep it on the server.
createClient(apiKey) returns the same client.

Generate an image

result is an ArrayBuffer that holds the image bytes.

Methods

Create images and PDFs covers the first three, Render videos covers the video methods, and Signed URL covers the last one.

Handle errors

Every method except generateImageSignedUrl returns an object with either result or error. TypeScript narrows the type after you check error.
An error has four fields: code, message, docs, and requestId. docs links to the page for that code. Send requestId to support when you need help with a request. The SDK adds two codes of its own. INVALID_FORMAT means the image format is not png, jpeg, or webp. TIMEOUT_ERROR means the request ran past the timeout. A failure that does not come from the API, such as a lost connection, throws. generateImageSignedUrl returns a string and throws when the format is not supported.

Options