Skip to main content
Use bannerify-js to call the Bannerify API from JavaScript and TypeScript without writing raw HTTP requests.

Install

Instantiate

You need a project API key before using the SDK. Create one in Dashboard → API Keys and keep it server-side. Afterwards you need to provide it to the client:

Response format

The SDK returns errors explicitly so your code can handle failed requests without relying on thrown errors. TypeScript narrows the response after you check the error field. Every method returns either an error or a result field, never both and never none.

Checking for errors

To check for errors you use the error property, our errors are easy to read and provide a link to our documentation for more information.

Options

The constructor accepts some options to customize the behavior:

API key

apiKey
string
required
Your project’s API key

Timeout

The timeout for the requests in milliseconds, by default it is 10000ms.

Fetch

The fetch client to use, by default it uses the global fetch client.