# Bunny Billing Docs: Developers, full text > Every page of the Developers section of the Bunny docs as plain text, in navigation order. The index of all pages is https://docs.bunny.com/llms.txt, and every section in one file is https://docs.bunny.com/llms-full.txt. --- URL: https://docs.bunny.com/developer # Overview Overview of the ways to integrate your platform with Bunny: the GraphQL API, SDKs, embeddable React components, the customer portal and webhooks. SDK Use the Bunny SDK to create subscriptions, create accounts, track usage etc. Install the SDK Customer portal Link directly to the customer portal for signups, invoice payments and more. Explore the customer portal GraphQL API Harness the full power of Bunny using the GraphQL API that allows you to do anything. Use the GraphQL API Components Embed Bunny components directly in your app to pay, subscribe etc. Browse Bunny components Webhooks Let Bunny update your platform's tenants when subscriptions change. Set up webhooks Sample SaaS App See our reference implementation of a SaaS application that uses Bunny. See the sample SaaS app Bunny offers several ways of integrating your platform: GraphQL API, SDK, embeddable React Components, Customer Portal and webhooks. New to Bunny? The [Quickstart](https://docs.bunny.com/developer/quickstart) connects a Node.js app end to end: signup, provisioning, usage and the customer portal. Using an AI coding tool such as Claude Code, Cursor or VS Code? See [Build with AI](https://docs.bunny.com/developer/build-with-ai) to connect it to these docs. --- URL: https://docs.bunny.com/developer/quickstart # Quickstart Connect a Node.js app to Bunny end to end: create a subscription at signup, keep the tenant in sync from the provisioning webhook, report usage and open the customer portal. This guide connects a Node.js app to Bunny at the four [integration points](https://docs.bunny.com/developer/integration-points): it creates a subscription when a customer signs up, keeps the customer’s tenant in sync from Bunny’s webhook, reports usage, and opens the customer portal. It uses the Superdesk sample company, and Express for the web server. The same calls are available in the [Ruby SDK](https://docs.bunny.com/developer/bunny-sdk/install-the-sdk) and as raw [GraphQL](https://docs.bunny.com/developer/using-the-graphql-api/api). ## Before you start In Bunny, set up these four things. Everything else happens in code. | What | Where in Bunny | You need | | A price list to sell | Product catalog: a product, plan and price list. To start trials, the price list must allow them. | The price list’s code, such as business_monthly | | A usage-based charge, for step 4 | A charge on that price list that uses a feature with Is Unit on | The feature’s code, such as api_calls | | An API client | Settings > Developers > API clients | The Client ID and Client Secret, with the scopes standard:read standard:write billing:write portal:write | | Provisioning on the product’s platform | Settings > Developers > Platforms: on the platform your product belongs to, turn on Provisioning enabled, set the Webhook URL to your endpoint from step 3, and set a Webhook signing key | The signing key | Your Bunny address is `https://.bunny.com`, the address you use to sign in to Bunny. ## 1. Install and configure the SDK ```bash npm install @bunnyapp/api-client express ``` Create the client once, on your server. With a client ID and secret, the SDK gets access tokens itself and gets a new one when a token expires. ```javascript // bunny.js const Bunny = require("@bunnyapp/api-client"); const bunny = new Bunny({ baseUrl: "https://.bunny.com", clientId: process.env.BUNNY_CLIENT_ID, clientSecret: process.env.BUNNY_CLIENT_SECRET, scope: "standard:read standard:write billing:write portal:write", webhookSigningToken: process.env.BUNNY_WEBHOOK_SIGNING_KEY, }); module.exports = bunny; ``` Keep the client secret and access tokens on your server. Never send them to the browser. [Authentication](https://docs.bunny.com/developer/authentication) explains which token goes where. ## 2. Create a subscription at signup When a customer signs up, create their tenant in your app first, then create the subscription in Bunny with the tenant’s code. Here the code is `superdesk-123456`, your own ID for the tenant. ```javascript const bunny = require("./bunny"); async function onSignup(tenant, user) { const subscription = await bunny.subscriptionCreate("business_monthly", { trial: true, accountName: "Superdesk", firstName: user.firstName, lastName: user.lastName, email: user.email, tenantCode: tenant.id, // "superdesk-123456" tenantName: "Superdesk", }); // Keep the subscription ID: usage records in step 4 need it. await saveBunnySubscriptionId(tenant.id, subscription.id); } ``` This creates the account, its billing contact, the tenant and a trial subscription. Leave out `trial` to start a paid subscription instead. The SDK throws an `Error` with Bunny’s message if the subscription can’t be created. For example, `Price list not found` means the price list code doesn’t exist, and `Tenant provisioning is not enabled` means Provisioning enabled is off on the platform of the price list’s product. A tenant code only works with provisioning on. Reference: [`subscriptionCreate`](https://docs.bunny.com/developer/api-reference/mutations/subscriptioncreate). More options: [Create a subscription](https://docs.bunny.com/developer/bunny-sdk/create-a-subscription). ## 3. Keep the tenant in sync Bunny sends the `TenantProvisioningChange` webhook to your platform’s Webhook URL whenever something changes what a tenant gets: the trial converts, the customer upgrades, a quote is applied, or the subscription is canceled. The payload lists the tenant’s current features and quantities. Set them on the tenant in your app. ```javascript const express = require("express"); const bunny = require("./bunny"); const app = express(); // Verify the signature against the raw body, exactly as received. app.post("/webhooks/bunny", express.raw({ type: "application/json" }), async (req, res) => { const signature = req.headers["x-bunny-signature"]; if (!signature || !bunny.webhooks.validate(signature, req.body)) { return res.sendStatus(401); } const event = JSON.parse(req.body); if (event.type === "TenantProvisioningChange") { const tenantCode = event.payload.tenant.code; // "superdesk-123456" const features = event.payload.change.features; // [{ code: "users", quantity: 10, ... }] await updateTenantEntitlements(tenantCode, features); } res.sendStatus(200); }); ``` Respond with a 2xx status within 5 seconds. If your update takes longer, queue it and respond first. Bunny tries a failed request once more, and you can resend a webhook from Settings > Developers > Webhook logs. To send the current state for a tenant on demand, for example while testing, call [`tenantProvisioningSend`](https://docs.bunny.com/developer/api-reference/mutations/tenantprovisioningsend). Full payload and every trigger: [Tenant provisioning change](https://docs.bunny.com/developer/webhooks/tenant-provisioning-change). Signature details: [Webhook security](https://docs.bunny.com/developer/webhooks/webhook-security). ## 4. Report usage If the price list has a usage-based charge, report usage as it happens, with the feature code, the quantity and the subscription ID you saved in step 2. ```javascript await bunny.featureUsageCreate("api_calls", 250, subscriptionId); ``` The usage is recorded at the current time. Pass an ISO 8601 date and time as a fourth argument to record it at another time. At the end of each billing period, Bunny combines the records using the charge’s usage calculation (Sum, Max, Last or Average) and bills the result. Reference: [`featureUsageCreate`](https://docs.bunny.com/developer/api-reference/mutations/featureusagecreate). Usage calculations: [Track usage for billing](https://docs.bunny.com/developer/bunny-sdk/track-usage-for-billing). ## 5. Open the customer portal To let a customer update their card, pay invoices or change their plan, create a portal session for their tenant on your server and send them to the portal with the token. ```javascript app.get("/billing", async (req, res) => { const tenantCode = req.user.tenantId; // "superdesk-123456" const token = await bunny.portalSessionCreate(tenantCode, "https://app.example.com/settings"); res.redirect(`https://.bunny.com/portal/subscriptions?token=${token}`); }); ``` The token gives access to this one account and expires after 24 hours. Replace `subscriptions` in the URL with `transactions` or `payment-method` to open another page of the portal. The second argument is where the portal links back to, and where customers go when their session has expired. To keep customers inside your app instead, use the same token with the [popup customer portal](https://docs.bunny.com/developer/customer-portal/popup-customer-portal) or [Bunny Components](https://docs.bunny.com/developer/bunny-components/bunny-components). Reference: [`portalSessionCreate`](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate). ## Next steps - See all four steps working together in the [sample SaaS app](https://docs.bunny.com/developer/sample-saas-app/the-sample-saas-app). - Report logins and engagement with [tenant metrics](https://docs.bunny.com/developer/bunny-sdk/track-tenant-metrics). - Using an AI coding tool? [Build with AI](https://docs.bunny.com/developer/build-with-ai) connects it to these docs. --- URL: https://docs.bunny.com/developer/authentication # Authentication The three kinds of token in Bunny: API client access tokens for your server, portal session tokens for one customer in the browser, and signup tokens for public signup pages. When to use each. Every call to Bunny’s API carries a token in an `Authorization: Bearer ` header. Which token depends on where the call comes from and what it should be able to reach: | Token | Use it in | It can reach | Created with | | API client access token | Your server only | Your whole Bunny entity, limited by the API client’s scopes | The client credentials grant, or Generate Access Token in Bunny | | Portal session token | The browser, with the customer portal and Bunny Components | One account’s billing | portalSessionCreate, called from your server | | Signup token | A public signup page or | Signing up new customers, nothing else | An API client with only the signup:read and signup:write scopes | ## API client access tokens An API client is how your platform connects to Bunny. Create one in Bunny under Settings > Developers > API clients, give it only the scopes it needs, and keep its Client ID and Client Secret on your server. See [API clients](https://docs.bunny.com/guide/tour/access-control/api-clients). Your server exchanges the client ID and secret for an access token at `https://.bunny.com/oauth/token` with the OAuth 2.0 client credentials grant, then sends the token with every request to `https://.bunny.com/graphql`. Your subdomain is the one in the address you use to sign in to Bunny. Access tokens expire after the API client’s token expiry, for example 7,200 seconds. A request with an expired token gets HTTP 401 with `Token is expired`. Get a new token and retry the request. The [Bunny SDKs](https://docs.bunny.com/developer/bunny-sdk/install-the-sdk) do all of this for you: give them the client ID, secret and scopes, and they get tokens and replace expired ones. To try the API without writing the token request, select an API client in Bunny and click Generate Access Token. Details and examples: [Authorizing API requests](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests). Never send an API client’s secret or access token to the browser. Anyone can read it from the page and reach all the data its scopes allow. ## Portal session tokens A portal session token lets one customer see and manage their own billing in the browser, through the customer portal or Bunny Components. Your server creates it with `portalSessionCreate` for the signed-in customer’s tenant, using an API client with the `portal:write` scope, and sends only the portal session token to the browser. It expires after at most 24 hours, so create one each time the customer opens billing rather than storing it. Details: [Portal session token](https://docs.bunny.com/developer/portal-session-token). ## Signup tokens Signup pages run before the customer has an account, so there’s no tenant to create a portal session for. They use an access token from an API client whose only scopes are `signup:read` and `signup:write`. That token can do nothing but sign up new customers, so it’s safe in a public page. Create a separate API client for signup. Never use one with any other scope. Details: [Signup page](https://docs.bunny.com/developer/customer-portal/account-signup) and [``](https://docs.bunny.com/developer/bunny-components/signup). --- URL: https://docs.bunny.com/developer/integration-points # Integration points The four points where a SaaS platform connects to Bunny: subscriptionCreate at signup, the tenantProvisioningChange webhook, featureUsageCreate for usage and portalSessionCreate for self-service. Most integrations connect your platform to Bunny at four points. Three are API calls your platform makes to Bunny. One is a webhook that Bunny sends to your platform. You only need the ones your pricing and product use. For working code for all four, see the [Quickstart](https://docs.bunny.com/developer/quickstart). ## Tenants and tenant codes Each customer workspace in your platform is a tenant in Bunny. You identify it with a tenant code you choose, usually your own ID for that workspace, such as `superdesk-123456`. You pass the tenant code when you create the subscription. Bunny then uses it to tell you which tenant a webhook is about, and you use it to open portal sessions and report tenant metrics. Usage records are the exception: they reference the subscription, so also store the subscription `id` that `subscriptionCreate` returns. [image: Diagram of the four integration points between your platform and Bunny, in order: 1 subscriptionCreate at signup, an API call made always; 2 tenantProvisioningChange, a webhook from Bunny when entitlements change; 3 featureUsageCreate for usage-based charges; 4 portalSessionCreate for customer self-service] The four integration points | Step | When | Direction | Call | Needed for | | 1. Create the subscription | A customer signs up and their tenant exists in your platform | Your platform → Bunny | subscriptionCreate mutation | Every integration | | 2. Provision the tenant | A subscription changes what the tenant is entitled to | Bunny → your platform | tenantProvisioningChange webhook | Letting Bunny control features and quantities | | 3. Report usage | Usage happens in your platform | Your platform → Bunny | featureUsageCreate mutation | Usage-based charges | | 4. Open self-service | A customer opens billing in your app | Your platform → Bunny | portalSessionCreate mutation | The customer portal and Bunny Components | Every call your platform makes needs an access token from an API client, requested on your server. See [Authentication](https://docs.bunny.com/developer/authentication) for the three kinds of token and when to use each. ## 1. Create the subscription When a customer signs up on your website and you’ve created their tenant, call `subscriptionCreate` with the price list to subscribe to, the account details and the tenant code. Set `trial` to start a trial instead of a paid subscription. - How-to: [Create a subscription](https://docs.bunny.com/developer/bunny-sdk/create-a-subscription), with GraphQL, Ruby and Node.js examples - Reference: [`subscriptionCreate`](https://docs.bunny.com/developer/api-reference/mutations/subscriptioncreate), scope `standard:write` ## 2. Provision the tenant Bunny sends the `tenantProvisioningChange` webhook to your platform whenever something changes what a tenant is entitled to: a trial converts, a subscription is canceled, a quote is applied, or the features on a plan change. The payload has the tenant code and the tenant’s current features and quantities. Update the tenant in your platform to match. To receive it, turn on Provisioning enabled for your platform under Settings > Developers > Platforms and set a Webhook URL. Your endpoint must respond with a 2xx status within 5 seconds. Verify the signature in the `x-bunny-signature` header before you act on the payload. - How-to: [Tenant provisioning change](https://docs.bunny.com/developer/webhooks/tenant-provisioning-change), with the full payload and every trigger - Setup and security: [Webhooks overview](https://docs.bunny.com/developer/webhooks/webhooks) and [Webhook security](https://docs.bunny.com/developer/webhooks/webhook-security) ## 3. Report usage If any of your price lists have usage-based charges, call `featureUsageCreate` as usage happens, with the feature code, the quantity and the subscription `id`. Bunny adds up the records in each billing period, using the charge’s usage calculation (Sum, Max, Last or Average), and bills the result on the next invoice. - How-to: [Track usage for billing](https://docs.bunny.com/developer/bunny-sdk/track-usage-for-billing) - Reference: [`featureUsageCreate`](https://docs.bunny.com/developer/api-reference/mutations/featureusagecreate), scope `billing:write` ## 4. Open self-service To let customers update their card, pay invoices or change their plan, call `portalSessionCreate` on your server with the tenant code. It returns a short-lived token, valid for up to 24 hours, that gives access to that one account’s billing. Use the token to: - link to the [standalone customer portal](https://docs.bunny.com/developer/customer-portal/standalone-customer-portal), - open the [popup customer portal](https://docs.bunny.com/developer/customer-portal/popup-customer-portal) in your app with `bunny.js`, or - render [Bunny Components](https://docs.bunny.com/developer/bunny-components/bunny-components) inside your app’s own UI. To compare them, see [Choose a self-service approach](https://docs.bunny.com/developer/self-service). Only send the portal session token to the browser, never your API access token. - How-to: [Portal session token](https://docs.bunny.com/developer/portal-session-token) - Reference: [`portalSessionCreate`](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate), scope `portal:write` ## Optional: tenant metrics and credit balances - [Track tenant metrics](https://docs.bunny.com/developer/bunny-sdk/track-tenant-metrics): report last login, user count and your own usage signals with `tenantMetricsUpdate`, so they show on the tenant in Bunny. - [Credit balance changed](https://docs.bunny.com/developer/webhooks/credit-balance-changed): a webhook that tells your platform when a tenant’s usage credits are used up or added, so you can stop or resume usage. ## SampleSaaS reference implementation SampleSaaS is an open-source app that implements these integration points end to end. See [the sample SaaS app](https://docs.bunny.com/developer/sample-saas-app/the-sample-saas-app) to run it. [github.comhttps://github.com/bunnyapp/sample-saas](https://github.com/bunnyapp/sample-saas) --- URL: https://docs.bunny.com/developer/self-service # Choose a self-service approach Compare Bunny's ways to let customers sign up, pay invoices and manage subscriptions themselves: the standalone portal, popup portal, hosted Signup and Checkout pages, and React components. Bunny gives customers two kinds of self-service: - Existing customers pay invoices, update their payment method, and upgrade, downgrade or cancel their subscriptions. - New customers sign up for a plan and pay without anyone in your team being involved. For each, you can send customers to a page Bunny hosts, or build the screens into your own app. The hosted pages are built from the same components you can embed, so you can start with a hosted page and move to components later without changing your catalog or subscriptions. ## Existing customers | | Standalone portal | Popup portal | Bunny Components | | What the customer sees | Bunny’s portal in its own tab or page | Bunny’s portal in a popup over your app | Billing screens inside your app’s own pages | | What you build | A link that your server fills in with a token | A button that opens the popup, plus the bunny.js script | React components in your app | | Frontend requirements | None | Any web app that can load a script | React 18 and the package’s peer dependencies | | Look and feel | Your logo and brand colors, from portal branding | Your logo and brand colors, from portal branding | Fully restyled with the appearance prop | | Token | Portal session token | Portal session token | Portal session token | | Setup in Bunny | None | None | Whitelist your app’s domains | | Guide | Standalone customer portal | Popup customer portal | Components overview | | Components to use | | | , , or , and | All three need a [portal session token](https://docs.bunny.com/developer/portal-session-token) (see [Authentication](https://docs.bunny.com/developer/authentication)), created on your server for the signed-in customer’s tenant. The token gives access to that one account and expires after at most 24 hours, so create it when the customer opens billing rather than storing it. To send an existing customer straight to buying one plan, use the hosted [Checkout page](https://docs.bunny.com/developer/customer-portal/checkout-page) or the [`` component](https://docs.bunny.com/developer/bunny-components/checkout). Both use the same portal session token. Checkout offers every payment method enabled in your Stripe account, including bank debits such as SEPA Direct Debit, which signup doesn’t. ## New customers | | Signup page | component | | What the customer sees | A Bunny-hosted signup page for one price list | A signup form on your website | | What you build | A link with the price list code and a token | A React component on your signup page | | Token | An API client token with only the signup:read and signup:write scopes | The same | | Payment methods | Cards only, when an amount is due | Cards only, when an amount is due | | Guide | Signup page | | The signup token can be in a public page because it can do nothing but sign up. Never use an API client with any other scope for signup. If you’d rather create the account yourself, for example when the customer signs up inside your app, call [`subscriptionCreate`](https://docs.bunny.com/developer/api-reference/mutations/subscriptioncreate) from your server instead. See the [Quickstart](https://docs.bunny.com/developer/quickstart). ## Which one to use | If you want to… | Use | | Let customers pay and manage billing with the least work | The standalone portal: one link from your app’s settings | | Keep customers in your app, without building billing screens | The popup portal | | Make billing look and feel like the rest of your React app | Bunny Components | | Let an existing customer buy or upgrade to one plan | The Checkout page, or in a React app | | Let anyone sign up from your website | The Signup page, or in a React app | | Create subscriptions from your own signup flow | subscriptionCreate from your server | You can combine them. A common setup is the Signup page for new customers and the standalone portal for existing ones, then components later for the screens customers use most. --- URL: https://docs.bunny.com/developer/build-with-ai # Build with AI Set up Claude Code, Cursor, VS Code and other AI coding tools to build Bunny integrations: the docs MCP server, markdown and llms.txt context files, and an AGENTS.md snippet with the rules agents need. AI coding tools write better Bunny integrations when they read the docs instead of guessing. Three things help: connect the docs MCP server, point your tool at the right context files, and add a short set of Bunny rules to your repo. This page is about writing code against Bunny. To have an assistant work with your live Bunny data, such as answering MRR questions, composing quotes or updating accounts, connect the [Bunny MCP server](https://docs.bunny.com/guide/tour/revops-agent/mcp-server) instead. ## Connect the docs MCP server The docs MCP server at `https://docs.bunny.com/mcp` gives your tool two tools: - `search_docs` searches the guide and developer docs. - `get_api_reference` returns the exact arguments, types and an example request for any GraphQL query, mutation or type. It uses Streamable HTTP and needs no authentication. It only reads the public documentation, never your Bunny data. **Claude Code** ```bash claude mcp add --transport http bunny-docs https://docs.bunny.com/mcp ``` **Cursor** Add this to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for every project: ```json { "mcpServers": { "bunny-docs": { "url": "https://docs.bunny.com/mcp" } } } ``` **VS Code** Add this to `.vscode/mcp.json` in your project: ```json { "servers": { "bunny-docs": { "type": "http", "url": "https://docs.bunny.com/mcp" } } } ``` **Other clients** Any client that supports remote MCP servers over Streamable HTTP works. Add `https://docs.bunny.com/mcp` as the server URL, with no authentication. ## Give your tool the right context If your tool can’t use MCP, or you want to load the docs up front, use these files. They’re plain text and rebuilt from the docs on every deploy, so they’re always current. | File | What’s in it | Use it to | | /llms-developer.txt | Every developer page as text, plus one line for every GraphQL query and mutation with its scope | Start an integration. This is the one to load. | | /llms.txt | Every page with a one-line description | Find the page for a topic | | Any page URL + .md | That page as markdown, with its links, for example /developer/api-reference/mutations/subscriptioncreate.md | Read one page or one operation’s full definition | | api-reference.json | Every operation and type as JSON: arguments, return types and example requests | Generate typed clients or check queries in code | | /llms-guide.txt and /llms-full.txt | The guide to using Bunny, and every page in one file | Questions about how Bunny works for your team, not code | ## Add Bunny rules to your repo Agents tend to make the same few mistakes with a billing API. Paste this into your repo’s `AGENTS.md`, `CLAUDE.md` or Cursor rules, so your tool follows them without being told each time. ```markdown ## Bunny billing integration Docs: https://docs.bunny.com/llms-developer.txt. Look up exact arguments with the bunny-docs MCP server (get_api_reference) or the operation's page under https://docs.bunny.com/developer/api-reference/ (add .md for markdown). Don't guess field or argument names. - API: GraphQL at https://.bunny.com/graphql, where is the one in your Bunny admin URL. One endpoint for queries and mutations. - Auth: OAuth client credentials. POST grant_type=client_credentials, client_id, client_secret and scope to https://.bunny.com/oauth/token, then send "Authorization: Bearer ". Server-side only: never send the client secret or an API access token to the browser. - Tokens expire (expires_in, in seconds). On a 401 "Token is expired", get a new token and retry once. - Scopes: request only scopes assigned to the API client. Each operation's reference page lists the scope it needs. - Errors: every mutation returns an errors field. Always select it, and treat a non-empty list as a failure, as well as top-level GraphQL errors. - Browser and UI: for Bunny Components or the customer portal, create a portal session token on the server with portalSessionCreate (scope portal:write) and pass only that token to the browser. - Signups: call subscriptionCreate when a customer signs up and their tenant exists in your platform, passing your tenant code. - Usage-based charges: report usage with featureUsageCreate. - Changing an existing subscription's price, quantity or discount creates a quote in Bunny (subscriptionUpdate does this). There is no mutation that edits a subscription's commercial terms in place. - Provisioning: keep each tenant's features and quantities in sync from the tenantProvisioningChange webhook, not by polling. - Webhooks: verify the x-bunny-signature header, an HMAC-SHA1 of the raw request body with your signing key, with BunnyApp::Webhook.verify (Ruby) or bunny.webhooks.validate (Node.js). - Use the Bunny SDKs (Ruby, Node.js) for common calls, and their raw query method for everything else. ``` ## Related - [Integration points](https://docs.bunny.com/developer/integration-points): the four calls most integrations need - [Authorizing API requests](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests) and [Scopes](https://docs.bunny.com/developer/using-the-graphql-api/scopes) - [Portal session token](https://docs.bunny.com/developer/portal-session-token) - [Webhook security](https://docs.bunny.com/developer/webhooks/webhook-security) --- URL: https://docs.bunny.com/developer/using-the-graphql-api/new-to-graphql # New to GraphQL? If you haven't used GraphQL before, let's get you up to speed quickly. You'll love it! Most SaaS applications today have REST APIs that allow you to access your data programmatically. REST is easy to learn and widely adopted, but when it comes to more complex data structures, they can be hard to work with. Bunny is built on GraphQL and everything you can do via the user interface can be done via the API. GraphQL has a number of advantages over REST. - Efficient data fetching - In REST, clients often receive fixed data structures, leading to over-fetching (getting more data than needed) or under-fetching (needing multiple requests). GraphQL allows clients to request exactly the data they need in a single query, reducing unnecessary data transfer and improving performance. - Strongly typed schema - GraphQL relies on a schema with strict typing, which defines the structure of data and operations. This provides better clarity, validation, and tooling support, e.g., auto-generated documentation and type checking. - Flexible queries - Clients can tailor queries to their needs, combining multiple resources in one request. For example, fetching a user’s profile and their recent posts in REST might require separate calls, while GraphQL handles it in one go. This flexibility reduces round-trips and optimizes frontend development. - Versioning not required - REST APIs often evolve by creating new versions (e.g., /v1, /v2), which can complicate maintenance. GraphQL’s schema can evolve by adding fields or types without breaking existing queries, as clients only request what they need, reducing the need for versioning. - Better developer experience: - Tools like GraphiQL and Altair provide interactive query testing and auto-completion based on the schema. REST lacks such built-in exploration tools, often requiring separate documentation that may fall out of sync. ## Queries Where REST GET requests return entire objects, GraphQL queries specify exactly which fields to return. The query below fetches `id` and `name` for account 1. ```graphql query { account(id: 1) { id name } } ``` The data returned from the API is standard JSON. ```json { "data": { "account": { "id": "1", "name": "Acme" } } } ``` ## Nesting queries Let’s say we also want all contacts for an account. We can do that by nesting the contacts query inside `account {}`, which is simpler and faster than making multiple REST calls. ```graphql query { account(id: 1) { id name contacts { firstName lastName email } } } ``` This returns the follwing JSON. ```json { "data": { "account": { "id": "1", "name": "Acme", "contacts": [ { "firstName": "Tom", "lastName": Jones, "email": "tom@example.com" } ] } } } ``` You can get almost infinitely complex with nested queries. For example, querying an account could also include all its invoices, quotes and subscriptions. This is really the big advantage of GraphQL over REST. ## Fetching multiple objects If we want to get multiple accounts, we can do it using the plural form in the query. ```graphql { accounts { nodes { id name } } } ``` This returns an array of accounts. ```json { "data": { "accounts": { "nodes": [ { "id": "19", "name": "AA" }, { "id": "1", "name": "Acme" } ] } } } ``` And of course we can also nest contacts, deals, invoices etc inside of the accounts. ## Filters It’s not always practical to fetch all the objects of a certain type, so we have added a [filter](https://docs.bunny.com/developer/using-the-graphql-api/using-filters-in-queries) parameter that allows you to perform various types of conditions. Filters are specific to Bunny. ```graphql { accounts(filter: "name begins_with 'Ac'", first: 10) { nodes { id name } } } ``` You can also use AND, OR and grouping with parentheses to make more complex queries. ## Mutations Updating data in GraphQL is done using mutations. The syntax may seem a little complicated at first because of the strong typing, but will quickly get the hang of it. There are several ways of structuring a mutation and the one below is fairly standard. The attributes being updated are passed in a separate JSON object and the fields inside `account {}` are the fields you want returned from the API after the update has completed. ```graphql mutation accountUpdate($id: ID!, $attributes: AccountAttributes!) { accountUpdate(id: $id, attributes: $attributes) { account { name } } } ``` The JSON object tells the mutation that we are updating account with `ID` 2 and the `attributes` hash contains the fields and values we want to update. ```json { "id": "2", "attributes": { "name": "BBB" } } ``` ## Conclusion As you can probably tell, GraphQL is very powerful and provides an excellent developer experience. Plus, it’s great for doing complex ad-hoc queries for non-technical users. For more details about GraphQL check out the this [tutorial](https://graphql.org/learn/). --- URL: https://docs.bunny.com/developer/using-the-graphql-api/api # Using the API Get an access token and send GraphQL queries and mutations to Bunny's API, with JavaScript, Ruby and curl examples for subscriptions and accounts. Bunny’s GraphQL API lets you create trial subscriptions, track feature usage, update accounts, contacts, quotes and almost all other objects that you can see in the web user interface. To interact with the Bunny API you will need to follow these steps: - [Get an access token](https://docs.bunny.com/developer/using-the-graphql-api/api#get-an-access-token) - [Send a GraphQL request to query or modify data](https://docs.bunny.com/developer/using-the-graphql-api/api#send-a-graphql-request) ### Get an access token All requests to Bunny require an Access Token to be sent in an Authorization header. To get started quickly you can generate an access token directly in the Bunny admin portal or alternatively you can obtain the client credentials for an API client and generate an access token using an SDK. - In Bunny, go to Settings > Developers > API clients - Select the Default API client - Click the Generate Access Token button and copy the token ### Send a GraphQL request The Bunny SDKs offers convenience methods for some of the common GraphQL requests as well as a raw query method so that you can build your own queries. [Learn how to use the Bunny API reference to build your own custom queries](https://docs.bunny.com/developer/using-the-graphql-api/sending-a-graphql-request). For example, if a new trial has signed up in your SaaS application then you will track this in Bunny using the convenient subscription creation methods. **Javascript** ```javascript const subscription = await bunny.subscriptionCreate('free', { trial: true, accountName: 'Acme Yachts', firstName: 'Jill', lastName: 'McGill', email: 'jill@example.com', tenantCode: '123456' }) ``` **Ruby** ```ruby response = BunnyApp::Subscription.create( price_list_code: 'starter', options: { account_name: "Superdesk", first_name: "Meg", last_name: "La Don", email: "meg@example.com", trial: true, tenant_code: "123456", tenant_name: "Superdesk" } ) ``` **Curl** ```sh curl --location 'https://SUBDOMAIN.bunny.com/graphql' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ACCESS_TOKEN' \ --data-raw '{"query":"mutation subscriptionCreate ($attributes: SubscriptionAttributes!) { subscriptionCreate (attributes: $attributes) { subscription { id account { id name contacts { id firstName lastName } } trialStartDate trialEndDate startDate endDate state plan { code name } priceList { code name } tenant { id code name } } errors }}","variables":{"attributes":{"account":{"billingContact":{"firstName":"Bruce","lastName":"Wayne","email":"bruce@example.com"},"name":"Superdesk"},"trial":true,"priceListCode":"free","tenant":{"code":"tenant-123"}}}}' ``` Alternately you may want to get back a list of [Accounts](https://docs.bunny.com/developer/api-reference/types/account) including Contacts. In this case you can build and send your own query using the `query` method. **Javascript** ```javascript const query = `query accounts ($filter: String, $first: Int) { accounts (filter: $filter, first: $first) { nodes { id name contacts { firstName lastName email } } } }`; const variables = { filter: "", first: 10, }; const response = await bunny.query(query, variables); ``` **Ruby** ```ruby query = <<~'GRAPHQL' query accounts ($filter: String, $first: Int) { accounts (filter: $filter, first: $first) { nodes { id name contacts { firstName lastName email } } } } GRAPHQL variables = { filter: '', first: 10 } response = BunnyApp.query(query, variables) ``` **Curl** ```sh curl --location 'https://SUBDOMAIN.bunny.com/graphql' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ACCESS_TOKEN' \ --data '{"query":"query accounts ($filter: String, $first: Int) { accounts (filter: $filter, first: $first) { totalCount pageInfo { startCursor endCursor hasNextPage hasPreviousPage } nodes { id code name } }}","variables":{"filter":"","first":10}}' ``` GraphQL is pretty simple in the sense that you’re always just sending a HTTP POST request with a specially formatted body. Within that request body you will be asking GraphQL to perform either a query or a mutation. - [query](https://docs.bunny.com/developer/using-the-graphql-api/sending-a-graphql-request#performing-a-query) - Use this to retrieve data. - [mutation](https://docs.bunny.com/developer/api-reference/mutations) - Use this to create or modify data. ### Custom fields Any custom fields you have created will be prefixed with `custom`, for example `customProcurementPortal`. --- URL: https://docs.bunny.com/developer/using-the-graphql-api/sending-a-graphql-request # Sending a GraphQL query Learn how to build and send a GraphQL query to the Bunny API, and how to read the response. The [API reference](https://docs.bunny.com/developer/api-reference/queries) section of these docs gives you a comprehensive list of all of the objects, queries and mutations that can be performed. There are a lot of pages in the API reference so its important as a first step that you think about what it is that you want to achieve. If you want to update an object then you will want to go to the [Mutations](https://docs.bunny.com/developer/api-reference/mutations) section, alternately if you wanted to build a custom query then you would start in the [Queries](https://docs.bunny.com/developer/api-reference/queries) section. ### Performing a query For example, to [get a list of accounts](https://docs.bunny.com/developer/api-reference/queries/accounts) your query will look like this. ```graphql query accounts ($first: Int, $filter: String) { accounts (first: $first, filter: $filter) { edges { cursor node { id name } } totalCount pageInfo { startCursor endCursor hasNextPage hasPreviousPage } } } ``` ### Request You then need to combine the query with any parameters that it requires (in this case a filter and first, the number of records to return) then send the request along with a [valid access token](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests#generate-an-access-token). **Curl** ```bash curl -XPOST 'https://.bunny.com/graphql' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{"query":"query accounts ($filter: String, $first: Int) {\n accounts (filter: $filter, first: $first) {\n nodes {\n id\n name\n }\n }\n}","variables":{"filter":"","first":10}}' ``` **Ruby** ```ruby query = <<~'GRAPHQL' query accounts ($filter: String, $first: Int) { accounts (filter: $filter, first: $first) { nodes { id name } } } GRAPHQL variables = { filter: '', first: 10 } response = BunnyApp.query(query, variables) ``` **Javascript** ```javascript const query = `query accounts ($filter: String, $first: Int) { accounts (filter: $filter, first: $first) { nodes { id name } } }`; const variables = { filter: "", first: 10, }; const response = await bunny.query(query, variables); ``` ### Response Unless you’ve got an expired token then most of the time you will get a HTTP 200 response but dont immediately assume that the request worked as expected. You need to check the body of your request to see if any errors were returned. **200 Ok** Success! No errors. ```json { "data": { "accounts": { "nodes": [ { "id": "25", "name": "Collins Group" }, { "id": "29", "name": "D'Amore and Sons" }, { "id": "27", "name": "Franecki Inc" }, { "id": "30", "name": "Gleichner, Marvin and Buckridge" } ] } } } ``` Failure! In this case we’ve requested a field in our query that doesnt exist on the [Account object](https://docs.bunny.com/developer/api-reference/types/account). You may also get data validation errors so please check your query and the variables being sent and try again. ```json { "errors": [ { "message": "Field 'bogus' doesn't exist on type 'Account' - did you mean 'invalidField'?", "locations": [ { "line": 5, "column": 9 } ], "path": [ "query accounts", "accounts", "bogus" ], "extensions": { "code": "undefinedField", "typeName": "Account", "fieldName": "bogus" } } ] } ``` **401 Unauthorized** Token expired, you need to [generate a new access token](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests#generate-an-access-token). ``` [ { "description": [ "Token is expired" ] } ] ``` --- URL: https://docs.bunny.com/developer/using-the-graphql-api/using-filters-in-queries # Query filters Learn how to narrow down your GraphQL searches using Bunny's filters. Bunny’s GraphQL API follows standard practices and allows you to page through results with `first`, `last` and cursors. But filters make it possible to get very specific in a simple way. The admin UI’s table filters give a good idea of what’s possible as they are using the GraphQL filters. You can search for ranges, relative dates and much more. For example: ```graphql { invoices(filter: "createdAt is after 2024-07-14") { nodes { number } } } ``` You can also combine conditions. ```graphql { accounts(filter: "createdAt is after 2024-01-14 and billingState = 'CA'") { nodes { name } } } ``` Field names can be written in camelCase (`billingState`) or snake_case (`billing_state`). Text values go in single quotes. The operators vary by data type. | Field type | Operators | Example | | Boolean | is, is_not | evergreen is true | | Number | =, !=, <, <=, >, >=, equals, not_equals | employees >= 50 | | Text | =, !=, equals, not_equals, begins_with, ends_with, contains, contains_not | name begins_with 'Acme' | | Any | in [ ], not_in [ ] | billingState in ['CA', 'WA'] | Text comparisons are not case-sensitive. You can also test for empty values using `is blank` and `is_not blank`, for example `billingState is_not blank`. ### Dates Dates have the most complex syntax and are best explained in the simplified grammar below. Dates are written without quotes, and a time must include its UTC offset. ``` date_condition : field (is | is_not) [on] day | field (is | is_not) (on | before | after | on or before | on or after) date | field (is | is_not) (current | past | next) period | field (is | is_not) (past | next) int periods | field (is | is_not) in int periods | field (is | is_not) int periods ago day : today | yesterday | tomorrow | this week | date period : day | week | month | quarter | year periods : day[s] | week[s] | month[s] | quarter[s] | year[s] date : yyyy-mm-dd | yyyy-mm-ddThh:mm:ss+hh:mm ``` The date syntax is very powerful and allows you to easily express relative times, such as: - `createdAt is today` - `createdAt is on or after 2024-10-10` - `createdAt is before 2024-10-10T09:30:00-07:00` - `createdAt is current month` - `createdAt is past quarter` (the whole previous quarter) - `createdAt is past 3 months` - `endDate is in 3 weeks` (exactly three weeks from today) - `createdAt is 10 days ago` (exactly ten days ago) ### Grouping The filter syntax also allows you do group expressions using parenthesis and combine them with `and` and `or`, for example: ```graphql { accounts(filter: "annualRevenue > 100000 and (billingState = 'CA' or billingState = 'WA')") { nodes { id } } } ``` Put `!` in front of a group to negate it, for example `!(billingState = 'CA')`. --- URL: https://docs.bunny.com/developer/using-the-graphql-api/mutations # Sending a GraphQL mutation Learn how to use GraphQL mutations to create, update and delete objects in Bunny. Mutations are used to create, update or delete objects in Bunny. Building the mutation request is similar to building a query in the sense that you will construct a query and supply a set of input attributes. However, with mutations you can also control the type and fields that are returned once the mutation has completed. For example, to [create an account](https://docs.bunny.com/developer/api-reference/mutations/accountcreate) and then return the id and name of the new account your mutation will look like this. ```graphql mutation accountCreate ($attributes: AccountAttributes!) { accountCreate (attributes: $attributes) { account { id name } errors } } ``` You will also need to supply [valid attributes for creating an account](https://docs.bunny.com/developer/api-reference/types/accountattributes) like this ```json { "accountTypeId": "456123", "industryId": "456123", "employees": 123, "annualRevenue": 123, "name": "", "billingStreet": "", "billingCity": "", "billingState": "", "billingZip": "", "billingCountry": "", "shippingStreet": "", "shippingCity": "", "shippingState": "", "shippingZip": "", "shippingCountry": "", "description": "", "phone": "", "fax": "", "website": "", "currencyId": "456123", "groupId": "456123", "netPaymentDays": 123, "duns": "", "ownerUserId": "456123" } ``` To make the request simply combine the mutation query and attributes. **Curl** ```bash curl -XPOST 'https://.bunny.com/graphql' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{"query":"mutation accountCreate ($attributes: AccountAttributes!) {\n accountCreate (attributes: $attributes) {\n account {\n id\n name\n }\n errors\n }\n}","variables":{"attributes":{"accountTypeId":0,"industryId":0,"employees":0,"annualRevenue":0,"name":"","billingStreet":"","billingCity":"","billingState":"","billingZip":"","billingCountry":"","shippingStreet":"","shippingCity":"","shippingState":"","shippingZip":"","shippingCountry":"","description":"","phone":"","fax":"","website":"","currencyId":0,"groupId":0,"netPaymentDays":0,"duns":"","ownerUserId":0}}}' ``` **Ruby** ```ruby query = <<~'GRAPHQL' mutation accountCreate ($attributes: AccountAttributes!) { accountCreate (attributes: $attributes) { account { id name } errors } } GRAPHQL variables = { "attributes": { "accountTypeId": "456123", "industryId": "456123", "employees": 123, "annualRevenue": 123, "name": "", "billingStreet": "", "billingCity": "", "billingState": "", "billingZip": "", "billingCountry": "", "shippingStreet": "", "shippingCity": "", "shippingState": "", "shippingZip": "", "shippingCountry": "", "description": "", "phone": "", "fax": "", "website": "", "currencyId": "456123", "groupId": "456123", "netPaymentDays": 123, "duns": "", "ownerUserId": "456123" } } response = BunnyApp.query(query, variables) ``` **Javascript** ```javascript const query = `mutation accountCreate ($attributes: AccountAttributes!) { accountCreate (attributes: $attributes) { account { id name } errors } }`; const variables = { "attributes": { "accountTypeId": "456123", "industryId": "456123", "employees": 123, "annualRevenue": 123, "name": "", "billingStreet": "", "billingCity": "", "billingState": "", "billingZip": "", "billingCountry": "", "shippingStreet": "", "shippingCity": "", "shippingState": "", "shippingZip": "", "shippingCountry": "", "description": "", "phone": "", "fax": "", "website": "", "currencyId": "456123", "groupId": "456123", "netPaymentDays": 123, "duns": "", "ownerUserId": "456123" } }; const response = await bunny.query(query, variables); ``` --- URL: https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests # Authorizing API requests Generate an OAuth 2.0 access token with the client credentials grant, send it as a Bearer authorization header, and handle expired tokens in Bunny's API. If you have decided to use one of the Bunny SDKs then you dont need to worry about this part as the SDK takes care of access token generation and including it as a header on each request for you. If you’ve decided to build your own implementation and not use a Bunny SDK then you will need to do the following. - [Generate an access token](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests#generate-an-access-token) - [Include the access token in an authorization header](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests#set-an-authorization-header) - [Handle expired access tokens](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests#handling-expired-access-tokens) ### Generate an Access Token Bunny uses the OAuth 2.0 protocol for issuing tokens and authorizing requests. To generate an access token you will need the Client ID and Client Secret of Bunny API client application. [If you don’t have an API client application setup yet then follow these steps](https://docs.bunny.com/guide/tour/access-control/api-clients). To generate an access token we will be using the Client Credentials grant flow. This flow is designed to be a server side request so is not suitable for requesting tokens from a client side / javascript application. #### Request From your server side you will make the following POST request including your `client_id`, `client_secret` and the `scope` of access that you require for form encoded values. **Curl** ```bash curl --location --request POST 'https://.bunny.com/oauth/token' \ --form 'grant_type="client_credentials"' \ --form 'scope="standard:read standard:write"' \ --form 'client_id=""' \ --form 'client_secret=""' ``` **Ruby** ```ruby require "uri" require "net/http" url = URI("https://.bunny.com/oauth/token") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/x-www-form-urlencoded" form_data = [ ['grant_type', 'client_credentials'], ['scope', 'standard:read standard:write'], ['client_id', ''], ['client_secret', ''] ] request.set_form form_data, 'multipart/form-data' response = https.request(request) puts response.read_body ``` **Javascript** ```javascript var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/x-www-form-urlencoded"); var formdata = new FormData(); formdata.append("grant_type", "client_credentials"); formdata.append("scope", "standard:read standard:write"); formdata.append("client_id", ""); formdata.append("client_secret", ""); var requestOptions = { method: 'POST', headers: myHeaders, body: formdata, redirect: 'follow' }; fetch("https://.bunny.com/oauth/token", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); ``` You can only request scopes that have assigned to your API client application. #### Response You will get a JSON response containing the access token or alternately a error description describing why the request failed. **200 OK** Success! An access token is returned. ```json { "access_token": "eyJraWQiOiJPRFNuNWpnd2pESmRJdmxfTERiYmNJTkdKcTVITHo5cEhxN292NGVsb3VZIiwiYWxnIjoiSFM1MTIifQ.eyJpc3MiOiJCbGFoIEJsYWgiLCJpYXQiOjE2NTMwOTk3NDUsImp0aSI6ImFkYjliMzY5LWJiYmMtNGU1MC1iNjdjLWE1NGU5MDZjY2I5ZCIsImNsaWVudF9pZCI6Ik9EU241amd3akRKZEl2bF9MRGJiY0lOR0pxNUhMejlwSHE3b3Y0ZWxvdVkiLCJhdWQiOiJodHRwczovL2J1bm55LmludGVybmFsIiwiZXhwIjoxNjUzMTA2OTQ1LCJzY29wZSI6IiIsInN1YiI6ImM2MTBkOTFhLWQwZDUtNDQxMi1iZTE2LWQzNWQyNjVmOTRhZCJ9.tHN1jOMYojDSbg3ryrWqu4GBCUQhIqq2mRa_heXUDDHqomTFjUoPRFMmInz4X8orIdPy4Zzxu_UsoT1MZf7_iQ", "token_type": "Bearer", "expires_in": 7200, "created_at": 1653099745 } ``` **400 Bad Request** You’ve likely requested a scope that is not approved for this API client application ```json { "error": "invalid_scope", "error_description": "The requested scope is invalid, unknown, or malformed." } ``` The `grant_type` must be `client_credentials` ```json { "error": "unsupported_grant_type", "error_description": "The authorization grant type is not supported by the authorization server." } ``` **401 Unauthorized** Either the `client_id` or `client_secret` has been entered incorrectly or the API client has been deleted. ```json { "error": "invalid_client", "error_description": "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method." } ``` ### Set an authorization header Add an Authorization header to your Bunny API request, including the access token as a bearer token. For example, when getting a list of accounts. **Curl** ```bash curl --location --request POST 'https://.bunny.com/graphql' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{"query":"query accounts ($filter: String, $first: Int) {\n accounts (filter: $filter, first: $first) {\n nodes {\n id\n name\n }\n }\n}","variables":{"filter":"","first":10}}' ``` ### Handling expired access tokens Depending on the access token expiry length that was defined for your API client application at some point your token will expire and an API request will fail. In this case you will want to generate a new access token and try the request again. For example, if your API client application has an access token expiry of 7200 seconds then every 2 hours you would need to request a new token. If you proceeded to make a request after 2 hours with an expired token you would get the following response. **401 Unauthorized** ```json [ { "description": [ "Token is expired" ] } ] ``` In this case your code could watch out for the HTTP 401 status and attempt to generate a new access token. Then with the new access token you should retry the original API request. --- URL: https://docs.bunny.com/developer/using-the-graphql-api/scopes # Scopes Scopes how a user or API access token can interact with a Bunny object Scopes are assigned to User Roles or API Client applications to limit the level of access that is available to that client or user. We recommend using the principle of least privileged access. This means that you should only assign the scopes that are required to perform the API requests that you want to do. Use this list of scopes to determine which ones you need to build your API application. | Scope | Description | | admin:read | View templates and objects | | admin:write | Create, update or delete templates and objects | | analytics:read | View analytics dashboards | | analytics:write | Create, update or delete analytics dashboards | | billing:read | View billing, currencies, transactions and payments | | billing:write | Create, update or delete billing, currencies, transactions and payments | | developer:read | View API client applications | | developer:write | Create, update or delete API client applications | | owner:read | View account owner settings | | owner:write | Modify account owner settings | | platform:read | Grants no access on its own yet; pair it with platform:write | | platform:write | Update tenants with tenantUpdate and report tenant metrics with tenantMetricsUpdate | | portal:read | Read the data the customer portal shows | | portal:write | Create customer portal sessions with portalSessionCreate, without the user and role access of security:write | | portal_assume:write | Open the customer portal for a tenant from Bunny | | product:read | View products, plans, price lists and features | | product:write | Create, update or delete products, plans, price lists and features | | quoting:read | View quotes | | quoting:write | Grants no access on its own yet; creating and changing quotes needs standard:write | | security:read | View users, roles and groups | | security:write | Create, update or delete users, roles and groups | | signup:read | Read the product catalog and preview signup pricing, for the Signup component | | signup:write | Sign up a new account, for the Signup component | | standard:read | View contacts, deals, accounts, quotes and subscriptions | | standard:write | Create, update or delete contacts, deals, accounts, quotes and subscriptions | | workflow:read | View workflows | | workflow:write | Create, update or delete workflows | | openid | View the signed-in user’s profile, such as name and email | Each mutation’s page in the [API reference](https://docs.bunny.com/developer/api-reference/mutations) shows the scope it requires. ### API client applications When an API client requests an access token, it must also request the scopes that it wants access to. If the client requests scopes that have not been assigned then an error will be raised and an access token will not be returned. --- URL: https://docs.bunny.com/developer/portal-session-token # Portal session token A portal session token gives Bunny Components access to one account's data. Create one on your server with portalSessionCreate and pass it to BunnyProvider. A portal session token gives access to one account’s billing data, and nothing else. Every component except `` needs one: the components find the account from the token, so you never pass an account ID. Create the token on your server for the signed-in customer, then pass it to `BunnyProvider` as `token`. ### Create a token - Create an API client with the `portal:write` scope, and [get an access token](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests) for it. Keep this access token on your server. - Call [`portalSessionCreate`](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate) with the customer’s tenant code. `expiry` is in hours (default and maximum 24). Pass `returnUrl` to show a link back to your app in the portal, which is also where customers are sent when their session has expired. ```graphql mutation portalSessionCreate($tenantCode: String!, $expiry: Int) { portalSessionCreate(tenantCode: $tenantCode, expiry: $expiry) { token errors } } ``` With the Node SDK: `await bunny.portalSessionCreate("superdesk-123")`. - Send the returned `token` to the browser and render the components with it: ```tsx ``` When the token expires, `BunnyProvider` calls `onTokenExpired`. Fetch a new token from your server and render with it. ### Portal session token or API client token? | | Portal session token | API client token | | Data access | One account | Your whole Bunny entity, limited by scopes | | Use it in | The browser, with Bunny Components | Your server only | | Used by components | All except | only, with just the signup:read and signup:write scopes | Never send an API client token with wider scopes to the browser. Anyone can read it from the page and reach all of your Bunny data. --- URL: https://docs.bunny.com/developer/webhooks/webhooks # Webhooks overview Use webhooks to integrate, automate and track changes in Bunny Bunny can send webhooks when various events happen during a customer or subscription lifecycle. For example, when a new subscription is created or cancelled or perhaps when a payment failed. There are 2 ways that webhooks are configured in Bunny - [Platform provisioning](https://docs.bunny.com/developer/webhooks/webhooks#platform-webhooks) - When provisioning is enabled on a platform Bunny will send webhooks when a subscription state changes. e.g. Trial to paid or an increase in quantities. - [Workflows](https://docs.bunny.com/developer/webhooks/webhooks#workflow-webhooks) - A webhook action can be used to send default or custom payloads based on workflow conditions. ### Platform webhooks Bunny includes the following webhooks to help with enabling self-service or product-led saas applications using the Bunny customer portal. - Tenant provisioning change - This is sends the current subscription state and features that should be enabled on a tenant. It will be sent on creation, cancellation and any other change that happens to the subscription. - Checkout validation - This hook is useful if you want to validate that a user can change plan before allowing it via the Bunny customer portal. - [Credit balance changed](https://docs.bunny.com/developer/webhooks/credit-balance-changed) - Sent whenever a usage credit balance changes: it is blocked, or credits are added or used. Use it to stop or resume usage on a tenant. Turn on Credit balance changes enabled on the platform to receive it. #### Configure a platform webhook Go to Settings > Developers > Platforms and toggle Provisioning enabled to the on position. [image: Platform form with Provisioning enabled toggled on and Webhook URL, auth token and signing key fields] ### Workflow webhooks A webhook action can be added to any workflow. By default it will send a JSON payload containing the fields of the object that is the target of the workflow. [image: Workflow on Invoice when updated, with State is Ready condition and a Webhook action with URL, Payload and Signing Key] For example, when targeting the Invoice model. ```json { "type": "Invoice", "payload": { "id": 71, "account": { "id": 72, "name": "Swift Mobility Solutions" }, "amount": "2000.0", "amount_due": "2000.0", "amount_paid": 0, "coupon_applied": "coupon_applied", "credits": "credits", "currency_id": "USD", "description": "Invoice #I-70", "due_at": "2025-10-27", "invoice_items": [ { "id": 84, "amount": "2000.0", "charge": { "id": 86, "price": "200.0", "price_list_id": 37, "created_at": "2025-09-27T17:00:01.153-07:00", "updated_at": "2025-09-27T17:00:01.153-07:00", "warren_id": 1, "price_list_charge_id": 72, "name": "Users", "quantity": 10, "discount": "0.0", "amount": "2000.0", "subscription_id": 15, "quantity_min": 1, "quantity_max": null, "price_decimals": 2, "start_date": "2025-09-09", "end_date": "2025-10-08", "quote_charge_id": 100, "proration_rate": "0.0", "subtotal": "2000.0", "tax_amount": "0.0", "trial": false, "is_ramp": false, "tax_code": null, "vat_code": null, "kind": "renew", "charge_type": "recurring", "pricing_model": "volume", "billing_period": "monthly", "evergreen": false, "round_up_interval": null }, "charge_type": "SubscriptionCharge", "currency_id": "USD", "discount": "0.0", "is_ramp": "is_ramp", "line_text": "Ultimate - Users", "position": null, "price": "200.0", "price_decimals": 2, "price_tiers": [ { "id": 199, "starts": 1, "ends": 100, "price": "200.0", "subscription_charge_id": 86 }, { "id": 200, "starts": 101, "ends": 500, "price": "180.0", "subscription_charge_id": 86 }, { "id": 201, "starts": 501, "ends": null, "price": "160.0", "subscription_charge_id": 86 } ], "proration_rate": "0.0", "quantity": 10, "subtotal": "2000.0", "tax_amount": "0.0", "tax_code": null, "vat_code": null } ], "is_legacy": false, "net_payment_days": 30, "number": "I-70", "operations": "operations", "paid_at": null, "payment_applications": [], "po_number": null, "quote": { "id": 58 }, "small_unit_amount_due": "small_unit_amount_due", "state": "due", "subtotal": "2000.0", "tax_amount": "0.0" } } ``` #### Available webhook objects The following workflow objects can be used to trigger webhooks: - Account - Bill Run - Contact - Coupon - Deal - Email - Entity - Event - Feature Usage - Feature - Financial Account - Invoice - Job - Journal Entry - Journal Entry Line - Lead - Payment Method - Payment - Plan - Price List Charge - Price List - Product - Quote - Revenue Movement - Subscription - Tenant - User To get an sample payload for click the Send test webhook link in your workflow action. #### Custom webhook payloads When configuring a workflow with a webhook action you can customize the JSON payload with templated values based on the workflows target object. [image: Webhook workflow action with URL, Payload, Signing Key, Add Header and Send test webhook link] For example, If the object was a Subscription you could extract the state into a custom payload ```json { "state": "{{subscription.state}}" } ``` Note that the custom payload must be valid JSON ### Delivery and retries Your endpoint must respond with a 2xx status. Workflow webhooks wait up to 20 seconds for a response and platform webhooks up to 5 seconds; a failed request is tried once more. Every request, its response and its status are recorded under Settings > Developers > Webhook logs, where you can also resend a webhook. ### Set up a webhook endpoint Webhook endpoints for platform webhooks are configured under Settings > Developers > Platforms. - Set the URL of your application’s webhook receiving endpoint. - Click the Test webhook action to send a sample webhook request to your endpoint. [image: Platforms form under Product catalog with provisioning toggles and Webhook URL, auth token and signing key fields] If you are developing locally and want to test your webhook endpoint we suggest using [Ngrok](https://ngrok.com/) to expose your endpoint to the internet. Alternatively you could use a free service like [RequestBin](https://public.requestbin.com/r) to setup a temporary webhook endpoint. --- URL: https://docs.bunny.com/developer/webhooks/webhook-security # Webhook security Learn how to secure web hooks from Bunny by verifying their signature To prevent malicious actors sending fake payloads to your webhook endpoint we recommend using the following settings to improve security by making it possible to verify that Bunny was the sender of the webhook. - Webhook auth token - You can create your own token/apikey and set it in Bunny. This value will be included as bearer token in an “Authorization” header of the webhook request. - Webhook signing key - We will use this value as the shared secret key to generate a HMAC-SHA1 hash of the webhook request body. The resulting signature will be include in the x-bunny-signature header so you can use it to verify that the payload was sent by Bunny. ### Set a shared signing secret Bunny will sign each webhook payload using a shared secret that you provide. This can be configured for [platform webhooks](https://docs.bunny.com/developer/webhooks/webhooks#platform-webhooks) and [workflow webhooks](https://docs.bunny.com/developer/webhooks/webhooks). Enter a value in the Webhook signing key field and use this in your code to verify the webhook signature. #### Platform [image: Set a signing key for a Platform webhook] #### Workflow action [image: Signing key on workflow webhook] ### Verify a webhook signature When a signing key is configured Bunny will use this secret to sign the webhook payload and then include the signature in a x-bunny-signature header. You will extract the signature from the webhook header and then compare it against your own HMAC-SHA1 hash of the payload using your signing key. To make signature validation easier you can use one of our SDKs. **Ruby** ```ruby # In a Rails controller signature = request.headers["x-bunny-signature"] # The raw request body, exactly as received payload = request.raw_post signing_key = "" valid = BunnyApp::Webhook.verify(signature, payload, signing_key) ``` **Node.js** ```javascript // In an Express route that uses express.raw({ type: "application/json" }) let signature = req.headers["x-bunny-signature"]; // The raw request body, exactly as received let payload = req.body; let signingKey = ""; let valid = bunny.webhooks.validate(signature, payload, signingKey); ``` ### IP Addresses Webhook requests from Bunny originate from the following IP addresses: - 52.5.155.132 - 52.87.82.133 --- URL: https://docs.bunny.com/developer/webhooks/tenant-provisioning-change # Tenant provisioning change Keep your SaaS tenants in sync with the features enabled on their subscription A common problem with SaaS applications is that as they mature there is a disconnect between the features a customer has subscribed and paid for versus what they actually get. It might be that they are paying for features that were never unlocked on their account. Which will result in less utility, a lower customer experience and possibly see the account churn. Alternately they may have access to features they have not paid for due to an account manager enabling a feature on trial and then forgetting to actually charge them for it. In this case you will be unaware that there is an upsell opportunity available. In either case, the upshot is that keeping your SaaS tenants in sync with subscriptions has a direct correlation with revenue. Bunny helps you keep in sync through a concept that we call tenant provisioning. You can keep your tenants in sync by enabling a webhook from Bunny to notify you when subscriptions change or new features are added to a product. ### Prerequisites To enable tenant provisioning you will need the following - A Platform set up in Bunny with a [webhook URL](https://docs.bunny.com/developer/webhooks/webhooks) and Provisioning enabled. - A Product set up for the platform. - An account with a subscription to the product. If you have not created a subscription yet then you can do this via the UI or [by following this guide](https://docs.bunny.com/developer/bunny-sdk/create-a-subscription). ### Triggering the webhook Bunny sends the webhook to the webhook URL of the tenant’s platform whenever something changes what the tenant is entitled to: - A subscription is activated, for example when a trial converts to paid - A subscription is canceled, expires, or has its cancellation undone - A user extends a subscription’s trial - A quote is applied to the tenant’s subscriptions, for example a quantity change, upgrade or renewal - A subscription is linked to a different tenant - The features on a plan the tenant subscribes to are changed - You call the [tenantProvisioningSend](https://docs.bunny.com/developer/api-reference/mutations/tenantprovisioningsend) mutation, which sends the current state on demand Subscriptions in the `pending` state don’t trigger a webhook until they start. The webhook is sent directly from the platform’s settings, not through a workflow. If the platform has a Webhook auth token, it’s sent as a bearer token in the `Authorization` header, and a Webhook signing key is used to [sign the payload](https://docs.bunny.com/developer/webhooks/webhook-security). Your endpoint must respond with a 2xx status within 5 seconds. Bunny tries a failed request once more, then gives up. You can debug webhooks and resend them from the webhook log, under Settings > Developers > Webhook logs. ### The webhook payload When a provisioning change is triggered, the webhook is sent as an HTTP POST request with a JSON body. The body describes the tenant in your SaaS application that needs an update, its account and platform, and the features and subscriptions it currently has. ```json { "type": "TenantProvisioningChange", "payload": { "tenant": { "id": 311, "code": "superdesk-123456", "name": "Superdesk", "subdomain": "superdesk", "platform": { "id": 1, "code": "main", "name": "Main" }, "account": { "id": 384, "name": "Superdesk", "billing_day": 14, "contacts": [ { "id": 464, "first_name": "Meg", "last_name": "Ledon", "email": "meg@example.com" } ] } }, "change": { "features": [ { "code": "users", "name": "Users", "value": null, "quantity": 10, "plan": { "code": "business", "name": "Business" }, "price_list": { "code": "business_monthly", "name": "Business Monthly" } }, { "code": "sso", "name": "SSO", "value": null, "quantity": 0, "plan": { "code": "business", "name": "Business" }, "price_list": { "code": "business_monthly", "name": "Business Monthly" } }, { "code": "api_calls", "name": "API calls", "value": "100000", "quantity": 100000, "plan": { "code": "api_addon", "name": "API add-on" }, "price_list": { "code": "api_addon_monthly", "name": "API add-on Monthly" } }, { "code": null, "name": "Platform fee", "value": "", "quantity": 1, "plan": { "code": "business", "name": "Business" }, "price_list": { "code": "business_monthly", "name": "Business Monthly" } } ], "subscriptions": [ { "id": 31782, "state": "active", "start_date": "2026-01-14", "end_date": "2027-01-13", "trial_start_date": null, "trial_end_date": null, "plan": { "code": "business", "name": "Business" }, "price_list": { "code": "business_monthly", "name": "Business Monthly" }, "features": [ { "code": "users", "name": "Users", "value": null, "quantity": 10 }, { "code": "sso", "name": "SSO", "value": null, "quantity": 0 }, { "code": null, "name": "Platform fee", "value": "", "quantity": 1 } ], "addon": false, "addon_subscriptions": [ { "id": 31790, "state": "active", "start_date": "2026-03-14", "end_date": "2027-01-13", "trial_start_date": null, "trial_end_date": null, "plan": { "code": "api_addon", "name": "API add-on" }, "price_list": { "code": "api_addon_monthly", "name": "API add-on Monthly" }, "features": [ { "code": "api_calls", "name": "API calls", "value": "100000", "quantity": 100000 } ], "addon": true } ] } ] } } } ``` ### How to use the tenant provisioning change webhook? #### Create or update a tenant in your SaaS application Use the `tenant.code` attribute in the payload to find the tenant in your SaaS application that needs updating. Optionally, if the tenant doesn’t exist in your platform then you could provision a new tenant. The tenantCode is set when you [create a subscription](https://docs.bunny.com/developer/bunny-sdk/create-a-subscription) in Bunny. If the tenant exists then the next step is to [update the features and usage limits](https://docs.bunny.com/developer/webhooks/tenant-provisioning-change#update-features-and-set-limits) so that they are in sync with the subscription details. #### Update features and set limits `change.features` is the combined list of features the tenant should have right now, across all of its active and trial subscriptions, including add-ons. In most cases this is the only part of the payload you need. `change.subscriptions` lists each subscription with its own features, with add-on subscriptions nested under their parent in `addon_subscriptions`. Each feature has a `code`, a `name`, a `value` and a `quantity`: - For a quantity feature that is a chargeable unit, such as users, `quantity` is the quantity on the subscription’s current charges. In the example, the tenant is limited to 10 users. - For other features on the plan, `value` is the value set on the plan (`null` when none is set), and `quantity` is that value as a whole number, or `0` when it isn’t a number. In the example, the tenant has SSO and 100,000 API calls. - Each of the subscription’s current charges also appears. A charge that isn’t linked to a feature has a `null` code and the charge’s name, like the Platform fee in the example; skip these. Plan features only appear when the feature has Is provisioned to platform turned on. A feature that is missing from `change.features` should be turned off. To prevent headaches when you scale up you should only allow access to features if they are enabled on a subscription. For example, if a tenant wanted to try a new feature, then you would first create it in Bunny and add it to their subscription. Then trigger the provisioning webhook to enable the feature on the tenant. --- URL: https://docs.bunny.com/developer/webhooks/checkout-validation # Checkout validation A webhook that lets you check if a plan or quantity change is allowed before the user can checkout. When a user attempts to upgrade or change their subscription using the Bunny portal we call this a checkout. In some cases you might want to check if the plan or quantity change should be allowed before letting the user proceed. Bunny sends the checkout validation webhook: - while the user builds or edits their change in the checkout - when the user checks out, before any payment is taken - when a new customer signs up, after their account and tenant are created and before any payment is taken For example, you have a customer on a plan that includes 10 users and they have created 10 users on your platform. If they then tried to downgrade to a plan that only had 5 users you could use this webhook to block the change and provide a message explaning that they need to delete or deactivate some users before they can proceed with the change. ### Enabling checkout validation To enable this webhook you will need to ensure that you have [enabled a webhook endpoint for your platform in Bunny](https://docs.bunny.com/developer/webhooks/webhooks). Then turn on Checkout validation enabled on your platform. [image: Checkout validation enabled toggle switched on in the platform settings] ### Checkout validation webhook payload The payload that will be sent will contain information about the tenant on your platform that is requesting a change and the features and quantities that they will be change to. ```json { "type": "CheckoutValidation", "payload": { "tenant": { "id": 132, "code": "8c665dde-69ae-4c53-990b-3d19bf71791e", "name": "Superdesk Inc" }, "change": { "features": [ { "code": "users", "name": "Users", "value": "", "quantity": 10, "plan": { "code": "enterprise", "name": "Enterprise" }, "price_list": { "code": null, "name": "Enterprise Monthly" } }, { "code": "widgets", "name": "Widgets", "value": "100", "quantity": 100, "plan": { "code": "enterprise", "name": "Enterprise" }, "price_list": { "code": null, "name": "Enterprise Monthly" } } ] } } } ``` `change` is always an object, and each feature’s `value` is always a string. It’s empty for features without a value. If you wanted to validate the number of users you would use the Tenant code to look up the relevant tenant in your application, get a count of the users and then compare this to the number of users requested in the checkout validation payload. For a signup, the tenant is new, so your application may not know its code yet. ### Responding to the webhook If you opt in to the checkout validation webhook, your endpoint decides whether the change can go ahead. Bunny waits up to 5 seconds for the response and doesn’t retry. The request is signed with the platform’s Webhook signing key so you can [verify it](https://docs.bunny.com/developer/webhooks/webhook-security). Unlike the provisioning webhook, it doesn’t include the Webhook auth token. #### Change approved Respond with any 2xx status, for example `200 OK`. The user can continue with the subscription change. No response body is required and will be ignored if provided. #### Change denied Respond with `422 Unprocessable Content`. The user can’t continue and is shown the messages you return. The response body must be a non-empty JSON array of strings that explain why the subscription change is not possible. ```json [ "You have too many users to downgrade to this plan. Please remove some users and try again." ] ``` #### Validation unavailable Any other outcome also blocks the change. That includes a timeout, a refused connection, a failed TLS handshake, any other status code, and a 422 whose body isn’t a non-empty array of strings. The user sees “We couldn’t validate this change right now. Please try again or contact support.” Make sure the endpoint answers quickly and reliably. When a signup is blocked, the new account and tenant stay in Bunny as a prospect, with no subscription and no payment taken. [image: Portal error message: You have too many notes to change to this plan. Delete some notes and try again.] The response from a denied checkout validation is displayed to the user. --- URL: https://docs.bunny.com/developer/webhooks/credit-balance-changed # Credit balance changed Know when a tenant's usage credits are blocked, added or used, so your application can stop or resume usage When a subscription pays for usage with credits, Bunny keeps a credit balance for it. Bunny sends a `CreditBalanceChanged` webhook to your platform every time that balance changes, so your application can stop serving a tenant whose credits ran out and serve them again once credits are added. ### Enabling the webhook To enable this webhook you need a [webhook endpoint for your platform in Bunny](https://docs.bunny.com/developer/webhooks/webhooks). Then turn on Credit balance changes enabled on your platform. The webhook is off until you turn it on. ### When the webhook is sent Bunny sends the webhook whenever a credit balance’s state or balance changes. That includes: - Usage drawing credits down, and usage blocking the balance when it runs out. - Credits added, such as a grant, a top-up, included credits or credits returned from an invoice. - Credits removed other than by usage, such as an expiry or a void. - Credits becoming usable, when a grant with a later start date starts. Usage sends one webhook each time it draws credits down, so a busy tenant sends many webhooks. ### Balance states | State | Meaning | | ok | Credits are available. | | depleted | No credits are left, but usage continues and is billed as overage. | | blocked | No credits are left and usage is blocked until credits are added. Your application should stop usage. | A balance blocks when its usage charge’s depletion policy is `block`, or `top_up` while the top-up is being bought. With `overage`, it becomes `depleted` instead. ### The webhook payload ```json { "type": "CreditBalanceChanged", "payload": { "tenant": { "id": 23500, "code": "superdesk-1234", "name": "Superdesk Inc", "subdomain": "superdesk", "tenant_uuid": "8f6c1c9e-1d2b-4c35-9a53-0b8f4f3c2d11", "platform": { "id": 95, "code": "main", "name": "Main" }, "account": { "id": 31455, "name": "Superdesk Inc", "billing_day": 16, "contacts": [ { "id": 31059, "first_name": "Doug", "last_name": "Holes", "email": "doug@example.com" } ] } }, "change": { "occurred_at": "2026-11-05T17:42:10.123456Z", "sequence": 42, "credit_balance_id": 812, "feature": { "id": 77, "code": "api_calls", "name": "API call" }, "currency_id": null, "previous_state": "blocked", "state": "ok", "previous_balance": 0.0, "balance": 100.0, "subscription": { "id": 31782, "state": "active" } } } } ``` #### Change fields | Field | Description | | occurred_at | When the change happened. | | sequence | Goes up as credits are added or used. Use it to ignore a webhook that arrives after a newer one. | | credit_balance_id | The credit balance that changed. | | feature, currency_id | What the balance holds: units of a feature (feature is set) or money (currency_id is set). | | previous_state, state | The balance’s state before and after the change. | | previous_balance, balance | The balance before and after the change. It includes credits granted with a later start date. | | subscription | The subscription the balance belongs to. | ### How to use the credit balance changed webhook Use `tenant.code` to find the tenant in your application, then: - Blocked: `state` is `blocked`. Stop usage for the feature in `feature`, or for all credit usage if the balance is in money. - Unblocked: `previous_state` is `blocked` and `state` is not. Allow usage again. - Credits added or used: compare `balance` with `previous_balance`. Webhooks can arrive out of order when a delivery is retried. Store the last `sequence` you handled for each `credit_balance_id`, and ignore a webhook with a lower `sequence`. If two webhooks have the same `sequence`, the one with the later `occurred_at` is newer. We expect your webhook endpoint to return a HTTP 200 response. --- URL: https://docs.bunny.com/developer/bunny-sdk/install-the-sdk # Install the SDK Install the Bunny Node.js or Ruby SDK, configure it with client credentials or an access token, and see which GraphQL operations its helpers call. Bunny provides server side libraries that abstract much of the authentication, authorization and request formation boilerplate code required to make API requests. You can find the source code for the two SDKs here: - [Node SDK](https://github.com/bunnyapp/bunny-node) - [Ruby SDK](https://github.com/bunnyapp/bunny-ruby) Installing the SDKs is straighforward. **Node.js** Install the Bunny SDK via NPM ``` npm install @bunnyapp/api-client --save ``` Set the access token ```javascript const Bunny = require("@bunnyapp/api-client"); const bunny = new Bunny({ accessToken: "", baseUrl: "https://.bunny.com" }); ``` Or alternatively use client credentials. This will enable automatic refresh of expired access tokens. ```javascript const Bunny = require("@bunnyapp/api-client"); const bunny = new Bunny({ clientId: "", clientSecret: "", scope: "standard:read standard:write", baseUrl: "https://.bunny.com" }); ``` Source: [https://github.com/bunnyapp/bunny-node](https://github.com/bunnyapp/bunny-node) **Ruby** Install the Bunny SDK via RubyGems ``` gem install bunny_app ``` Use Rails generator to create `initializers/bunny_app.rb` ``` bin/rails g bunny_app:install ``` Set access token ```ruby require 'bunny_app' BunnyApp.config do |c| c.access_token = 'xxx' c.base_uri = 'https://.bunny.com' end ``` Or alternatively use client credentials. This will enable automatic refresh of expired access tokens. ```ruby require 'bunny_app' BunnyApp.config do |c| c.client_id = 'xxx' c.client_secret = 'xxx' c.scope = 'standard:read standard:write' c.base_uri = 'https://.bunny.com' end ``` Source: [https://github.com/bunnyapp/bunny-ruby](https://github.com/bunnyapp/bunny-ruby) We recommend using one of our official SDKs, however if you want to write your own code then you will need to [generate an access token and include it in the Authorization header of your GraphQL requests](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests). You should also keep in mind handling access token expiry errors and retries. ## What the SDKs cover The SDKs are thin wrappers around Bunny’s [GraphQL API](https://docs.bunny.com/developer/using-the-graphql-api/api). They get access tokens for you, and add helpers for the most common calls: | Task | Node.js | Ruby | GraphQL operation | | Create a subscription | subscriptionCreate | BunnyApp::Subscription.create | subscriptionCreate | | Cancel a subscription | subscriptionCancel | BunnyApp::Subscription.cancel | subscriptionCancel | | Change quantities | | BunnyApp::Subscription.quantity_update | subscriptionQuantityUpdate | | Convert a trial | | BunnyApp::Subscription.trial_convert | subscriptionTrialConvert | | Report usage | featureUsageCreate | BunnyApp::FeatureUsage.create | featureUsageCreate | | Create a portal session | portalSessionCreate | BunnyApp::PortalSession.create | portalSessionCreate | | Report tenant metrics | tenantMetricsUpdate | BunnyApp::TenantMetrics.update | tenantMetricsUpdate | | Find a tenant by code | tenantByCode | BunnyApp::Tenant.find_by | tenant | | Create a tenant | tenantCreate | BunnyApp::Tenant.create | tenantCreate | | Update a tenant | tenantUpdate | | tenantUpdate | | Update an account by tenant code | accountUpdateByTenantCode | | accountUpdate | | Create a platform | | BunnyApp::Platform.create | platformCreate | | Verify a webhook signature | bunny.webhooks.validate | BunnyApp::Webhook.verify | None: checked in your code | For anything else, send the GraphQL yourself through the SDK, which still handles the token: `bunny.query(query, variables)` in Node.js, or `BunnyApp.query(query, variables)` in Ruby. Find the operation and its arguments in the [API reference](https://docs.bunny.com/developer/api-reference/mutations). See [Sending a GraphQL query](https://docs.bunny.com/developer/using-the-graphql-api/sending-a-graphql-request). --- URL: https://docs.bunny.com/developer/bunny-sdk/create-a-subscription # Create a subscription Learn how to track trials and create subscriptions for users of your SaaS application When a new tenant is created in your SaaS application it will be reflected in Bunny as a Subscription. There are 2 main types of subscription: - Trial - where a product plan has been configured to allow trials this type of subscription will be flagged as a trial. At the end of the trial it will either cancel or activate to a paid subscription. - Active - this is a paid subscription. Invoices will be generated and payments will be collected. You should make the request to create a new subscription in Bunny immediately after a new sign-up happens on your SaaS application. ### Prerequisites Before you can start tracking your trial subscriptions you will need to complete these tasks: - Create a Plan and associated Price List in Bunny. Take note of the code that you set for the price list as you will need that in the next step. - [Create an API client](https://docs.bunny.com/guide/tour/access-control/api-clients) & [install a Bunny SDK](https://docs.bunny.com/developer/bunny-sdk/install-the-sdk) When creating an API client you need to select the scopes that you want to allow. To create subscriptions in Bunny your API client needs the `standard:read` and `standard:write` scopes. ### Make the request Assuming that you have completed both of the prerequisite steps you should have API credentials and a Bunny SDK installed as well as having a plan, price list and code setup. You can either use the [subscriptionCreate mutation](https://docs.bunny.com/developer/api-reference/mutations/subscriptioncreate) or the create subscription method on our SDKs to setup a new subscription. For example, create a new trial subscription and provide Bunny with the unique ID of the new tenant in your SaaS application. **GraphQL** #### Mutation ```graphql mutation subscriptionCreate ($attributes: SubscriptionAttributes!) { subscriptionCreate (attributes: $attributes) { subscription { id account { id name contacts { id firstName lastName } } trialStartDate trialEndDate startDate endDate state plan { code name } priceList { code name } tenant { id code name } } errors } } ``` #### Attributes ```json { "attributes": { "account": { "billingContact": { "firstName": "John", "lastName": "Titor", "email": "john@example.com" }, "name": "Superdesk Inc" }, "trial": true, "priceListCode": "free", "tenant":{ "code": "superdesk" } } } ``` **Ruby** ```ruby response = BunnyApp::Subscription.create( price_list_code: 'starter', options: { account_name: "Superdesk", first_name: "Meg", last_name: "La Don", email: "meg@example.com", trial: true, tenant_code: "123456", tenant_name: "Superdesk" } ) ``` **Node.js** ```javascript const res = await bunny.subscriptionCreate("priceListCode", { trial: true, accountName: "accountName", firstName: "firstName", lastName: "lastName", email: "email@example.com", tenantCode: "remoteId", }); ``` We recommend submitting the tenantCode with your request so that Bunny is aware which tenant in your SaaS application the subscription belongs to. Bunny will send your tenantCode back with subscription change webhooks so that you know which of your tenants to update with any changes. #### Optional parameters | Parameter | | | | trial | Boolean | If the product plan supports a trial period then when this parameter is `true` the subscription will be created in a TRIAL state. | | tenantCode | String | The unique identifier for the tenant on your SaaS platform. | | evergreen | Boolean | Whether the subscription renews automatically at the end of each term. The Node SDK defaults this to true and the Ruby SDK to false, so set it explicitly. | For more detail on all of the parameters that can be set when creating a trial see the [subscriptionAttributes](https://docs.bunny.com/developer/api-reference/types/subscriptionattributes) object. ### Handling errors Providing that you have a valid access_token and well formed query then any errors are likely to be related to the data you are submitting. The SDKs turn these errors into exceptions: the Node SDK throws an `Error` and the Ruby SDK raises `BunnyApp::ResponseError`, both with the error messages. In the case of an error the response will contain an `errors` section that provides detail on what went wrong. For example, In this case we provided an invalid product plan code. ```json { "data": { "subscriptionCreate": null }, "errors": [ { "message": "Product plan not found", "locations": [ { "line": 2, "column": 5 } ], "path": [ "subscriptionCreate" ] } ] } ``` ### What happens next? After a success request to create a subscription the following objects will be created in your Bunny account. - `Account` - The company or organization that has signed up for your SaaS application - `Contact` - `Deal` - A new deal representing the trial or new business opportunity. - `Quote` - Subscription - `Tenant` - If provisoning is enabled on your platform. If you created a trial subscription then get to work on making the customer experience awesome and converting that trial to a paid subscription. --- URL: https://docs.bunny.com/developer/bunny-sdk/track-usage-for-billing # Track usage for billing Track feature usage for usage-based billing with the featureUsageCreate mutation, and choose Sum, Max, Last or Average usage calculation for each billing period. If your product offers a usage based billing component such as monthly active users then you will need a way to track usage and calculate the invoice total at the end of each period. Bunny provides an API for tracking feature usage and will take care of the billing calculations for you. #### Usage calculations When a usage based charge is added to a price list in Bunny you will need to set the Usage Calculation Type to one of the following values. This will determine how the usage is calculated at billing time. A record counts towards the billing period that its usageAt falls in. - Sum - The billing process will take a sum of quantity values for all feature usage records in the billing period. - Max - The billing process will take the maximum quantity value from all feature usage records in the billing period. - Last - The billing process will take the quantity value of the record with the latest usageAt in the billing period. - Average - The billing process will take the average quantity value of all feature usage records in the billing period. For example, If you wanted to charge based on the number of SMS messages sent during a period then you use the Sum calculation and create a feature usage record for every SMS that is sent. Or, alternatively if you wanted to track monthly active users then you would need to keep note of each tenants billing day from Bunny. You would then do a calculation to find the total users for the period and send this in a single request to Bunny using the Last option. ### Prerequisites Before you can start tracking feature usage from your SaaS application you need to complete the following steps on the Bunny side first. - [Create an API client & install a Bunny SDK](https://docs.bunny.com/developer/using-the-graphql-api/api) - Create a Feature in Bunny with Is Unit enabled. Then create a product plan and price list with a usage based charge using the feature unit. \&#xNAN;Take note of the code that you set for the feature as you will need that in the next step. - Create a subscription based on the plan and price list that you setup in the previous step and take note of the Subscription ID number. ### Create a feature usage record Feature usage is tracked via the [featureUsageCreate](https://docs.bunny.com/developer/api-reference/mutations/featureusagecreate) mutation. If the usageAt attribute is not supplied then it will default to the current datetime. **GraphQL** FeatureUsageAttributes ```json { "attributes": { "quantity": 1, "usageAt": "2018-10-21T11:53:12Z", "subscriptionId": 123456, "featureCode": "users" } } ``` Mutation ```graphql mutation featureUsageCreate ($attributes: FeatureUsageAttributes!) { featureUsageCreate (attributes: $attributes) { errors } } ``` **Ruby** ```ruby response = BunnyApp::FeatureUsage.create( quantity: 5, feature_code: 'users', subscription_id: 123456, usage_at: '2022-03-10' ) ``` **Node.js** ```javascript let featureCode = 'sms' let quantity = 25 let usageAt = '2018-10-21T11:53:12Z' let subscriptionId = '123456' res = await bunny.featureUsageCreate(featureCode, quantity, subscriptionId, usageAt) ``` ### Rules for usage records - The subscription must be active, trial or pending. Usage for a canceled or expired subscription is rejected. - With subscriptionId, only active and trial subscriptions are accepted, and a pending one returns `Inactive subscription`. To record usage for a pending subscription, send subscriptionChargeId instead. - usageAt must fall within the subscription: on or after its start date (its trial start date during a trial) and on or before its end date. For a pending subscription, send a usageAt on or after its start date, as usage dated today falls before it starts. Set overrideUsageAtLimit to `true` to record usage outside those dates. - If the subscription has more than one usage charge for the feature and one of them is drawn from credits, subscriptionId returns `More than one usage charge for this feature; give a subscriptionChargeId`. Send subscriptionChargeId to name the charge. - usageAt is read as a date and time in the timezone of the subscription’s entity, and any UTC offset you send is ignored. For example, `2026-03-31T23:30:00Z` is recorded as 11:30 PM on March 31 in the entity’s timezone, whatever that is in UTC. If a billing period has already passed and been processed then setting a historical date for usageAt will not be picked up in the next billing run. ### Usage drawn from credits If the usage charge is drawn from prepaid credits, each usage record draws down the subscription’s credit balance as it arrives, and the `featureUsageCreate` response returns the balances it drew from in `creditBalances`, with their `state`. See [Tracking usage and balances with the API](https://docs.bunny.com/guide/tour/product-catalog/charges/usage-credits#tracking-usage-and-balances-with-the-api) for reading balances, the ledger and adding credits, and the [Credit balance changed](https://docs.bunny.com/developer/webhooks/credit-balance-changed) webhook to be told when a balance runs out. --- URL: https://docs.bunny.com/developer/bunny-sdk/track-tenant-metrics # Track tenant metrics Report tenant last login, user count and custom utilization metrics to Bunny with the tenantMetricsUpdate mutation via GraphQL, Ruby or Node.js. Your platform can often seem like a black box when it comes to what tenants are doing with your application. It can be very useful to see when someone has last logged in, how many users there are in the tenant and how much of the functionality has been activated. Bunny can track some of these metics, so you have more insight into tenant activity via Bunny’s user interface. - Last login - User count - Utilization metics Utilization metrics is a hash of values that you deem important signals to a customer’s engagement with your app. For example, if your app is a learning-management solution, you could track number of courses defined, courses attended and students. ### Prerequisites Before you can start tracking metrics from your application, you need to complete the following steps on the Bunny side first. - [Create an API client & install a Bunny SDK](https://docs.bunny.com/developer/using-the-graphql-api/api) - Create an tenant in Bunny to represent a tenant in your SaaS application. If you’ve already [enabled tenant provisioning](https://docs.bunny.com/developer/webhooks/webhooks) then you wont need to do this step as Bunny will assign a tenant to each new subscription for you. ### Report tenant metrics Metrics are tracked via the [tenantMetricsUpdate](https://docs.bunny.com/developer/api-reference/mutations/tenantmetricsupdate) mutation. **GraphQL** #### TenantMetricsAttributes ```json { "code": "10012032", "attributes": { "lastLogin": "2023-10-20", "userCount": 10, "utilizationMetrics": { "coursesCreated": 10, "coursesAttended": 50 } } } ``` #### Mutation ```graphql mutation tenantMetricsUpdate ($code: String!, $attributes: TenantMetricsAttributes!){ tenantMetricsUpdate (code: $code, attributes: $attributes) { errors } } ``` **Ruby** ```ruby res = BunnyApp::TenantMetrics.update( code: '54681cba-8509-4c81-b170-b1debd73dbfd', last_login: '2023-12-17', user_count: 900, utilization_metrics: { coursesCreated: 25, } ) ``` **Node.js** ```javascript let tenantCode = '10012032' let lastLogin = '2023-10-20' let userCount = 413 let metrics = { "coursesCreated": 10, "coursesAttended": 50 } res = await bunny.tenantMetricsUpdate(tenantCode, lastLogin, userCount, metrics) ``` ### View metrics You can see all the metrics on the tenant form. [image: Tenant form showing name, code, account and platform, with Last login, User count and utilization metrics like coursesCreated] Tenant --- URL: https://docs.bunny.com/developer/bunny-sdk/get-subscription-features # Get subscription features As an alternate to using the tenant provisioning webhooks you can query for the features that should be enabled on a tenant. To find out which features and quantities a tenant is entitled to, query the tenant’s active and trial subscriptions together with their plan features and current charges. This is the same information Bunny uses to build the [tenant provisioning change](https://docs.bunny.com/developer/webhooks/tenant-provisioning-change) webhook. ### Query Look the tenant up by the unique code you assigned to it. The code is typically the tenant’s identifier in your SaaS application. **GraphQL** ```graphql query tenantEntitlements ($code: String!) { tenant (code: $code) { id code name account { subscriptions (filter: "state in ['active', 'trial']") { id state tenant { code } plan { code name planFeatures { value feature { code name kind isUnit isProvisioned } } } priceList { code name } currentCharges { quantity feature { code } } } } } } ``` Variables ```json { "code": "tenant-553" } ``` **Node.js** ```javascript const query = `query tenantEntitlements ($code: String!) { tenant (code: $code) { id code name account { subscriptions (filter: "state in ['active', 'trial']") { id state tenant { code } plan { code name planFeatures { value feature { code name kind isUnit isProvisioned } } } priceList { code name } currentCharges { quantity feature { code } } } } } }`; const res = await bunny.query(query, { code: "tenant-553" }); ``` **Ruby** ```ruby query = <<~'GRAPHQL' query tenantEntitlements ($code: String!) { tenant (code: $code) { id code name account { subscriptions (filter: "state in ['active', 'trial']") { id state tenant { code } plan { code name planFeatures { value feature { code name kind isUnit isProvisioned } } } priceList { code name } currentCharges { quantity feature { code } } } } } } GRAPHQL response = BunnyApp.query(query, { code: 'tenant-553' }) ``` ### Response An account can have several tenants, so `account.subscriptions` returns the subscriptions of every tenant on the account. Keep the ones whose `tenant.code` matches the tenant you asked for. ```json { "data": { "tenant": { "id": "418", "code": "tenant-553", "name": "Superdesk", "account": { "subscriptions": [ { "id": "31782", "state": "ACTIVE", "tenant": { "code": "tenant-553" }, "plan": { "code": "business", "name": "Business", "planFeatures": [ { "value": null, "feature": { "code": "users", "name": "Users", "kind": "QUANTITY", "isUnit": true, "isProvisioned": true } }, { "value": "custom", "feature": { "code": "workflows", "name": "Workflows", "kind": "VALUE", "isUnit": false, "isProvisioned": true } }, { "value": null, "feature": { "code": "sso", "name": "SSO", "kind": "BOOLEAN", "isUnit": false, "isProvisioned": true } } ] }, "priceList": { "code": "business_monthly", "name": "Monthly" }, "currentCharges": [ { "quantity": 50, "feature": { "code": "users" } } ] } ] } } } } ``` ### Work out the entitlements For each subscription, go through `plan.planFeatures` and skip any feature where `isProvisioned` is `false`. Bunny leaves those out of provisioning too. - Quantity units (`kind` is `QUANTITY` and `isUnit` is `true`): the quantity is the sum of `quantity` over the `currentCharges` whose `feature.code` matches. In the example, the tenant has 50 users. - Every other feature: the feature is enabled, and its setting is the plan feature’s `value`. In the example, the tenant has SSO and has workflows set to `custom`. If the tenant has several subscriptions, for example a plan and an add-on, combine the features across all of them. To receive exactly what the provisioning webhook contains instead, call the [tenantProvisioningSend](https://docs.bunny.com/developer/api-reference/mutations/tenantprovisioningsend) mutation. Bunny sends a fresh provisioning webhook for the tenant to your platform’s webhook URL. --- URL: https://docs.bunny.com/developer/bunny-components/installation # Installation Install @bunnyapp/components, add its peer dependencies, whitelist your origin and pick the token each component needs. ```sh npm i @bunnyapp/components ``` Until 2.0.0 is released, install the prerelease with `npm i @bunnyapp/components@beta` (2.0.0-beta.N). ## Peer dependencies The package expects these to be installed in your app: ```sh npm i react@18 react-dom@18 antd @ant-design/icons @tanstack/react-query graphql graphql-request \ @stripe/stripe-js @stripe/react-stripe-js @sentry/react @pdf-viewer/react interweave \ less lodash-es pluralize recharts recoil styled-components \ @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons \ @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons \ @fortawesome/react-fontawesome ``` The components support React 18 only (React 19 is not supported). See `peerDependencies` in the package’s [package.json on npm](https://www.npmjs.com/package/@bunnyapp/components) for the supported version ranges. ## Whitelist your origin Bunny checks the hostname of the page that embeds the components against a list of allowed domains. Add every site that will embed them, for example `localhost` for development and `app.acme.com` for production. Without this, requests are rejected with a 401 `CORS origin not allowed` error. In Bunny, go to Settings > Company > Security and add them under Whitelisted origin domains (card “CORS settings for Bunny components”), separated by spaces. - Use the hostname only: no scheme (`https://`) and no port. `localhost` covers every port. - The match is exact and there are no wildcards, so list each subdomain separately. - A request without a `Referer` header (for example when your site sends `Referrer-Policy: no-referrer`) is rejected too. [image: Company settings Security tab with localhost and app.acme.com in Whitelisted origin domains under CORS settings] ## Tokens Every component needs a token on its [`BunnyProvider`](https://docs.bunny.com/developer/bunny-components/bunny-components#parameters). Which token to use: | Component | Token | | Checkout, BillingDetails, Invoice, Subscriptions, Quote, Quotes, Transactions | A portal session token, which scopes the token to a single account. See how to generate a portal session token. | | Signup | An API client token that only has the signup:read and signup:write scopes. See Signup. | --- URL: https://docs.bunny.com/developer/bunny-components/bunny-components # Components overview Embed Bunny's React components for checkout, signup, billing details, invoices, subscriptions and quotes, and wrap them in a BunnyProvider. Embeddable React components for Bunny. [Install them](https://docs.bunny.com/developer/bunny-components/installation) first. - [Checkout](https://docs.bunny.com/developer/bunny-components/checkout) - subscribe an existing account to a price list - [Signup](https://docs.bunny.com/developer/bunny-components/signup) - sign up for a new account and subscription - [BillingDetails](https://docs.bunny.com/developer/bunny-components/billing-details) - update account details, billing address and payment methods - [Invoice](https://docs.bunny.com/developer/bunny-components/invoice) - show and pay an invoice - [Invoices](https://docs.bunny.com/developer/bunny-components/invoices) - show a list of invoices - [Subscriptions](https://docs.bunny.com/developer/bunny-components/subscriptions) - view, upgrade, downgrade and cancel subscriptions, and change quantities. Upgrade is its plan picker on its own. - [Quote](https://docs.bunny.com/developer/bunny-components/quote) - show and accept a quote - [Quotes](https://docs.bunny.com/developer/bunny-components/quotes) - show a list of quotes - [Transactions](https://docs.bunny.com/developer/bunny-components/transactions) - show a list of invoices, payments and refunds Every component needs a token (see [Tokens](https://docs.bunny.com/developer/bunny-components/installation#tokens)), and your origin must be [whitelisted](https://docs.bunny.com/developer/bunny-components/installation#whitelist-your-origin) to avoid CORS errors. Restyle components with the `appearance` prop: see [Styling](https://docs.bunny.com/developer/bunny-components/styling). ## Usage Wrap the components in a `BunnyProvider`, which holds the state they share. Use a single `BunnyProvider` as the parent of all of them: with one provider per component, a payment method saved in `Invoice` would not appear in `BillingDetails`. ```tsx import { BunnyProvider, Invoice, BillingDetails } from "@bunnyapp/components"; function App() { return ( ); } ``` ### Parameters - `token`: The token the components use to call Bunny. See [Tokens](https://docs.bunny.com/developer/bunny-components/installation#tokens). - `apiHost`: The API host the components will make requests to. e.g. `https://acme.bunny.com` - `appearance`: Optional. Restyles every component inside the provider. See [Styling](https://docs.bunny.com/developer/bunny-components/styling). ## Using with an AI assistant The package ships a `bunny-components` agent skill matching the installed version. Install it into Claude Code, Cursor, Codex, Copilot, Gemini and other compatible tools with: ```sh npx skills add ./node_modules/@bunnyapp/components ``` See [AI Agent Skills](https://docs.bunny.com/guide/tour/revops-agent/skills-bunny-ai-toolkit) for the rest of Bunny’s agent tooling. --- URL: https://docs.bunny.com/developer/bunny-components/styling # Styling Restyle Bunny's React components to match your brand with the appearance prop, using variables, rules and fonts, on BunnyProvider or on a single component. Every Bunny component is styled through one prop, `appearance`. Set it on `BunnyProvider` to restyle every component inside it, or on any component to restyle just that one on top of the provider’s. `style` and `className` on a component are for positioning only. `appearance` has three parts: - `variables`: colors, font, radius and spacing the default look is built from. Change one and everything built from it follows. - `rules`: per-selector overrides such as `.Input`, `.Label` or `.Button`, merged over the defaults. - `fonts`: web fonts for `variables.fontFamily`, loaded onto the page and into the payment fields. ```tsx import { BunnyProvider, Checkout } from "@bunnyapp/components"; ``` ## Examples Two looks built only with `appearance`, shown on Checkout. The same object restyles every other component, including the card fields. **Ledger** Editorial and print-like: warm paper, ink hairlines, square corners and a serif face. [image: Checkout in the Ledger style: cream background, serif type, square black-bordered inputs, a black selected Card tab and a black Pay button with spaced lettering] Checkout with the Ledger appearance. ```tsx const ledger = { variables: { colorPrimary: "#14532d", colorBackground: "#fffdf8", colorBackgroundSecondary: "#f6f1e7", colorText: "#1c1917", colorTextSecondary: "#6b635a", colorTextPlaceholder: "#a8a096", colorDanger: "#9f1239", colorSuccess: "#14532d", colorBorder: "#1c1917", borderWidth: "1px", borderRadius: "0px", fontFamily: '"Source Serif 4", Georgia, serif', fontSizeBase: "16px", focusBoxShadow: "none", gridRowSpacing: "24px", }, rules: { ".Label": { fontSize: "14px", fontWeight: "600", color: "#6b635a", marginBottom: "8px" }, ".Input": { padding: "11px 12px" }, ".Input:hover": { borderColor: "#1c1917" }, ".Input:focus": { borderColor: "#14532d", boxShadow: "0 0 0 1px #14532d" }, ".Input--invalid": { borderColor: "#9f1239", boxShadow: "0 0 0 1px #9f1239" }, ".Error": { fontSize: "13px" }, ".Tab": { fontWeight: "500" }, ".Tab:hover": { borderColor: "#1c1917" }, ".Tab--selected": { backgroundColor: "#1c1917", color: "#fffdf8", borderColor: "#1c1917" }, ".Tab:focus": { boxShadow: "0 0 0 1px #14532d" }, ".Button": { backgroundColor: "#1c1917", color: "#fffdf8", letterSpacing: "0.1em", fontSize: "13px", fontWeight: "600", padding: "14px 16px", }, ".Button:hover": { backgroundColor: "#14532d" }, ".Button:active": { backgroundColor: "#052e16" }, ".Tag": { fontWeight: "600", textTransform: "uppercase", letterSpacing: "0.06em", fontSize: "11px" }, ".Card": { border: "1px solid #1c1917", boxShadow: "none" }, ".Switch--checked": { backgroundColor: "#14532d" }, ".Heading": { letterSpacing: "-0.01em" }, ".Amount": { fontWeight: "600" }, ".Overline": { color: "#1c1917", letterSpacing: "0.08em" }, ".Document": { border: "1px solid #1c1917", boxShadow: "none" }, }, fonts: [ { cssSrc: "https://fonts.googleapis.com/css2?family=Source+Serif+4:wght@400;500;600&display=swap" }, ], }; ``` **Midnight** Dark fintech: navy columns, filled inputs, a lime accent, a pill button and a monospace face. [image: Checkout in the Midnight style: dark navy background, monospace type, filled navy inputs, a lime-outlined selected Card tab, a lime total and a rounded lime Pay button] Checkout with the Midnight appearance. ```tsx const midnight = { variables: { colorPrimary: "#a3e635", colorOnPrimary: "#0b1020", // lime is light, so text on it is dark navy colorBackground: "#0f1629", colorBackgroundSecondary: "#0b1020", colorText: "#e6e9f2", colorTextSecondary: "#8b93a7", colorTextPlaceholder: "#5b6478", colorDanger: "#fb7185", colorSuccess: "#a3e635", colorBorder: "#1c2540", borderWidth: "1px", borderRadius: "12px", fontFamily: '"IBM Plex Mono", ui-monospace, monospace', fontSizeBase: "15px", focusBoxShadow: "0 0 0 4px rgba(163, 230, 53, 0.2)", gridRowSpacing: "22px", }, rules: { ".Label": { color: "#8b93a7", fontSize: "13px", fontWeight: "500" }, ".Input": { backgroundColor: "#151d36", borderColor: "#151d36", padding: "15px 16px" }, ".Input:hover": { borderColor: "#2a3558" }, ".Input:focus": { borderColor: "#a3e635" }, ".Tab": { backgroundColor: "#151d36", borderColor: "#151d36" }, ".Tab:hover": { borderColor: "#2a3558" }, ".Tab--selected": { backgroundColor: "#18223f", borderColor: "#a3e635", color: "#a3e635" }, ".Button": { borderRadius: "999px", fontWeight: "600", padding: "15px 20px" }, ".Button:hover": { backgroundColor: "#bef264" }, ".Button:active": { backgroundColor: "#84cc16" }, ".Tag": { backgroundColor: "#18223f", color: "#a3e635", fontWeight: "600" }, ".Card": { backgroundColor: "#151d36", boxShadow: "0 8px 24px rgba(0, 0, 0, 0.4)" }, ".Switch--checked": { backgroundColor: "#a3e635" }, ".TextSecondary": { color: "#8b93a7" }, ".Amount--display": { color: "#a3e635" }, ".Overline": { color: "#a3e635", letterSpacing: "0.08em" }, }, fonts: [ { cssSrc: "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap" }, ], }; ``` ## Learning the API The `Appearance` type is the reference. Type `appearance={{` in your editor and use autocomplete and hover: every variable documents its default, and most selectors do too. For the full styling guide (fonts, payment fields, CSP) and upgrading from 1.x, see the Styling components and Migrating to 2.0 sections of the README in the installed package, `node_modules/@bunnyapp/components/README.md`. The README shown on npmjs.com is the 1.x one until 2.0.0 is released. The `bunny-components` [agent skill](https://docs.bunny.com/developer/bunny-components/bunny-components#using-with-an-ai-assistant) can write an `appearance` object for you. --- URL: https://docs.bunny.com/developer/bunny-components/checkout # Embed the Checkout component to let an existing Bunny account subscribe to a price list in one step, using a portal session token. `` lets an existing account subscribe to a price list. To sign up someone who has no account yet, use [Signup](https://docs.bunny.com/developer/bunny-components/signup). It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens) for the account. `` is new in version 2.0 of `@bunnyapp/components`. Until 2.0.0 is released, install the prerelease with `npm i @bunnyapp/components@beta`. ```tsx import { BunnyProvider, Checkout } from "@bunnyapp/components"; function App() { return ( console.log("Subscribed!") }} appearance={{ variables: { colorPrimary: "#14532d" } }} /> ); } ``` [image: Checkout component showing a Bunny Annual order summary with line items, a coupon link, tax and total beside an email, payment method, card details and country form with a Pay $250.00 button] ## Props - `priceListCode`: The code of the price list to subscribe to. - `enableTrial`: If the price list allows a trial, start the subscription as a trial. - `defaultCouponCode`: A coupon code to apply when the checkout opens. - `documentTemplateId`: A document template to render the quote with. When set, the quote PDF is shown under the summary. - `form`: Configures the form. - `defaultValues`: Values for the form fields (`email`, `firstName`, `lastName`, `accountName`, `billingCountry`, `billingState`, `billingCity`, `billingZip`, `billingStreet`, `taxNumber`). They are merged over the account’s own details. - `requiredBillingDetails`: The optional fields to show and require (`firstName`, `lastName`, `accountName`, `billingStreet`, `billingCity`, `billingState`, `billingZip`, `taxNumber`). Email is always shown. - `disabledFields`: Fields the customer cannot edit. Give each one a default value, because a required disabled field without a value blocks the checkout. - `callbacks.onPaymentSuccess`: Called when the subscription has been checked out, whether it was paid or free or a trial. - `preview`: Renders the checkout with working pricing and fields but never submits it, for example to preview it inside an admin screen. Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)) and `style` for positioning. ## Payment methods Checkout offers every payment method enabled in your Stripe account, including bank debits such as SEPA Direct Debit. A bank debit takes a few business days to settle: the subscription starts right away and the invoice shows as processing until the payment succeeds. [Signup](https://docs.bunny.com/developer/bunny-components/signup) accepts cards only. ## What happens on success The component shows a confirmation that includes the plan (or the start of the trial), the amount paid, the payment method and the next billing date, and says an invoice has been emailed. In Bunny, the account is subscribed to the price list and the invoice is created. --- URL: https://docs.bunny.com/developer/bunny-components/signup # If you have products or plans that you want anyone (outside your organization) to be able to sign up for, you can set up the Signup component on your website. Signup uses an API client token that only has the signup scopes, so it is safe to expose in a web page. ## Create an API client with limited scopes - Go to Settings > Developers > API clients in Bunny. - Create a new client and grant it only the `signup:read` and `signup:write` scopes. - Copy the client’s token and use it as the `token` of the `BunnyProvider`. For more detail, see [creating and managing API clients](https://docs.bunny.com/guide/tour/access-control/api-clients). ## Usage Give Signup its own `BunnyProvider`, separate from the one used by other components, because its token differs. ```tsx import { BunnyProvider, Signup } from "@bunnyapp/components"; function App() { return ( console.log("Signed up!") }} appearance={{ variables: { colorPrimary: "#14532d" } }} /> ); } ``` [image: Signup component showing a Bunny Annual price summary with line items and a coupon link beside an email, payment method, card details and country form with a Pay $200.00 button] ## Props Signup takes the same props as [Checkout](https://docs.bunny.com/developer/bunny-components/checkout#props), except `documentTemplateId`. Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)) and `style` for positioning. Signup always creates a new account. To subscribe an existing account, use [Checkout](https://docs.bunny.com/developer/bunny-components/checkout), available in the 2.0 prerelease. ## Payment methods Signup accepts cards only when an amount is due, including Link with a saved card or bank, and Apple Pay and Google Pay when they are enabled and your domain is registered with Stripe. Signup charges the first invoice and creates the account in one step, so it only takes payment methods that confirm immediately. Bank debits such as SEPA Direct Debit and ACH take several business days to settle, so Signup doesn’t offer them. To let customers pay by SEPA Direct Debit, have them sign up with a card and switch afterwards, or create the account yourself and use [Checkout](https://docs.bunny.com/developer/bunny-components/checkout), which offers every payment method enabled in your Stripe account. ## Using signup on your portal page Instead of embedding the Signup component and creating your own page, you can do this easily with the Bunny portal page. Refer to [these docs](https://docs.bunny.com/developer/customer-portal/account-signup). ## What happens after signup? A successful signup creates: - A Customer account. - A billing contact, containing the user’s name and email. - A tenant for the user’s data. - A subscription corresponding to the `priceListCode` you passed to the component. A payment method is stored only when an amount is due, so not for trials or 100%-discounted plans. If anything fails, nothing is created. [image: Customers > Accounts list in Bunny showing account type, paying status, MRR and created timestamp for each account] The accounts page in Bunny. New accounts from signups appear here. --- URL: https://docs.bunny.com/developer/bunny-components/billing-details # A component for updating account details, billing address and payment methods for an account. [image: BillingDetails component with a billing address, primary and secondary billing contacts and tax ID form on the left and a saved card beside a New card tile on the right] The billing details component ```tsx console.log(paymentMethodId)} onPaymentMethodRemoved={(paymentMethodId) => console.log(paymentMethodId)} /> ``` It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens). Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)) and `style` and `className` for positioning. ### hidePaymentMethodForm and hideBillingDetailsForm Hide the payment methods (right side) or the account and address form (left side). ### countryListFilter Return `false` to hide a country, identified by its two-letter code. This hides the United States and Canada: ```tsx const removedCountries = ["US", "CA"]; return ( !removedCountries.includes(country.value) } /> ) ``` ### onSavePaymentMethod and onPaymentMethodRemoved Called with the payment method’s ID when the customer saves or removes a payment method. --- URL: https://docs.bunny.com/developer/bunny-components/invoice # A component for viewing and paying invoices. [image: Invoice component showing a Paid invoice with a Download button, issue and paid dates, a line item, subtotal, taxes, total and tier pricing notes] The invoice component showing a paid invoice. [image: Not due invoice with a Download button, two line items and totals, and beside it a selected saved card, a New card tile and an orange Pay $247.40 button] An unpaid invoice. The customer can add or remove payment methods to pay it. ```tsx console.log("Paid")} /> ``` It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens). Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)) and `style` and `className` for positioning. ### Props - `id`: The invoice to show. - `onPaymentSuccess`: Called when the customer has paid the invoice. ### hidePaymentForm and hideDownloadButton Hide the payment form, or the button that downloads the invoice. --- URL: https://docs.bunny.com/developer/bunny-components/invoices # Embed the Invoices component to show an account's invoices in a searchable list, where each invoice opens to be viewed, downloaded and paid. [image: Invoices component titled Past invoices with a Search by amount box, listing five invoices for Contoso Ltd: I-1042 for $1,250.00 Not due, and four Paid invoices from Aug to Oct 2026] The invoices component. ```tsx ``` It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens), and shows that account’s invoices. Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)). Clicking an invoice opens it in a drawer as an [``](https://docs.bunny.com/developer/bunny-components/invoice), where the customer can download and pay it. Long lists are split into pages. ### filter and sort Server-side [query filters](https://docs.bunny.com/developer/using-the-graphql-api/using-filters-in-queries) and sort clauses, for example `filter="invoice.amount is 100"` or `sort="createdAt DESC"`. When you pass a `filter`, the search box is hidden unless you turn it on with `displayOptions.showSearchBar`. ### displayOptions | Option | Default | | | title | "Past invoices" | The title above the list | | showTitle | true | Show the title | | showSearchBar | true, or false with a filter | Show the Search by amount box | | columns | ["date", "title", "state", "amount", "download"] | The columns to show, in order. accountName is also available. | | useModal | false | Open invoices in a modal instead of a drawer | | emptyMessage | "There are no invoices" | Shown when there are none | | className, style, searchBarClassName | | Positioning | ### behaviorOptions | Option | Default | | | invoiceDateType | "createdAt" | The date shown in the date column: createdAt, issuedAt or dueAt | | hidePaymentForm | false | Hide the payment form on opened invoices | | suppressDetail | false | Don’t open invoices on click. Use with onInvoiceClick to handle the click yourself. | | rowsPerPage | Fits the screen | Invoices per page, from 1 to 100 | ### onInvoiceClick and invoiceComponent `onInvoiceClick` is called with the invoice when the customer clicks it. `invoiceComponent` replaces the `` shown in the drawer with your own content. --- URL: https://docs.bunny.com/developer/bunny-components/subscriptions # Embed the Subscriptions component to let customers view their subscriptions, change plan or quantities, upgrade from a trial and cancel. [image: Subscriptions component for Superdesk: an active Small subscription renewing Nov 30, 2026 with Cancel subscription and Change plan, its Onboarding add-on with Adjust plan, and a Large trial with 9 days left, one user at $20.00, and Upgrade from trial] The subscriptions component, with an add-on and a trial. ```tsx console.log(subscriptionId)} /> ``` It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens). Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)) and `style` and `className` for positioning. ### What customers can do Each subscription shows its charges for the current period. The actions follow your settings in Bunny: | Action | Shown when | | Change plan (Upgrade from trial on a trial, Upgrade on an expired trial, Adjust plan on an add-on) | Another plan of the same product has Self-service buy turned on. See Plans. | | Cancel subscription | The plan has Self-service cancel turned on, and the subscription is active, pending or in trial. | | Change quantities | A charge on an active or pending subscription has Customers can change the quantity themselves turned on. See Self-service quantity. Flat, usage and one-time charges can’t be changed. | | Show inactive | The account has canceled or expired subscriptions. | Change plan opens the plan picker in place of the list. The customer picks a plan and billing period, can add add-ons, and pays for the change. [image: Plan picker after Change plan, with Small at $10 per user per month marked Current plan, and Free plan, Medium at $20 and Large at $40 offered with Change to, add-on toggles and a feature comparison table] The plan picker that opens from Change plan. ### companyName Required. Your company name, shown when the customer has no subscriptions: “You have no subscriptions with Superdesk yet”. Pass `noSubscriptionsComponent` to show your own content instead. ### showInactiveSubscriptions and showInactiveSubscriptionsToggle `showInactiveSubscriptions` shows canceled and expired subscriptions from the start. `showInactiveSubscriptionsToggle={false}` hides the Show inactive checkbox. ### onSubscriptionUpgradeClick Called with the subscription’s ID when the customer clicks Change plan, Upgrade from trial or Adjust plan, before the plan picker opens. ### onPaymentMethodSaved and onPaymentMethodRemoved Called with the payment method’s ID when the customer saves or removes a payment method while changing plan. ## `` is the plan picker on its own, for one subscription. Use it to open plan changes from your own button instead of from ``. ```tsx setShowUpgrade(false)} /> ``` - `upgradingSubscriptionId`: The subscription to change. - `defaultBillingPeriod`: The billing period selected when the picker opens: `MONTHLY`, `QUARTERLY`, `SEMI_ANNUAL`, `ANNUAL` or `ONCE`. - `onChangePlanCancel`: Called when the customer clicks back. --- URL: https://docs.bunny.com/developer/bunny-components/quote # Embed the Quote component to show one quote that the customer can read, download and accept, or pay and sign. [image: Quote component showing quote Q-312 from Superdesk to Contoso Ltd, attention Meg Ledon, for 25 Superdesk Medium users at $20.00 from Dec 1 to Dec 31, 2026, totaling $500.00, with Download and Accept quote buttons] The quote component. ```tsx console.log("Accepted")} /> ``` It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens) for the quote’s account. Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)) and `style` and `className` for positioning. Accept quote asks the customer for their name and job title, a purchase order number, and a tax number where one is needed. If you’ve connected an e-signature integration, the dialog starts signing instead. If the quote requires payment to accept, the button says Pay and sign, and the customer approves a hold for the first invoice’s amount before signing. ### Props - `id`: The quote to show. - `onQuoteAccepted`: Called when the customer has accepted the quote. - `onPaymentSuccess`: Called when the customer’s payment succeeds on a quote that requires payment to accept. - `onQuoteLoaded`: Called with the quote once it has loaded. ### hideDownloadButton Hide the Download button. ### onQuoteUnavailableError and suppressQuoteUnavailableErrorNotification `onQuoteUnavailableError` is called when Bunny reports that the quote is unavailable, and the component shows an error notification. Set `suppressQuoteUnavailableErrorNotification` to show your own message instead. --- URL: https://docs.bunny.com/developer/bunny-components/quotes # Embed the Quotes component to show the quotes shared with an account, where each quote opens to be read, downloaded and accepted. [image: Quotes component titled Past quotes with a Search by quote id box, listing Q-312 for $1,950.00 Shared and two Accepted quotes for Contoso Ltd] The quotes component. ```tsx console.log(quote.id)} /> ``` It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens), and shows the quotes you’ve shared with that account. Draft quotes aren’t listed. Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)). Clicking a quote opens it in a drawer as a [``](https://docs.bunny.com/developer/bunny-components/quote), where the customer can download and accept it. ### Options `` takes the same `filter`, `sort`, `displayOptions` and `behaviorOptions` as [``](https://docs.bunny.com/developer/bunny-components/invoices), with these differences: - `displayOptions.title` defaults to `"Past quotes"` and `emptyMessage` to `"There are no quotes"`. The search box searches by quote ID. - `columns` defaults to `["date", "title", "amount", "download", "state"]`. - There’s no date type or `hidePaymentForm` option. - `onQuoteClick` replaces `onInvoiceClick`, and `renderQuote` replaces `invoiceComponent`. `renderQuote` is a function that receives the quote and returns what to show in the drawer. - Filters use `quote`, for example `filter="quote.amount is 100"`. --- URL: https://docs.bunny.com/developer/bunny-components/transactions # Embed the Transactions component to show an account's invoices, payments and refunds in one searchable list. [image: Transactions component titled Past transactions listing Contoso Ltd's invoices, payments and a refund from Sep to Nov 2026, with states Not due, Paid and Applied] The transactions component, with invoices, payments and a refund. ```tsx ``` It needs a [portal session token](https://docs.bunny.com/developer/bunny-components/installation#tokens), and shows that account’s transactions: invoices, payments, and refunds and write-offs from credit notes. Payments and refunds show as positive amounts. Like every component, it also accepts `appearance` ([Styling](https://docs.bunny.com/developer/bunny-components/styling)). Clicking an invoice opens it in a drawer, where the customer can download and pay it. Clicking a payment or refund shows its amount, description, kind and state. ### Options `` takes the same props as [``](https://docs.bunny.com/developer/bunny-components/invoices), with these differences: - `displayOptions.title` defaults to `"Past transactions"` and `emptyMessage` to `"There are no transactions"`. - `behaviorOptions.transactionDateType` replaces `invoiceDateType`. Payments always show the date they were created. - `onTransactionClick` and `transactionComponent` replace `onInvoiceClick` and `invoiceComponent`. - Filters use `transaction`, for example `filter="transaction.amount is 100"`. --- URL: https://docs.bunny.com/developer/customer-portal/enable-upgrades-and-payments # Portal overview The Bunny customer portal lets customers view quotes, pay invoices and manage subscriptions, as a popup in your app or a standalone link. The customer portal is Bunny’s default interface for customers to view quotes, pay invoices, update payment methods and manage their subscriptions. The customer portal is built using the Bunny Components, which you can also embed directly in your own application. Customers typically get access to the portal by clicking on an invoice link or similar in an email from Bunny or you can link directly to the portal using a token. There are two different ways of using the portal. To compare them with Bunny Components and the hosted Signup and Checkout pages, see [Choose a self-service approach](https://docs.bunny.com/developer/self-service). ### Popup portal For a more integrated experience you can use our embedded portal which means that the Bunny portal interface will be displayed as a popup within your application where the user can upgrade and pay for their subscription. [Learn how to integrate the popup portal](https://docs.bunny.com/developer/customer-portal/popup-customer-portal) ### Standalone portal The most simple approach is to the standalone customer portal. With this you will add a link to your app that goes to the customer portal. The user will be redirected to the portal and will be able to manage and pay for their subscription. [Learn how to integrate the standalone portal](https://docs.bunny.com/developer/customer-portal/standalone-customer-portal) --- URL: https://docs.bunny.com/developer/customer-portal/popup-customer-portal # Popup customer portal Embed the Bunny customer portal as a popup in your app: generate a portal token with portalSessionCreate, add bunny.js and open it from a button. This guide covers the customer portal integration from a developers point of view. It assumes that you have already setup your Products in Bunny and enabled them to be visible for self service. This integration involves adding a Bunny hosted javascript SDK to your application and calling methods on the SDK to popup the subscription management and payment options. [image: Customer portal popup over a SaaS app showing the Subscriptions table with a trial plan and an Upgrade button] Customer portal popup ### Overview There are 2 steps in this integration. - From your applications backend, generate an token via the Bunny API. This token will be required in step 2 to authenticate access to the portal. - Add the `bunny.js` script to your application then use a link on your page to popup the portal. ### 1. Setup API credentials We recommend setting up a new API client specifically for customer portal access. [You can learn how to setup an API client here](https://docs.bunny.com/developer/using-the-graphql-api/api). The API client will need the portal:write scope. `security:write` also works, but it lets the client manage your users and roles as well, so prefer `portal:write`. Use the API client to [generate a new access token](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests) with the `portal:write` scope. ### Request a portal token Make a request from your backend to obtain the portal security token using the [portalSessionCreate](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate) graphql request. **GraphQL** Attributes ```json { "tenantCode": "superdesk-123", "expiry": 123 // optional - default 24 hours } ``` Mutation ```graphql mutation portalSessionCreate ($tenantCode: String!, $expiry: Int) { portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry) { errors token } } ``` **Node.js** ```javascript res = await bunny.portalSessionCreate("superdesk-123"); ``` **Ruby** ```ruby res = BunnyApp::PortalSession.create( tenant_code: 'superdesk-123' ) ``` On success the response will contain a token attribute. You need to extract this token and use it in the next step. ```json { "data": { "portalSessionCreate": { "errors": null, "token": "eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2ODE4MzY4NDUsImlzcyI6Imh0dHBzOi8vYnVubnkuYnVubnkuY29tIiwiYXVkIjoicG9ydGFsIiwiaWF0IjoxNjgxNzUwNDQ1LCJzdWJkb21haW4iOiJidW5ueSIsInVpZCI6NDA1LCJ1aWRfdHlwZSI6IlRlbmFudCIsInJlYWNoX2lkIjo1NDAsInJlYWNoX3R5cGUiOiJBY2NvdW50Iiwic2NvcGUiOiJwcm9kdWN0OnJlYWQgYmlsbGluZzpyZWFkIHN0YW5kYXJkOndyaXRlIHN0YW5kYXJkOnJlYWQiLCJvYmplY3RfaWQiOjQwNSwib2JqZWN0X3R5cGUiOiJUZW5hbnQifQ.78epnLpeJBs2UX1SrjxYdkKkEL_x4iy_AlAo6LuxQQkA7O5jvgEA00X3Zh9Z-MdLoBhGtSrK3Kv-Gb2lOAb3tQ" } } } ``` ### 2. Include the bunny.js script ``` https://cdn.bunny.com/v1/bunny.js ``` Include the Bunny script in the `` section of your application using the subdomain of your Bunny account. ```html ``` Now initialize the script by passing the portal token from step 1 into the Bunny SDK. ```html ``` Finally add a button or a link to your site for upgrading or managing a subscription with a click handler that we will use to popup the portal. ```html ``` ### Controlling the display You can popup different screens by setting a page argument in the `popup` method. ```javascript // subscriptions - The default view bunny.popup({ page: "subscriptions" }); // transactions - Shows the transactions & payments made by the customer bunny.popup({ page: "transactions" }); // payment-method - Shows the current store payment method by the customer bunny.popup({ page: "payment-method" }); ``` --- URL: https://docs.bunny.com/developer/customer-portal/standalone-customer-portal # Standalone customer portal Learn how link the Bunny customer portal with your platform to enable self service subscription management and upgrades. This guide covers the customer portal integration from a developers point of view. It assumes that you have already setup your Products in Bunny and enabled them to be visible for self service. TLDR… This integration involves using the API to generate a token that will be appended to a customer portal url that you will redirect the user over to for subscription management. ### Setup API credentials Make a request from your backend to obtain the portal security token using the [portalSessionCreate](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate) graphql request. The API client will need the portal:write scope. `security:write` also works, but it lets the client manage your users and roles as well, so prefer `portal:write`. Use the API client to [generate a new access token](https://docs.bunny.com/developer/using-the-graphql-api/authorizing-api-requests) with the `portal:write` scope. ### Request a portal token The portal token is obtained using the [portalSessionCreate](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate) graphql request. **GraphQL** Attributes ```json { "tenantCode": "superdesk-123", "expiry": 123 // optional - default 24 hours } ``` Mutation ```graphql mutation portalSessionCreate ($tenantCode: String!, $expiry: Int) { portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry) { errors token } } ``` **Node.js** ```javascript res = await bunny.portalSessionCreate("superdesk-123"); ``` **Ruby** ```ruby res = BunnyApp::PortalSession.create( tenant_code: 'superdesk-123' ) ``` On success the response will contain a token attribute. You need to extract this token and use it in the next step. ```json { "data": { "portalSessionCreate": { "errors": null, "token": "eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2ODE4MzY4NDUsImlzcyI6Imh0dHBzOi8vYnVubnkuYnVubnkuY29tIiwiYXVkIjoicG9ydGFsIiwiaWF0IjoxNjgxNzUwNDQ1LCJzdWJkb21haW4iOiJidW5ueSIsInVpZCI6NDA1LCJ1aWRfdHlwZSI6IlRlbmFudCIsInJlYWNoX2lkIjo1NDAsInJlYWNoX3R5cGUiOiJBY2NvdW50Iiwic2NvcGUiOiJwcm9kdWN0OnJlYWQgYmlsbGluZzpyZWFkIHN0YW5kYXJkOndyaXRlIHN0YW5kYXJkOnJlYWQiLCJvYmplY3RfaWQiOjQwNSwib2JqZWN0X3R5cGUiOiJUZW5hbnQifQ.78epnLpeJBs2UX1SrjxYdkKkEL_x4iy_AlAo6LuxQQkA7O5jvgEA00X3Zh9Z-MdLoBhGtSrK3Kv-Gb2lOAb3tQ" } } } ``` ### Redirect to the customer portal The final step is to redirect the browser to the customer portal by appending the token to the base url for your customer portal. ``` https://{{subdomain}}.bunny.com/portal?token={{token}} ``` You can also redirect to specific pages within the customer portal by including the path to that page. ``` // subscriptions https://{{subdomain}}.bunny.com/portal/subscriptions?token={{token}} // transactions https://{{subdomain}}.bunny.com/portal/transactions?token={{token}} // payment methods https://{{subdomain}}.bunny.com/portal/payment-method?token={{token}} ``` --- URL: https://docs.bunny.com/developer/customer-portal/account-signup # Signup page If you have products or plans that you want anyone (outside your organization) to be able to sign up for, you can set up a Signup page on the Bunny Portal. Important: As a prerequisite to this page, please read the [signup docs here](https://docs.bunny.com/developer/bunny-components/signup). ## Construct the signup page URL ``` https://[SUBDOMAIN].bunny.com/portal/signup ?priceListCode=[PRICE_LIST_CODE] &token=[TOKEN] &couponCode=[COUPON_CODE] &firstName=[FIRST_NAME] &lastName=[LAST_NAME] &email=[EMAIL] &companyName=[COMPANY_NAME] &billingCountry=[BILLING_COUNTRY] ``` - `[SUBDOMAIN]`: Your Bunny account subdomain (e.g., `acme` if you access Bunny via `https://acme.bunny.com`). - `[PRICE_LIST_CODE]`: The code for the price list you want customers to sign up for. - `[TOKEN]` The token from the API client you created with `signup:read` and `signup:write` scopes. - `[COUPON_CODE]` The default coupon code (if valid) be automatically applied. - `[FIRST_NAME]` , `[LAST_NAME]` etc are optional default values that will be inserted into the signup fields. Example Suppose you have the following: - SUBDOMAIN: `acme` - PRICE_LIST_CODE: `business-annual` - TOKEN: `12345` Then your signup page link would look like this: ``` https://acme.bunny.com/portal/signup?priceListCode=business-annual&token=12345 ``` When a user clicks this link, they will be taken to the Bunny portal’s signup page: [image: Bunny portal Signup page showing a Bunny Annual price summary beside an email, payment method, card details and country form with a Pay $200.00 button] ## Payment methods The signup page accepts cards only when an amount is due (including Link), because it charges the first invoice and creates the account in one step. Bank debits such as SEPA Direct Debit and ACH settle over several business days, so they aren’t offered at signup. Customers who want to pay by SEPA Direct Debit can sign up with a card and switch afterwards, or you can create their account and use [Checkout](https://docs.bunny.com/developer/bunny-components/checkout), which offers every payment method enabled in your Stripe account. --- URL: https://docs.bunny.com/developer/customer-portal/checkout-page # Checkout page Send an existing customer to a Bunny-hosted checkout page for one price list, using a portal session token created on your server. The checkout page lets an existing customer subscribe to a price list without you building any UI. It is the hosted version of the [Checkout component](https://docs.bunny.com/developer/bunny-components/checkout). To sign up someone who has no account yet, use the [Signup page](https://docs.bunny.com/developer/customer-portal/account-signup). Important: The link needs a portal session token for the customer’s tenant. Read [Portal session token](https://docs.bunny.com/developer/portal-session-token) first. ## Construct the checkout page URL ``` https://[SUBDOMAIN].bunny.com/portal/checkout ?priceListCode=[PRICE_LIST_CODE] &token=[TOKEN] &couponCode=[COUPON_CODE] ``` - `[SUBDOMAIN]`: Your Bunny account subdomain (e.g., `acme` if you access Bunny via `https://acme.bunny.com`). - `[PRICE_LIST_CODE]`: The code for the price list the customer subscribes to. - `[TOKEN]`: A portal session token for the customer’s tenant, created on your server with [`portalSessionCreate`](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate). It expires after `expiry` hours (default and maximum 24), so create it when the customer clicks through rather than storing the link. - `[COUPON_CODE]` (optional): A coupon code applied automatically, if valid. The page fills in the billing details from the customer’s account, so there are no default-value parameters as on the signup page. Example Suppose you have the following: - SUBDOMAIN: `acme` - PRICE_LIST_CODE: `business-annual` - TOKEN: `12345` (from `portalSessionCreate` for the customer’s tenant) Then the checkout page link would look like this: ``` https://acme.bunny.com/portal/checkout?priceListCode=business-annual&token=12345 ``` You can copy this link with a `TOKEN` placeholder from the plan’s Buy links tab in Bunny: choose Existing customer · checkout link and a price list, then replace `TOKEN` with the token from your server. --- URL: https://docs.bunny.com/developer/sample-saas-app/the-sample-saas-app # See how it’s done To demonstrate integrating your SaaS application with Bunny, we provide a sample SaaS application written in Node.js and React. This page covers installation and configuration. The Sample SaaS app is a small to-do app that shows these integration points: - Creating an account, contact, tenant and trial subscription in Bunny when someone signs up for your app, with [subscriptionCreate](https://docs.bunny.com/developer/bunny-sdk/create-a-subscription). - Opening the Bunny customer portal for the signed-in customer with a [portal session token](https://docs.bunny.com/developer/portal-session-token). - Showing the customer’s invoices and payments with the `Transactions` [Bunny component](https://docs.bunny.com/developer/bunny-components/bunny-components). - Receiving and verifying [webhooks](https://docs.bunny.com/developer/webhooks/webhook-security) from Bunny. The code for the [Sample SaaS app can be found on GitHub](https://github.com/bunnyapp/sample-saas). Its README is the reference for the latest setup steps. ## Setting it up ### Configure Bunny - Create a product with a plan and a price list that allows a trial. Note the price list’s code, for example `notes_monthly`. Every signup in the app creates a trial subscription on this price list. - Go to Settings > Developers > API clients and create an API client with the `standard:read`, `standard:write` and `portal:write` scopes. Click Generate access token and copy the token. - Go to Settings > Company > Security and add `localhost` to Whitelisted origin domains, so the app can load Bunny components. ### Receive webhooks (optional) To see Bunny’s webhooks arrive in the app, Bunny must be able to reach it. Expose the app’s server with [ngrok](https://ngrok.com/download) or similar: `ngrok http 3051` Then go to Settings > Developers > Platforms, open your platform, turn on Provisioning enabled, set the webhook URL to `https:///api/hook`, and choose a Webhook signing key. The app records each webhook it receives in its events sidebar. ### Install and run the app The app needs Node.js 14 or later. - Clone the repository: `git clone git@github.com:bunnyapp/sample-saas.git` - Install the server and client dependencies: `npm install && npm run client-install` - Copy `.env.sample` to `.env` in the repository root and set: - `BUNNY_BASE_URL`: `https://.bunny.com` - `BUNNY_ACCESS_TOKEN`: the access token you generated - `BUNNY_PRICE_LIST_CODE`: your price list’s code - `BUNNY_WEBHOOK_SECRET`: the platform’s webhook signing key, if you set up webhooks - `CORS_ORIGIN`: `http://localhost:3000` - Create a `.env` file in the `client` folder and set: - `REACT_APP_API_URL`: `http://localhost:3051` - `REACT_APP_BUNNY_SUBDOMAIN`: your Bunny subdomain - `REACT_APP_BUNNY_API_HOST`: `https://.bunny.com` - Start the server and the client together: `npm run dev-full` You’re all set! Open [http://localhost:3000](http://localhost:3000/) and register. The new account, contact and trial subscription appear in Bunny under Customers > Accounts. --- URL: https://docs.bunny.com/developer/api-reference # GraphQL API reference: every operation Each link has the operation's arguments, return type and an example request. The MCP server at https://docs.bunny.com/mcp returns the same through `get_api_reference`, and https://docs.bunny.com/developer/api-reference/api-reference.json has every operation and type as JSON. ## Queries - [account](https://docs.bunny.com/developer/api-reference/queries/account). - [accountActivity](https://docs.bunny.com/developer/api-reference/queries/accountactivity): One page of activity cards, newest first. Scope: standard:read. - [accountActivityChain](https://docs.bunny.com/developer/api-reference/queries/accountactivitychain): The events of one request that belong to the account, oldest first. - [accountActivityTriggeredEvents](https://docs.bunny.com/developer/api-reference/queries/accountactivitytriggeredevents): More of the events one action caused on an account, oldest first. - [accountBalance](https://docs.bunny.com/developer/api-reference/queries/accountbalance). - [accountBalances](https://docs.bunny.com/developer/api-reference/queries/accountbalances). - [accountingTable](https://docs.bunny.com/developer/api-reference/queries/accountingtable). Scope: standard:read. - [accounts](https://docs.bunny.com/developer/api-reference/queries/accounts). - [accountType](https://docs.bunny.com/developer/api-reference/queries/accounttype). - [accountTypes](https://docs.bunny.com/developer/api-reference/queries/accounttypes). - [aiAgentAudit](https://docs.bunny.com/developer/api-reference/queries/aiagentaudit). - [aiAgentAudits](https://docs.bunny.com/developer/api-reference/queries/aiagentaudits). - [aiAgentChart](https://docs.bunny.com/developer/api-reference/queries/aiagentchart). Scope: standard:read. - [analyticsChartData](https://docs.bunny.com/developer/api-reference/queries/analyticschartdata). Scope: standard:read. - [analyticsDrilldownData](https://docs.bunny.com/developer/api-reference/queries/analyticsdrilldowndata). Scope: standard:read. - [apiClient](https://docs.bunny.com/developer/api-reference/queries/apiclient). - [apiClients](https://docs.bunny.com/developer/api-reference/queries/apiclients). - [approvalRule](https://docs.bunny.com/developer/api-reference/queries/approvalrule). - [approvalRules](https://docs.bunny.com/developer/api-reference/queries/approvalrules). - [approver](https://docs.bunny.com/developer/api-reference/queries/approver). - [approvers](https://docs.bunny.com/developer/api-reference/queries/approvers). - [bankAccount](https://docs.bunny.com/developer/api-reference/queries/bankaccount). - [bankAccounts](https://docs.bunny.com/developer/api-reference/queries/bankaccounts). - [bankConnection](https://docs.bunny.com/developer/api-reference/queries/bankconnection). - [bankConnections](https://docs.bunny.com/developer/api-reference/queries/bankconnections). - [bankTransaction](https://docs.bunny.com/developer/api-reference/queries/banktransaction). - [bankTransactionImport](https://docs.bunny.com/developer/api-reference/queries/banktransactionimport). - [bankTransactionImports](https://docs.bunny.com/developer/api-reference/queries/banktransactionimports). - [bankTransactions](https://docs.bunny.com/developer/api-reference/queries/banktransactions). - [bankTransactionSuggestion](https://docs.bunny.com/developer/api-reference/queries/banktransactionsuggestion). - [bankTransactionSuggestions](https://docs.bunny.com/developer/api-reference/queries/banktransactionsuggestions). - [billingDetails](https://docs.bunny.com/developer/api-reference/queries/billingdetails): Billing details for an account. Scope: portal:read. - [billRun](https://docs.bunny.com/developer/api-reference/queries/billrun). - [billRuns](https://docs.bunny.com/developer/api-reference/queries/billruns). - [bunnyUpdate](https://docs.bunny.com/developer/api-reference/queries/bunnyupdate). - [bunnyUpdates](https://docs.bunny.com/developer/api-reference/queries/bunnyupdates). - [campaign](https://docs.bunny.com/developer/api-reference/queries/campaign). - [campaigns](https://docs.bunny.com/developer/api-reference/queries/campaigns). - [chat](https://docs.bunny.com/developer/api-reference/queries/chat). - [chats](https://docs.bunny.com/developer/api-reference/queries/chats). - [company](https://docs.bunny.com/developer/api-reference/queries/company). Scope: admin:read. - [contact](https://docs.bunny.com/developer/api-reference/queries/contact). - [contacts](https://docs.bunny.com/developer/api-reference/queries/contacts). - [coupon](https://docs.bunny.com/developer/api-reference/queries/coupon). - [coupons](https://docs.bunny.com/developer/api-reference/queries/coupons). - [creditBalance](https://docs.bunny.com/developer/api-reference/queries/creditbalance). - [creditBalances](https://docs.bunny.com/developer/api-reference/queries/creditbalances). - [creditGrant](https://docs.bunny.com/developer/api-reference/queries/creditgrant). - [creditGrants](https://docs.bunny.com/developer/api-reference/queries/creditgrants). - [creditLedgerEntries](https://docs.bunny.com/developer/api-reference/queries/creditledgerentries). - [creditNote](https://docs.bunny.com/developer/api-reference/queries/creditnote). - [creditNoteItem](https://docs.bunny.com/developer/api-reference/queries/creditnoteitem). - [creditNoteItems](https://docs.bunny.com/developer/api-reference/queries/creditnoteitems). - [creditNotes](https://docs.bunny.com/developer/api-reference/queries/creditnotes). - [currencies](https://docs.bunny.com/developer/api-reference/queries/currencies). - [currency](https://docs.bunny.com/developer/api-reference/queries/currency). Scope: billing:read. - [currentUser](https://docs.bunny.com/developer/api-reference/queries/currentuser). Scope: standard:read. - [customField](https://docs.bunny.com/developer/api-reference/queries/customfield). - [customFields](https://docs.bunny.com/developer/api-reference/queries/customfields). - [deal](https://docs.bunny.com/developer/api-reference/queries/deal). - [deals](https://docs.bunny.com/developer/api-reference/queries/deals). - [dealStage](https://docs.bunny.com/developer/api-reference/queries/dealstage). - [dealStages](https://docs.bunny.com/developer/api-reference/queries/dealstages). - [deepEvents](https://docs.bunny.com/developer/api-reference/queries/deepevents). - [dispute](https://docs.bunny.com/developer/api-reference/queries/dispute). - [disputeReason](https://docs.bunny.com/developer/api-reference/queries/disputereason). - [disputeReasons](https://docs.bunny.com/developer/api-reference/queries/disputereasons). - [disputes](https://docs.bunny.com/developer/api-reference/queries/disputes). - [documentTemplate](https://docs.bunny.com/developer/api-reference/queries/documenttemplate). - [documentTemplateComponent](https://docs.bunny.com/developer/api-reference/queries/documenttemplatecomponent). - [documentTemplateComponents](https://docs.bunny.com/developer/api-reference/queries/documenttemplatecomponents). - [documentTemplatePreview](https://docs.bunny.com/developer/api-reference/queries/documenttemplatepreview). Scope: billing:read. - [documentTemplates](https://docs.bunny.com/developer/api-reference/queries/documenttemplates). - [draftCreditNotes](https://docs.bunny.com/developer/api-reference/queries/draftcreditnotes). - [draftInvoices](https://docs.bunny.com/developer/api-reference/queries/draftinvoices). - [email](https://docs.bunny.com/developer/api-reference/queries/email). - [emails](https://docs.bunny.com/developer/api-reference/queries/emails). - [enabledOnlyForUsers](https://docs.bunny.com/developer/api-reference/queries/enabledonlyforusers). - [entities](https://docs.bunny.com/developer/api-reference/queries/entities). - [entity](https://docs.bunny.com/developer/api-reference/queries/entity). - [entityBranding](https://docs.bunny.com/developer/api-reference/queries/entitybranding). Scope: standard:read. - [event](https://docs.bunny.com/developer/api-reference/queries/event). - [eventDetails](https://docs.bunny.com/developer/api-reference/queries/eventdetails). - [events](https://docs.bunny.com/developer/api-reference/queries/events). - [exceptionEvent](https://docs.bunny.com/developer/api-reference/queries/exceptionevent). - [exceptionEvents](https://docs.bunny.com/developer/api-reference/queries/exceptionevents). - [externalUser](https://docs.bunny.com/developer/api-reference/queries/externaluser). - [externalUsers](https://docs.bunny.com/developer/api-reference/queries/externalusers). - [feature](https://docs.bunny.com/developer/api-reference/queries/feature). - [features](https://docs.bunny.com/developer/api-reference/queries/features). - [featureUsage](https://docs.bunny.com/developer/api-reference/queries/featureusage). - [featureUsageHistogram](https://docs.bunny.com/developer/api-reference/queries/featureusagehistogram). - [featureUsages](https://docs.bunny.com/developer/api-reference/queries/featureusages). - [field](https://docs.bunny.com/developer/api-reference/queries/field). - [fields](https://docs.bunny.com/developer/api-reference/queries/fields). - [financialAccount](https://docs.bunny.com/developer/api-reference/queries/financialaccount). - [financialAccounts](https://docs.bunny.com/developer/api-reference/queries/financialaccounts). - [formattedCreditNote](https://docs.bunny.com/developer/api-reference/queries/formattedcreditnote). Scope: billing:read. - [formattedInvoice](https://docs.bunny.com/developer/api-reference/queries/formattedinvoice). Scope: billing:read. - [formattedQuote](https://docs.bunny.com/developer/api-reference/queries/formattedquote). Scope: standard:read quoting:read. - [globalOauthConnection](https://docs.bunny.com/developer/api-reference/queries/globaloauthconnection). - [globalOauthConnections](https://docs.bunny.com/developer/api-reference/queries/globaloauthconnections). - [group](https://docs.bunny.com/developer/api-reference/queries/group). - [groups](https://docs.bunny.com/developer/api-reference/queries/groups). - [industries](https://docs.bunny.com/developer/api-reference/queries/industries). - [industry](https://docs.bunny.com/developer/api-reference/queries/industry). - [intracomVats](https://docs.bunny.com/developer/api-reference/queries/intracomvats). - [invoice](https://docs.bunny.com/developer/api-reference/queries/invoice). - [invoiceForecast](https://docs.bunny.com/developer/api-reference/queries/invoiceforecast). - [invoiceForecasts](https://docs.bunny.com/developer/api-reference/queries/invoiceforecasts). - [invoiceItem](https://docs.bunny.com/developer/api-reference/queries/invoiceitem). - [invoiceItems](https://docs.bunny.com/developer/api-reference/queries/invoiceitems). - [invoices](https://docs.bunny.com/developer/api-reference/queries/invoices). - [invoiceTemplate](https://docs.bunny.com/developer/api-reference/queries/invoicetemplate). - [invoiceTemplates](https://docs.bunny.com/developer/api-reference/queries/invoicetemplates). - [isolateTos](https://docs.bunny.com/developer/api-reference/queries/isolatetos). - [job](https://docs.bunny.com/developer/api-reference/queries/job). - [jobs](https://docs.bunny.com/developer/api-reference/queries/jobs). - [journalEntries](https://docs.bunny.com/developer/api-reference/queries/journalentries). - [journalEntry](https://docs.bunny.com/developer/api-reference/queries/journalentry). - [journalEntryLine](https://docs.bunny.com/developer/api-reference/queries/journalentryline). - [journalEntryLines](https://docs.bunny.com/developer/api-reference/queries/journalentrylines). - [launchpad](https://docs.bunny.com/developer/api-reference/queries/launchpad): Launchpad metrics for revenue tracking. Scope: standard:read. - [lead](https://docs.bunny.com/developer/api-reference/queries/lead). - [leads](https://docs.bunny.com/developer/api-reference/queries/leads). - [leadSource](https://docs.bunny.com/developer/api-reference/queries/leadsource). - [leadSources](https://docs.bunny.com/developer/api-reference/queries/leadsources). - [leadStatus](https://docs.bunny.com/developer/api-reference/queries/leadstatus). - [leadStatuses](https://docs.bunny.com/developer/api-reference/queries/leadstatuses). - [message](https://docs.bunny.com/developer/api-reference/queries/message). - [monthlyReport](https://docs.bunny.com/developer/api-reference/queries/monthlyreport). Scope: standard:read. - [notification](https://docs.bunny.com/developer/api-reference/queries/notification). - [notifications](https://docs.bunny.com/developer/api-reference/queries/notifications). - [owners](https://docs.bunny.com/developer/api-reference/queries/owners). - [payment](https://docs.bunny.com/developer/api-reference/queries/payment). - [paymentApplication](https://docs.bunny.com/developer/api-reference/queries/paymentapplication). - [paymentApplications](https://docs.bunny.com/developer/api-reference/queries/paymentapplications). - [paymentMethods](https://docs.bunny.com/developer/api-reference/queries/paymentmethods). - [paymentPlugins](https://docs.bunny.com/developer/api-reference/queries/paymentplugins). - [payments](https://docs.bunny.com/developer/api-reference/queries/payments). - [period](https://docs.bunny.com/developer/api-reference/queries/period). - [periods](https://docs.bunny.com/developer/api-reference/queries/periods). - [plan](https://docs.bunny.com/developer/api-reference/queries/plan). - [planChangeOptions](https://docs.bunny.com/developer/api-reference/queries/planchangeoptions). - [planFeature](https://docs.bunny.com/developer/api-reference/queries/planfeature). - [planFeatures](https://docs.bunny.com/developer/api-reference/queries/planfeatures). - [plans](https://docs.bunny.com/developer/api-reference/queries/plans). - [platform](https://docs.bunny.com/developer/api-reference/queries/platform). - [platforms](https://docs.bunny.com/developer/api-reference/queries/platforms). - [plugin](https://docs.bunny.com/developer/api-reference/queries/plugin). - [pluginDefinition](https://docs.bunny.com/developer/api-reference/queries/plugindefinition). - [pluginDefinitions](https://docs.bunny.com/developer/api-reference/queries/plugindefinitions). - [pluginEntities](https://docs.bunny.com/developer/api-reference/queries/pluginentities). - [pluginEntity](https://docs.bunny.com/developer/api-reference/queries/pluginentity). - [pluginParameter](https://docs.bunny.com/developer/api-reference/queries/pluginparameter). - [pluginParameters](https://docs.bunny.com/developer/api-reference/queries/pluginparameters). - [plugins](https://docs.bunny.com/developer/api-reference/queries/plugins). - [pluginVendor](https://docs.bunny.com/developer/api-reference/queries/pluginvendor). - [pluginVendors](https://docs.bunny.com/developer/api-reference/queries/pluginvendors). - [previewInvoice](https://docs.bunny.com/developer/api-reference/queries/previewinvoice). - [priceList](https://docs.bunny.com/developer/api-reference/queries/pricelist). - [priceListChangeOptions](https://docs.bunny.com/developer/api-reference/queries/pricelistchangeoptions). - [priceListCharge](https://docs.bunny.com/developer/api-reference/queries/pricelistcharge). - [priceListChargeOptions](https://docs.bunny.com/developer/api-reference/queries/pricelistchargeoptions). Scope: product:read. - [priceListCharges](https://docs.bunny.com/developer/api-reference/queries/pricelistcharges). - [priceLists](https://docs.bunny.com/developer/api-reference/queries/pricelists). - [product](https://docs.bunny.com/developer/api-reference/queries/product). - [productCategories](https://docs.bunny.com/developer/api-reference/queries/productcategories). - [productCategory](https://docs.bunny.com/developer/api-reference/queries/productcategory). - [products](https://docs.bunny.com/developer/api-reference/queries/products). - [queuedInvoices](https://docs.bunny.com/developer/api-reference/queries/queuedinvoices). - [queueJobs](https://docs.bunny.com/developer/api-reference/queries/queuejobs). - [quote](https://docs.bunny.com/developer/api-reference/queries/quote). - [quoteChange](https://docs.bunny.com/developer/api-reference/queries/quotechange). - [quoteChanges](https://docs.bunny.com/developer/api-reference/queries/quotechanges). - [quoteCharge](https://docs.bunny.com/developer/api-reference/queries/quotecharge). - [quoteCharges](https://docs.bunny.com/developer/api-reference/queries/quotecharges). - [quotes](https://docs.bunny.com/developer/api-reference/queries/quotes). - [recurringRevenue](https://docs.bunny.com/developer/api-reference/queries/recurringrevenue). - [recurringRevenues](https://docs.bunny.com/developer/api-reference/queries/recurringrevenues). - [renewalPipeline](https://docs.bunny.com/developer/api-reference/queries/renewalpipeline): Aggregate metrics for the renewal pipeline (open renewal deals). Scope: standard:read. - [revenueMovement](https://docs.bunny.com/developer/api-reference/queries/revenuemovement). - [revenueMovements](https://docs.bunny.com/developer/api-reference/queries/revenuemovements). - [revenueRecognitionExport](https://docs.bunny.com/developer/api-reference/queries/revenuerecognitionexport). Scope: standard:read. - [revenueRecognitionTable](https://docs.bunny.com/developer/api-reference/queries/revenuerecognitiontable). Scope: standard:read. - [role](https://docs.bunny.com/developer/api-reference/queries/role). - [roles](https://docs.bunny.com/developer/api-reference/queries/roles). - [roleScopes](https://docs.bunny.com/developer/api-reference/queries/rolescopes). - [search](https://docs.bunny.com/developer/api-reference/queries/search). - [subscription](https://docs.bunny.com/developer/api-reference/queries/subscription). - [subscriptionCharge](https://docs.bunny.com/developer/api-reference/queries/subscriptioncharge). - [subscriptionCharges](https://docs.bunny.com/developer/api-reference/queries/subscriptioncharges). - [subscriptionFeatures](https://docs.bunny.com/developer/api-reference/queries/subscriptionfeatures). - [subscriptions](https://docs.bunny.com/developer/api-reference/queries/subscriptions). - [supportEscalations](https://docs.bunny.com/developer/api-reference/queries/supportescalations). - [taxationEntityUseCodes](https://docs.bunny.com/developer/api-reference/queries/taxationentityusecodes). Scope: standard:read. - [template](https://docs.bunny.com/developer/api-reference/queries/template). - [templates](https://docs.bunny.com/developer/api-reference/queries/templates). - [tenant](https://docs.bunny.com/developer/api-reference/queries/tenant). - [tenants](https://docs.bunny.com/developer/api-reference/queries/tenants). - [transaction](https://docs.bunny.com/developer/api-reference/queries/transaction). - [transactions](https://docs.bunny.com/developer/api-reference/queries/transactions). - [user](https://docs.bunny.com/developer/api-reference/queries/user). - [users](https://docs.bunny.com/developer/api-reference/queries/users). - [validCoupon](https://docs.bunny.com/developer/api-reference/queries/validcoupon). - [view](https://docs.bunny.com/developer/api-reference/queries/view). - [views](https://docs.bunny.com/developer/api-reference/queries/views). - [warrenActivity](https://docs.bunny.com/developer/api-reference/queries/warrenactivity): A page of activity across your warren, newest first. - [warrenActivityChain](https://docs.bunny.com/developer/api-reference/queries/warrenactivitychain): The events of one request in your warren, oldest first. - [warrenActivityTriggeredEvents](https://docs.bunny.com/developer/api-reference/queries/warrenactivitytriggeredevents): More events caused by one action in your warren, oldest first. - [warrenRecordActivity](https://docs.bunny.com/developer/api-reference/queries/warrenrecordactivity): A page of activity for a record belonging to the warren, newest first. - [warrenRecordActivityChain](https://docs.bunny.com/developer/api-reference/queries/warrenrecordactivitychain): The events of one request that changed this record, oldest first. - [warrenRecordActivityTriggeredEvents](https://docs.bunny.com/developer/api-reference/queries/warrenrecordactivitytriggeredevents): More events an action caused on this record, oldest first. - [webhookEvent](https://docs.bunny.com/developer/api-reference/queries/webhookevent). - [webhookEvents](https://docs.bunny.com/developer/api-reference/queries/webhookevents). - [webhookEventsChart](https://docs.bunny.com/developer/api-reference/queries/webhookeventschart): Chart data for webhook event logs showing success and failure counts over the last 30 days. Scope: workflow:read. - [workflow](https://docs.bunny.com/developer/api-reference/queries/workflow). - [workflowActions](https://docs.bunny.com/developer/api-reference/queries/workflowactions): A workflow action definition. Scope: workflow:read. - [workflowCategories](https://docs.bunny.com/developer/api-reference/queries/workflowcategories). - [workflowCategory](https://docs.bunny.com/developer/api-reference/queries/workflowcategory). - [workflowJobLog](https://docs.bunny.com/developer/api-reference/queries/workflowjoblog). - [workflowJobLogs](https://docs.bunny.com/developer/api-reference/queries/workflowjoblogs). - [workflows](https://docs.bunny.com/developer/api-reference/queries/workflows). ## Mutations - [accountConsolidateInvoices](https://docs.bunny.com/developer/api-reference/mutations/accountconsolidateinvoices): Consolidate all of an account's queued invoices now and issue the result. Scope: billing:write. - [accountCreate](https://docs.bunny.com/developer/api-reference/mutations/accountcreate): Create an account. Scope: standard:write. - [accountDataReset](https://docs.bunny.com/developer/api-reference/mutations/accountdatareset): Delete all billing data of an account, keeping the account (sandbox only). Scope: standard:write. - [accountDelete](https://docs.bunny.com/developer/api-reference/mutations/accountdelete): Delete an account. Scope: standard:write. - [accountEnableBilling](https://docs.bunny.com/developer/api-reference/mutations/accountenablebilling): Cut an account's hierarchy over from the managing integration to Bunny billing. Scope: standard:write. - [accountFastForward](https://docs.bunny.com/developer/api-reference/mutations/accountfastforward): Fast forward an account to a future date (sandbox only). Scope: standard:write. - [accountReset](https://docs.bunny.com/developer/api-reference/mutations/accountreset): Reset account data. Scope: owner:write. - [accountSignup](https://docs.bunny.com/developer/api-reference/mutations/accountsignup): Using an existing account, sign up and pay for a subscription.. Scope: standard:write. - [accountUpdate](https://docs.bunny.com/developer/api-reference/mutations/accountupdate): Update an account. Scope: standard:write. - [accountValidateAddress](https://docs.bunny.com/developer/api-reference/mutations/accountvalidateaddress): Replaces an account address with a validated address. Scope: standard:write. - [agentExecutionApprove](https://docs.bunny.com/developer/api-reference/mutations/agentexecutionapprove): Approve a pending agent execution. Scope: standard:write. - [agentExecutionReject](https://docs.bunny.com/developer/api-reference/mutations/agentexecutionreject): Reject a pending agent execution. Scope: standard:write. - [aiAgentThreadDelete](https://docs.bunny.com/developer/api-reference/mutations/aiagentthreaddelete): Delete an AI agent thread. Scope: standard:write. - [apiAccessTokenCreate](https://docs.bunny.com/developer/api-reference/mutations/apiaccesstokencreate): Generate an api access token. Scope: security:write. - [apiClientCreate](https://docs.bunny.com/developer/api-reference/mutations/apiclientcreate): Create an OAuth2.0 API application for generating API access tokens. Scope: security:write. - [apiClientDelete](https://docs.bunny.com/developer/api-reference/mutations/apiclientdelete): Delete an OAuth2.0 API application. Scope: security:write. - [apiClientSecretRenew](https://docs.bunny.com/developer/api-reference/mutations/apiclientsecretrenew): Generate a new client secret. Scope: security:write. - [apiClientUpdate](https://docs.bunny.com/developer/api-reference/mutations/apiclientupdate): Update an OAuth2.0 API application. Scope: security:write. - [approvalRuleCreate](https://docs.bunny.com/developer/api-reference/mutations/approvalrulecreate): Create an approval rule. Scope: security:write. - [approvalRuleDelete](https://docs.bunny.com/developer/api-reference/mutations/approvalruledelete): Delete an approval rule. Scope: security:write. - [approvalRuleUpdate](https://docs.bunny.com/developer/api-reference/mutations/approvalruleupdate): Update an approval rule. Scope: security:write. - [approverCreate](https://docs.bunny.com/developer/api-reference/mutations/approvercreate): Create an approver. Scope: security:write. - [approverDelete](https://docs.bunny.com/developer/api-reference/mutations/approverdelete): Delete an approver. Scope: security:write. - [approverUpdate](https://docs.bunny.com/developer/api-reference/mutations/approverupdate): Update an approver. Scope: security:write. - [bankTransactionApprove](https://docs.bunny.com/developer/api-reference/mutations/banktransactionapprove): Approve a bank transaction, creating the manual payment and applying it. Scope: billing:write. - [bankTransactionIgnore](https://docs.bunny.com/developer/api-reference/mutations/banktransactionignore): Hide a bank transaction that is not relevant to billing. Scope: billing:write. - [bankTransactionReject](https://docs.bunny.com/developer/api-reference/mutations/banktransactionreject): Discard the suggested mapping and return the transaction to the unmatched queue. Scope: billing:write. - [bankTransactionSuggest](https://docs.bunny.com/developer/api-reference/mutations/banktransactionsuggest): Re-run the matching algorithm to (re)propose an invoice for the transaction. Scope: billing:write. - [bankTransactionSync](https://docs.bunny.com/developer/api-reference/mutations/banktransactionsync): Queue a manual bank transaction import for every linked connection. Scope: billing:write. - [bankTransactionUnapprove](https://docs.bunny.com/developer/api-reference/mutations/banktransactionunapprove): Undo an approved bank transaction, removing the manual payment. Scope: billing:write. - [bankTransactionUnignore](https://docs.bunny.com/developer/api-reference/mutations/banktransactionunignore): Restore a previously ignored bank transaction. Scope: billing:write. - [billingDetailsUpdate](https://docs.bunny.com/developer/api-reference/mutations/billingdetailsupdate): Update the billing details for an account. Scope: billing:write. - [bunnyUpdatesSeen](https://docs.bunny.com/developer/api-reference/mutations/bunnyupdatesseen). Scope: standard:write. - [campaignCreate](https://docs.bunny.com/developer/api-reference/mutations/campaigncreate): Create a campaign. Scope: standard:write. - [campaignDelete](https://docs.bunny.com/developer/api-reference/mutations/campaigndelete): Delete a campaign. Scope: standard:write. - [campaignUpdate](https://docs.bunny.com/developer/api-reference/mutations/campaignupdate): Update a campaign. Scope: standard:write. - [chatAsk](https://docs.bunny.com/developer/api-reference/mutations/chatask): Ask a question to the chat. Scope: standard:write. - [chatCreate](https://docs.bunny.com/developer/api-reference/mutations/chatcreate): Create a chat. Scope: standard:write. - [chatEscalate](https://docs.bunny.com/developer/api-reference/mutations/chatescalate): Escalate an AI chat conversation to a human. Scope: standard:write. - [checkout](https://docs.bunny.com/developer/api-reference/mutations/checkout): Pay a Quote or an Invoice. Scope: standard:write. - [companyUpdate](https://docs.bunny.com/developer/api-reference/mutations/companyupdate): Update company details. Scope: admin:write. - [contactCreate](https://docs.bunny.com/developer/api-reference/mutations/contactcreate): Create a contact. Scope: standard:write. - [contactDelete](https://docs.bunny.com/developer/api-reference/mutations/contactdelete): Delete a contact. Scope: standard:write. - [contactPortalLoginEmail](https://docs.bunny.com/developer/api-reference/mutations/contactportalloginemail): Email a contact a link to log into the portal. Scope: portal:write. - [contactUpdate](https://docs.bunny.com/developer/api-reference/mutations/contactupdate): Update a contact. Scope: standard:write. - [couponCreate](https://docs.bunny.com/developer/api-reference/mutations/couponcreate): Create a coupon. Scope: product:write. - [couponDelete](https://docs.bunny.com/developer/api-reference/mutations/coupondelete): Delete a coupon. Scope: product:write. - [couponUpdate](https://docs.bunny.com/developer/api-reference/mutations/couponupdate): Update a coupon. Scope: product:write. - [creditBalanceAutoTopUpUpdate](https://docs.bunny.com/developer/api-reference/mutations/creditbalanceautotopupupdate): Turn auto top-up on or off for a credit balance. Scope: billing:write. - [creditGrantCreate](https://docs.bunny.com/developer/api-reference/mutations/creditgrantcreate): Grant promotional or adjustment usage credits. Scope: billing:write. - [creditGrantVoid](https://docs.bunny.com/developer/api-reference/mutations/creditgrantvoid): Void the unused credits of a grant. Scope: billing:write. - [creditNoteAddCharge](https://docs.bunny.com/developer/api-reference/mutations/creditnoteaddcharge): Add a previously-invoiced charge as a line on a draft credit note. Scope: billing:write. - [creditNoteApplyToInvoices](https://docs.bunny.com/developer/api-reference/mutations/creditnoteapplytoinvoices): Apply a credit note to invoices. Scope: billing:write. - [creditNoteCreate](https://docs.bunny.com/developer/api-reference/mutations/creditnotecreate): Create a credit note. Scope: billing:write. - [creditNoteCreateAdhoc](https://docs.bunny.com/developer/api-reference/mutations/creditnotecreateadhoc): Create a standalone (ad-hoc) credit note crediting previously-invoiced charges. Scope: billing:write. - [creditNoteDelete](https://docs.bunny.com/developer/api-reference/mutations/creditnotedelete): Delete a credit note. Scope: billing:write. - [creditNoteIssue](https://docs.bunny.com/developer/api-reference/mutations/creditnoteissue): Issue a credit note. Scope: billing:write. - [creditNoteRemoveCharge](https://docs.bunny.com/developer/api-reference/mutations/creditnoteremovecharge): Remove a charge line from a draft credit note. Scope: billing:write. - [creditNoteUpdate](https://docs.bunny.com/developer/api-reference/mutations/creditnoteupdate): Update a credit note. Scope: billing:write. - [creditNoteUpdateTaxes](https://docs.bunny.com/developer/api-reference/mutations/creditnoteupdatetaxes): Update a credit note taxes. Scope: billing:write. - [creditTopUpCreate](https://docs.bunny.com/developer/api-reference/mutations/credittopupcreate): Buy credits through a usage charge's top-up charge, invoiced without a quote. Scope: billing:write. - [currencyUpdate](https://docs.bunny.com/developer/api-reference/mutations/currencyupdate): Update a currency. Scope: billing:write. - [currentUserUpdate](https://docs.bunny.com/developer/api-reference/mutations/currentuserupdate): Update the profile of the current user. Scope: standard:write. - [customFieldCreate](https://docs.bunny.com/developer/api-reference/mutations/customfieldcreate): Create a custom field definition. Scope: admin:write. - [customFieldDelete](https://docs.bunny.com/developer/api-reference/mutations/customfielddelete): Delete a custom field definition. Scope: admin:write. - [customFieldUpdate](https://docs.bunny.com/developer/api-reference/mutations/customfieldupdate): Update a custom field definition. Scope: admin:write. - [dealCreate](https://docs.bunny.com/developer/api-reference/mutations/dealcreate): Create a deal. Scope: standard:write. - [dealDelete](https://docs.bunny.com/developer/api-reference/mutations/dealdelete): Delete a deal. Scope: standard:write. - [dealStageCreate](https://docs.bunny.com/developer/api-reference/mutations/dealstagecreate): Create a deal stage. Scope: admin:write. - [dealStageDelete](https://docs.bunny.com/developer/api-reference/mutations/dealstagedelete): Delete a deal stage. Scope: admin:write. - [dealStageUpdate](https://docs.bunny.com/developer/api-reference/mutations/dealstageupdate): Update a deal stage. Scope: admin:write. - [dealUpdate](https://docs.bunny.com/developer/api-reference/mutations/dealupdate): Update a deal. Scope: standard:write. - [demoDataCreate](https://docs.bunny.com/developer/api-reference/mutations/demodatacreate): Add or recreate demo data in the warren. This process happens in the background and could take approximately 1 minute. Scope: standard:write. - [demoDataDelete](https://docs.bunny.com/developer/api-reference/mutations/demodatadelete): Remove demo data from the warren. Scope: standard:write. - [disputeReasonCreate](https://docs.bunny.com/developer/api-reference/mutations/disputereasoncreate): Create a dispute reason. Scope: billing:write. - [disputeReasonDelete](https://docs.bunny.com/developer/api-reference/mutations/disputereasondelete): Delete a dispute reason. Scope: billing:write. - [disputeReasonUpdate](https://docs.bunny.com/developer/api-reference/mutations/disputereasonupdate): Update a dispute reason. Scope: billing:write. - [documentTemplateComponentCreate](https://docs.bunny.com/developer/api-reference/mutations/documenttemplatecomponentcreate): Create a document template component. Scope: billing:write. - [documentTemplateComponentDelete](https://docs.bunny.com/developer/api-reference/mutations/documenttemplatecomponentdelete): Delete a document template component. Scope: billing:write. - [documentTemplateComponentUpdate](https://docs.bunny.com/developer/api-reference/mutations/documenttemplatecomponentupdate): Update a document template component. Scope: billing:write. - [documentTemplateCreate](https://docs.bunny.com/developer/api-reference/mutations/documenttemplatecreate): Create a document template. Scope: billing:write. - [documentTemplateDelete](https://docs.bunny.com/developer/api-reference/mutations/documenttemplatedelete): Delete a document template. Scope: billing:write. - [documentTemplateUpdate](https://docs.bunny.com/developer/api-reference/mutations/documenttemplateupdate): Update a document template. Scope: billing:write. - [emailBrandingReset](https://docs.bunny.com/developer/api-reference/mutations/emailbrandingreset): Reset email branding. Scope: admin:write. - [emailRetry](https://docs.bunny.com/developer/api-reference/mutations/emailretry): Retry sending an email. Scope: standard:write. - [entityCreate](https://docs.bunny.com/developer/api-reference/mutations/entitycreate): Create an entity. Scope: admin:write. - [entityDelete](https://docs.bunny.com/developer/api-reference/mutations/entitydelete). Scope: admin:write. - [entityDuplicate](https://docs.bunny.com/developer/api-reference/mutations/entityduplicate): Create a duplicate of an entity. Scope: admin:write. - [entityTemplateEmailTest](https://docs.bunny.com/developer/api-reference/mutations/entitytemplateemailtest): Send the entity email template to the current user.. Scope: admin:write. - [entityUpdate](https://docs.bunny.com/developer/api-reference/mutations/entityupdate): Update an entity. Scope: admin:write. - [entityValidateAddress](https://docs.bunny.com/developer/api-reference/mutations/entityvalidateaddress): Replaces a company address with a validated address. Scope: admin:write. - [eventRetry](https://docs.bunny.com/developer/api-reference/mutations/eventretry): Retry a failed event. Scope: standard:write. - [externalUserUpdate](https://docs.bunny.com/developer/api-reference/mutations/externaluserupdate): Update an external user mapping. Scope: owner:write admin:write. - [featureCreate](https://docs.bunny.com/developer/api-reference/mutations/featurecreate): Create a feature. Scope: product:write. - [featureDelete](https://docs.bunny.com/developer/api-reference/mutations/featuredelete): Delete a feature. Scope: product:write. - [featureUpdate](https://docs.bunny.com/developer/api-reference/mutations/featureupdate): Update a feature. Scope: product:write. - [featureUsageCreate](https://docs.bunny.com/developer/api-reference/mutations/featureusagecreate): Create a feature usage record for usage based billing. Scope: billing:write. - [featureUsageDelete](https://docs.bunny.com/developer/api-reference/mutations/featureusagedelete): Delete a feature usage record. Scope: billing:write. - [featureUsageUpdate](https://docs.bunny.com/developer/api-reference/mutations/featureusageupdate): Update a feature usage record for usage based billing. Scope: billing:write. - [fieldCreate](https://docs.bunny.com/developer/api-reference/mutations/fieldcreate): Create a field. Scope: standard:write. - [fieldDelete](https://docs.bunny.com/developer/api-reference/mutations/fielddelete): Delete a field. Scope: standard:write. - [fieldUpdate](https://docs.bunny.com/developer/api-reference/mutations/fieldupdate): Update a field. Scope: standard:write. - [financialAccountCreate](https://docs.bunny.com/developer/api-reference/mutations/financialaccountcreate): Create a financial account. Scope: billing:write. - [financialAccountDelete](https://docs.bunny.com/developer/api-reference/mutations/financialaccountdelete): Delete a financial account. Scope: billing:write. - [financialAccountUpdate](https://docs.bunny.com/developer/api-reference/mutations/financialaccountupdate): Update a financial account. Scope: billing:write. - [globalOauthConnectionRevoke](https://docs.bunny.com/developer/api-reference/mutations/globaloauthconnectionrevoke): Revoke a global OAuth client connection to this tenant. Scope: developer:write. - [groupCreate](https://docs.bunny.com/developer/api-reference/mutations/groupcreate): Create a group. Scope: security:write. - [groupDelete](https://docs.bunny.com/developer/api-reference/mutations/groupdelete): Delete a group. Scope: security:write. - [groupUpdate](https://docs.bunny.com/developer/api-reference/mutations/groupupdate): Update a group. Scope: security:write. - [industryCreate](https://docs.bunny.com/developer/api-reference/mutations/industrycreate): Create an industry. Scope: admin:write. - [invoiceAddCredit](https://docs.bunny.com/developer/api-reference/mutations/invoiceaddcredit): Add a credit to an invoice. Scope: billing:write. - [invoiceCredit](https://docs.bunny.com/developer/api-reference/mutations/invoicecredit): Credit an invoice. Scope: billing:write. - [invoiceDeleteCredit](https://docs.bunny.com/developer/api-reference/mutations/invoicedeletecredit): Delete a credit from an invoice. Scope: billing:write. - [invoiceDequeue](https://docs.bunny.com/developer/api-reference/mutations/invoicedequeue): Dequeue an invoice from consolidation queue for individual processing. Scope: billing:write. - [invoiceGenerateNextPeriod](https://docs.bunny.com/developer/api-reference/mutations/invoicegeneratenextperiod): Generate an invoice for the next billing period. Scope: billing:write. - [invoiceItemUpdate](https://docs.bunny.com/developer/api-reference/mutations/invoiceitemupdate): Update an invoice item. Scope: billing:write. - [invoiceMerge](https://docs.bunny.com/developer/api-reference/mutations/invoicemerge): Merge two or more invoices. Scope: billing:write. - [invoiceMergeUndo](https://docs.bunny.com/developer/api-reference/mutations/invoicemergeundo): Undo the merge of two or more invoices. Scope: billing:write. - [invoiceRefund](https://docs.bunny.com/developer/api-reference/mutations/invoicerefund): Refund an invoice. Scope: billing:write. - [invoiceRegenerate](https://docs.bunny.com/developer/api-reference/mutations/invoiceregenerate): Regenerate an invoice. Scope: billing:write. - [invoiceReissue](https://docs.bunny.com/developer/api-reference/mutations/invoicereissue): Reissue a void invoice. Scope: billing:write. - [invoiceRelease](https://docs.bunny.com/developer/api-reference/mutations/invoicerelease): Transition a draft invoice to ready state. Scope: standard:write. - [invoiceRetryTax](https://docs.bunny.com/developer/api-reference/mutations/invoiceretrytax): Try to calculate an invoice taxes. Scope: billing:write. - [invoiceSendEmail](https://docs.bunny.com/developer/api-reference/mutations/invoicesendemail): Send an invoice through email. Scope: billing:write. - [invoiceTemplateCreate](https://docs.bunny.com/developer/api-reference/mutations/invoicetemplatecreate): Create an invoice template. Scope: billing:write. - [invoiceTemplateDelete](https://docs.bunny.com/developer/api-reference/mutations/invoicetemplatedelete): Delete an invoice template. Scope: billing:write. - [invoiceTemplateUpdate](https://docs.bunny.com/developer/api-reference/mutations/invoicetemplateupdate): Update an invoice template. Scope: billing:write. - [invoiceUpdate](https://docs.bunny.com/developer/api-reference/mutations/invoiceupdate): Update an invoice. Scope: billing:write. - [invoiceUpdateComment](https://docs.bunny.com/developer/api-reference/mutations/invoiceupdatecomment): Add, update, or remove a comment on an invoice item. Scope: billing:write. - [invoiceUpdateCredit](https://docs.bunny.com/developer/api-reference/mutations/invoiceupdatecredit): Edit a credit on an invoice. Scope: billing:write. - [invoiceUpdateCredits](https://docs.bunny.com/developer/api-reference/mutations/invoiceupdatecredits): Edit credits on an invoice. Scope: billing:write. - [invoiceUpdateNotes](https://docs.bunny.com/developer/api-reference/mutations/invoiceupdatenotes): Add, update, or remove notes from an invoice. Scope: billing:write. - [invoiceUpdateTaxes](https://docs.bunny.com/developer/api-reference/mutations/invoiceupdatetaxes): Update an invoice taxes. Scope: billing:write. - [invoiceVoid](https://docs.bunny.com/developer/api-reference/mutations/invoicevoid): Void an invoice. Scope: billing:write. - [invoiceWriteOff](https://docs.bunny.com/developer/api-reference/mutations/invoicewriteoff): Write off an invoice. Scope: billing:write. - [leadConvert](https://docs.bunny.com/developer/api-reference/mutations/leadconvert): Convert a lead to an account. Scope: standard:write. - [leadCreate](https://docs.bunny.com/developer/api-reference/mutations/leadcreate): Create a lead. Scope: standard:write. - [leadDelete](https://docs.bunny.com/developer/api-reference/mutations/leaddelete): Delete a lead. Scope: standard:write. - [leadSourceCreate](https://docs.bunny.com/developer/api-reference/mutations/leadsourcecreate): Create a lead source. Scope: admin:write. - [leadUpdate](https://docs.bunny.com/developer/api-reference/mutations/leadupdate): Update a lead. Scope: standard:write. - [legacyCreditNoteCreate](https://docs.bunny.com/developer/api-reference/mutations/legacycreditnotecreate): Create a legacy credit note. Scope: billing:write. - [legacyInvoiceCreate](https://docs.bunny.com/developer/api-reference/mutations/legacyinvoicecreate): Create a legacy invoice. Scope: billing:write. - [legacyPaymentCreate](https://docs.bunny.com/developer/api-reference/mutations/legacypaymentcreate): Create a legacy payment. Scope: billing:write. - [legacyRecurringRevenueImport](https://docs.bunny.com/developer/api-reference/mutations/legacyrecurringrevenueimport): Import legacy recurring revenues from a CSV source. Scope: admin:write. - [manualPaymentsUndo](https://docs.bunny.com/developer/api-reference/mutations/manualpaymentsundo): Undo a manual payment, unapplying it from invoices and destroying the payment record. Scope: billing:write. - [mutationBatch](https://docs.bunny.com/developer/api-reference/mutations/mutationbatch): Process mutations in bulks. Scope: standard:write. - [offlineLicenseCreate](https://docs.bunny.com/developer/api-reference/mutations/offlinelicensecreate): Generate an offline license JWT with a 1-year expiry for a subscription. Scope: standard:write. - [paymentApplyToAccount](https://docs.bunny.com/developer/api-reference/mutations/paymentapplytoaccount): Apply a payment to an account. Scope: billing:write. - [paymentApplyToInvoice](https://docs.bunny.com/developer/api-reference/mutations/paymentapplytoinvoice): Apply a payment to an invoice. Scope: billing:write. - [paymentApplyToInvoices](https://docs.bunny.com/developer/api-reference/mutations/paymentapplytoinvoices): Apply a payment to one or more invoices. Scope: billing:write. - [paymentMethodCreate](https://docs.bunny.com/developer/api-reference/mutations/paymentmethodcreate): Create a payment method. Scope: billing:write. - [paymentUnapplyFromInvoices](https://docs.bunny.com/developer/api-reference/mutations/paymentunapplyfrominvoices): Remove a payment from an invoice. Scope: billing:write. - [planCreate](https://docs.bunny.com/developer/api-reference/mutations/plancreate): Create a plan. Scope: product:write. - [planDelete](https://docs.bunny.com/developer/api-reference/mutations/plandelete): Delete a plan. Scope: product:write. - [planDuplicate](https://docs.bunny.com/developer/api-reference/mutations/planduplicate): Create a duplicate of a plan. Scope: product:write. - [planFeatureUpdate](https://docs.bunny.com/developer/api-reference/mutations/planfeatureupdate): Update a plan feature. Scope: product:write. - [planUpdate](https://docs.bunny.com/developer/api-reference/mutations/planupdate): Update a plan. Scope: product:write. - [platformCreate](https://docs.bunny.com/developer/api-reference/mutations/platformcreate): Create a platform. Scope: product:write. - [platformDelete](https://docs.bunny.com/developer/api-reference/mutations/platformdelete): Delete a platform. Scope: product:write. - [platformUpdate](https://docs.bunny.com/developer/api-reference/mutations/platformupdate): Update a platform. Scope: product:write. - [pluginCreate](https://docs.bunny.com/developer/api-reference/mutations/plugincreate). Scope: admin:write. - [pluginDelete](https://docs.bunny.com/developer/api-reference/mutations/plugindelete). Scope: admin:write. - [pluginUpdate](https://docs.bunny.com/developer/api-reference/mutations/pluginupdate). Scope: admin:write. - [pluginValueCreate](https://docs.bunny.com/developer/api-reference/mutations/pluginvaluecreate). Scope: admin:write. - [pluginValueDelete](https://docs.bunny.com/developer/api-reference/mutations/pluginvaluedelete). Scope: admin:write. - [pluginValueUpdate](https://docs.bunny.com/developer/api-reference/mutations/pluginvalueupdate). Scope: admin:write. - [portalSessionCreate](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate): Generate a short lived access token to access the customer portal. Scope: security:write. - [priceListAmountDuePreview](https://docs.bunny.com/developer/api-reference/mutations/pricelistamountduepreview): Amount due for signing up to a price list, before an account exists.. Scope: standard:write. - [priceListChargeCreate](https://docs.bunny.com/developer/api-reference/mutations/pricelistchargecreate): Create a charge on a price list. Scope: product:write. - [priceListChargeDelete](https://docs.bunny.com/developer/api-reference/mutations/pricelistchargedelete): Delete a charge from a price list. Scope: product:write. - [priceListChargeDeprecate](https://docs.bunny.com/developer/api-reference/mutations/pricelistchargedeprecate): Deprecate a price list charge. Scope: product:write. - [priceListChargeUndoDeprecate](https://docs.bunny.com/developer/api-reference/mutations/pricelistchargeundodeprecate): Undo the deprecation of a price list charge. Scope: product:write. - [priceListChargeUpdate](https://docs.bunny.com/developer/api-reference/mutations/pricelistchargeupdate): Update a charge on a price list. Scope: product:write. - [priceListCreate](https://docs.bunny.com/developer/api-reference/mutations/pricelistcreate): Create a price list. Scope: product:write. - [priceListDelete](https://docs.bunny.com/developer/api-reference/mutations/pricelistdelete): Delete a price list. Scope: product:write. - [priceListDeprecate](https://docs.bunny.com/developer/api-reference/mutations/pricelistdeprecate): Deprecate a price list. Scope: product:write. - [priceListDuplicate](https://docs.bunny.com/developer/api-reference/mutations/pricelistduplicate): Create a duplicate of a price list. Scope: product:write. - [priceListUndoDeprecate](https://docs.bunny.com/developer/api-reference/mutations/pricelistundodeprecate): Undo the deprecation of a price list. Scope: product:write. - [priceListUpdate](https://docs.bunny.com/developer/api-reference/mutations/pricelistupdate): Update a price list. Scope: product:write. - [productCategoryCreate](https://docs.bunny.com/developer/api-reference/mutations/productcategorycreate): Create a product category. Scope: product:write. - [productCategoryDelete](https://docs.bunny.com/developer/api-reference/mutations/productcategorydelete): Delete a product category. Scope: product:write. - [productCategoryUpdate](https://docs.bunny.com/developer/api-reference/mutations/productcategoryupdate): Update a product category. Scope: product:write. - [productCreate](https://docs.bunny.com/developer/api-reference/mutations/productcreate): Create a product. Scope: product:write. - [productDelete](https://docs.bunny.com/developer/api-reference/mutations/productdelete): Delete a product. Scope: product:write. - [productDuplicate](https://docs.bunny.com/developer/api-reference/mutations/productduplicate): Create a duplicate of a product. Scope: product:write. - [productImport](https://docs.bunny.com/developer/api-reference/mutations/productimport): Create products in bulk from a JSON recipe. Scope: product:write. - [productUpdate](https://docs.bunny.com/developer/api-reference/mutations/productupdate): Update a product. Scope: product:write. - [quoteAccept](https://docs.bunny.com/developer/api-reference/mutations/quoteaccept): Flag a quote as accepted. Scope: standard:write. - [quoteAccountSignup](https://docs.bunny.com/developer/api-reference/mutations/quoteaccountsignup): Create an account, quote and payment method for a subscription and check it out.. Scope: standard:write. - [quoteAddCoupon](https://docs.bunny.com/developer/api-reference/mutations/quoteaddcoupon): Add a coupon to a quote; it goes on the quote's subscription change (not an adjustment or an add-on), and fails unless the quote has exactly one. Use this when you only know the quote, e.g. self-service checkout and signup; to target a specific change, use quoteChangeAddCoupon.. Scope: standard:write. - [quoteApplyChanges](https://docs.bunny.com/developer/api-reference/mutations/quoteapplychanges): Convert the quote to a subscription. Scope: standard:write. - [quoteApplyPriceAdjustments](https://docs.bunny.com/developer/api-reference/mutations/quoteapplypriceadjustments): Apply price adjustments to the quote. Scope: standard:write. - [quoteApprovalCancel](https://docs.bunny.com/developer/api-reference/mutations/quoteapprovalcancel): Cancel the approval process and remove the pending approval request. Scope: standard:write. - [quoteApprovalStart](https://docs.bunny.com/developer/api-reference/mutations/quoteapprovalstart): Begin with the approval process. Scope: standard:write. - [quoteApprove](https://docs.bunny.com/developer/api-reference/mutations/quoteapprove): Approve a quote. Scope: standard:write. - [quoteChangeAdd](https://docs.bunny.com/developer/api-reference/mutations/quotechangeadd): Create a quote change. Scope: standard:write. - [quoteChangeAddCoupon](https://docs.bunny.com/developer/api-reference/mutations/quotechangeaddcoupon): Add a coupon to a specific quote change; it discounts only that change. Adjustment changes are rejected. Use this when you pick the change yourself; if you only know the quote, use quoteAddCoupon.. Scope: standard:write. - [quoteChangeApplyPriceAdjustment](https://docs.bunny.com/developer/api-reference/mutations/quotechangeapplypriceadjustment): Apply the price adjustments on a quote change. Scope: standard:write. - [quoteChangeCreate](https://docs.bunny.com/developer/api-reference/mutations/quotechangecreate): Add a price list with its charges and quantities to the quote. Scope: standard:write. - [quoteChangeCreateOneTime](https://docs.bunny.com/developer/api-reference/mutations/quotechangecreateonetime): Add a one-time product to the quote, with its charges in the quote's currency. Scope: standard:write. - [quoteChangeCreateRampUp](https://docs.bunny.com/developer/api-reference/mutations/quotechangecreaterampup): Add a price list and configure the ramp up of the charges. Scope: standard:write. - [quoteChangeCreateRampUpPreview](https://docs.bunny.com/developer/api-reference/mutations/quotechangecreaterampuppreview): Add a price list and configure the ramp up of the charges. Scope: standard:write. - [quoteChangeCreateRenew](https://docs.bunny.com/developer/api-reference/mutations/quotechangecreaterenew): Create a quote change for a subscription renewal. Scope: standard:write. - [quoteChangeDelete](https://docs.bunny.com/developer/api-reference/mutations/quotechangedelete): Delete a quote change. Scope: standard:write. - [quoteChangeDiscountCreate](https://docs.bunny.com/developer/api-reference/mutations/quotechangediscountcreate): Create a discount for a quote charge. Scope: standard:write. - [quoteChangeRemoveCoupon](https://docs.bunny.com/developer/api-reference/mutations/quotechangeremovecoupon): Remove a coupon from a specific quote change. Pairs with quoteChangeAddCoupon; if you only know the quote, use quoteRemoveCoupon.. Scope: standard:write. - [quoteChangeRevertPriceAdjustment](https://docs.bunny.com/developer/api-reference/mutations/quotechangerevertpriceadjustment): Revert the price adjustments on a quote change. Scope: standard:write. - [quoteChangeUpdate](https://docs.bunny.com/developer/api-reference/mutations/quotechangeupdate): Update a quote change. Scope: standard:write. - [quoteChangeUpdateRampUp](https://docs.bunny.com/developer/api-reference/mutations/quotechangeupdaterampup): Modify the ramp deal configuration. Scope: standard:write. - [quoteChargeCreate](https://docs.bunny.com/developer/api-reference/mutations/quotechargecreate): Create a charge for a quote change. Scope: standard:write. - [quoteChargeDelete](https://docs.bunny.com/developer/api-reference/mutations/quotechargedelete): Delete a quote charge. Scope: standard:write. - [quoteChargeFreeMonthsCreate](https://docs.bunny.com/developer/api-reference/mutations/quotechargefreemonthscreate): Add free months to a quote charge. Scope: standard:write. - [quoteChargeUpdate](https://docs.bunny.com/developer/api-reference/mutations/quotechargeupdate): Modify the quote charge properties. Scope: standard:write. - [quoteCompose](https://docs.bunny.com/developer/api-reference/mutations/quotecompose): Create a quote for a new subscription or subscription price list change. Scope: standard:write. - [quoteCreate](https://docs.bunny.com/developer/api-reference/mutations/quotecreate): Create an empty quote. Scope: standard:write. - [quoteCreateWithDeal](https://docs.bunny.com/developer/api-reference/mutations/quotecreatewithdeal): Create an empty quote with a new deal. Scope: standard:write. - [quoteDelete](https://docs.bunny.com/developer/api-reference/mutations/quotedelete): Delete a quote. Scope: standard:write. - [quoteDuplicate](https://docs.bunny.com/developer/api-reference/mutations/quoteduplicate): Create a duplicate of a quote. Scope: standard:write. - [quoteMarkAsShared](https://docs.bunny.com/developer/api-reference/mutations/quotemarkasshared): Mark a draft quote as shared to lock the quote from further modifications. Scope: standard:write. - [quotePollSigningUrl](https://docs.bunny.com/developer/api-reference/mutations/quotepollsigningurl): Poll for the signing url to check if it is ready. Scope: standard:write. - [quoteRecalculateTaxes](https://docs.bunny.com/developer/api-reference/mutations/quoterecalculatetaxes): Update a quote taxes. Scope: standard:write. - [quoteReject](https://docs.bunny.com/developer/api-reference/mutations/quotereject): Reject a quote. Scope: standard:write. - [quoteRemoveCoupon](https://docs.bunny.com/developer/api-reference/mutations/quoteremovecoupon): Remove a coupon from a quote, from whichever quote change carries it. Pairs with quoteAddCoupon; to remove it from a specific change, use quoteChangeRemoveCoupon.. Scope: standard:write. - [quoteSendEmail](https://docs.bunny.com/developer/api-reference/mutations/quotesendemail): Send the quote by email to the quotes contact. Scope: standard:write. - [quoteSignatureCreate](https://docs.bunny.com/developer/api-reference/mutations/quotesignaturecreate): Add a signature to a quote. Scope: standard:write. - [quoteSignersSendEmail](https://docs.bunny.com/developer/api-reference/mutations/quotesignerssendemail): Send the quote by email to the remaining signers. Scope: standard:write. - [quoteSigningUrlCreate](https://docs.bunny.com/developer/api-reference/mutations/quotesigningurlcreate): Generate a signing url for a quote. Scope: standard:write. - [quoteSubscriptionActivate](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptionactivate): Quote activating a subscription. Scope: standard:write. - [quoteSubscriptionAddon](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptionaddon): Generate a quote to add an addon to a subscription. Scope: standard:write. - [quoteSubscriptionDiscount](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptiondiscount): Generate a quote to discount a subscription. Scope: standard:write. - [quoteSubscriptionImport](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptionimport): Import a subscription from a price list and account data. Scope: product:write. - [quoteSubscriptionReinstate](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptionreinstate): Generate a quote to reinstate a subscription. Scope: standard:write. - [quoteSubscriptionRenew](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptionrenew): Generate a quote to renew a subscription. Scope: standard:write. - [quoteSubscriptionUpdate](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptionupdate): Quote changing quantities and/or discounts to subscriptions. Scope: standard:write. - [quoteSubscriptionUpgrade](https://docs.bunny.com/developer/api-reference/mutations/quotesubscriptionupgrade): Quote a subscription upgrade. Scope: standard:write. - [quoteUndo](https://docs.bunny.com/developer/api-reference/mutations/quoteundo): Undo the a quote after it has been applied. Scope: standard:write. - [quoteUnshare](https://docs.bunny.com/developer/api-reference/mutations/quoteunshare): Unshare a quote. Scope: standard:write. - [quoteUpdate](https://docs.bunny.com/developer/api-reference/mutations/quoteupdate): Update a quote. Scope: standard:write. - [revenueMovementCreate](https://docs.bunny.com/developer/api-reference/mutations/revenuemovementcreate): Create a manual revenue movement. Scope: billing:write. - [revenueMovementDelete](https://docs.bunny.com/developer/api-reference/mutations/revenuemovementdelete): Delete a manual revenue movement. Scope: billing:write. - [revenueMovementUpdate](https://docs.bunny.com/developer/api-reference/mutations/revenuemovementupdate): Update a manual revenue movement. Scope: billing:write. - [roleCreate](https://docs.bunny.com/developer/api-reference/mutations/rolecreate): Create a role. Scope: security:write. - [roleDelete](https://docs.bunny.com/developer/api-reference/mutations/roledelete): Delete a role. Scope: security:write. - [roleUpdate](https://docs.bunny.com/developer/api-reference/mutations/roleupdate): Update a role. Scope: security:write. - [signupActivate](https://docs.bunny.com/developer/api-reference/mutations/signupactivate): Complete the signup for a Bunny account. Scope: signup:write. - [signupCreate](https://docs.bunny.com/developer/api-reference/mutations/signupcreate): Sign up for a Bunny account. Scope: signup:write. - [stripeSubscriptionMigrate](https://docs.bunny.com/developer/api-reference/mutations/stripesubscriptionmigrate): Migrate a subscription from Stripe. Scope: standard:write. - [subscriptionCancel](https://docs.bunny.com/developer/api-reference/mutations/subscriptioncancel): Cancel an active subscription. Scope: standard:write. - [subscriptionChargeCreditSettingsUpdate](https://docs.bunny.com/developer/api-reference/mutations/subscriptionchargecreditsettingsupdate): Change the depletion and auto top-up settings of a subscription charge. Scope: billing:write. - [subscriptionCreate](https://docs.bunny.com/developer/api-reference/mutations/subscriptioncreate): Create a paid or trial subscription. Scope: standard:write. - [subscriptionDelete](https://docs.bunny.com/developer/api-reference/mutations/subscriptiondelete): Delete a subscription (only in sandbox mode with no issued invoices). Scope: standard:write. - [subscriptionLicenseInstanceDelete](https://docs.bunny.com/developer/api-reference/mutations/subscriptionlicenseinstancedelete): Delete an observed license instance from a subscription. Scope: standard:write. - [subscriptionQuantityUpdate](https://docs.bunny.com/developer/api-reference/mutations/subscriptionquantityupdate): Quote quantity modifications to a subscription. Scope: standard:write. - [subscriptionReinstate](https://docs.bunny.com/developer/api-reference/mutations/subscriptionreinstate): Reinstating an expired or canceled subscription. Scope: standard:write. - [subscriptionSetAutoRenew](https://docs.bunny.com/developer/api-reference/mutations/subscriptionsetautorenew): Toggle auto-renew ON or OFF on a subscription. Scope: standard:write. - [subscriptionTenantUpdate](https://docs.bunny.com/developer/api-reference/mutations/subscriptiontenantupdate): Update the tenant linked to a subscription. Scope: standard:write. - [subscriptionTrialConvert](https://docs.bunny.com/developer/api-reference/mutations/subscriptiontrialconvert): Convert an existing trial subscription into a paid subscription. Scope: standard:write. - [subscriptionTrialConvertPreview](https://docs.bunny.com/developer/api-reference/mutations/subscriptiontrialconvertpreview): Preview of a existing trial subscription conversion. Scope: standard:write. - [subscriptionTrialExtend](https://docs.bunny.com/developer/api-reference/mutations/subscriptiontrialextend): Extend the subscription's trial period. Scope: standard:write. - [subscriptionUpdate](https://docs.bunny.com/developer/api-reference/mutations/subscriptionupdate): Quote quantity and/or discount modifications to a subscription. Scope: standard:write. - [taxationRequiredAccountFields](https://docs.bunny.com/developer/api-reference/mutations/taxationrequiredaccountfields): Account fields required for taxation, before an account exists.. Scope: standard:write. - [templateUpdate](https://docs.bunny.com/developer/api-reference/mutations/templateupdate): Update an email template. Scope: admin:write. - [tenantAssume](https://docs.bunny.com/developer/api-reference/mutations/tenantassume): Generate a login link to assume tenant as support user. Scope: assume:write. - [tenantCreate](https://docs.bunny.com/developer/api-reference/mutations/tenantcreate): Create an tenant in Bunny to reference a tenant in your SaaS application. Scope: product:write. - [tenantDelete](https://docs.bunny.com/developer/api-reference/mutations/tenantdelete): Delete a tenant. Scope: product:write. - [tenantMetricsUpdate](https://docs.bunny.com/developer/api-reference/mutations/tenantmetricsupdate): Updates the metrics for a tenant. Scope: platform:write. - [tenantPortalLogin](https://docs.bunny.com/developer/api-reference/mutations/tenantportallogin): Generate a short lived link to open the customer portal for a tenant. Scope: portal_assume:write. - [tenantProvisioningSend](https://docs.bunny.com/developer/api-reference/mutations/tenantprovisioningsend): Send a provisioning webhook to the tenant. Scope: product:write. - [tenantUpdate](https://docs.bunny.com/developer/api-reference/mutations/tenantupdate): Update an tenant. Scope: platform:write. - [userCreate](https://docs.bunny.com/developer/api-reference/mutations/usercreate): Create a user. Scope: security:write. - [userDelete](https://docs.bunny.com/developer/api-reference/mutations/userdelete): Delete a user. Scope: security:write. - [userUpdate](https://docs.bunny.com/developer/api-reference/mutations/userupdate): Update a user. Scope: security:write. - [viewCreate](https://docs.bunny.com/developer/api-reference/mutations/viewcreate): Create a view. Scope: standard:write. - [viewDelete](https://docs.bunny.com/developer/api-reference/mutations/viewdelete): Delete a view. Scope: standard:write. - [viewUpdate](https://docs.bunny.com/developer/api-reference/mutations/viewupdate): Update a view. Scope: standard:write. - [webhookEventRetry](https://docs.bunny.com/developer/api-reference/mutations/webhookeventretry): Retry sending a webhook event. Scope: workflow:write. - [widgetTokenCreate](https://docs.bunny.com/developer/api-reference/mutations/widgettokencreate): Generate a short lived access token to manage your subscription with bunny. Scope: admin:write. - [workflowCategoryCreate](https://docs.bunny.com/developer/api-reference/mutations/workflowcategorycreate): Create a workflow category. Scope: workflow:write. - [workflowCategoryDelete](https://docs.bunny.com/developer/api-reference/mutations/workflowcategorydelete): Delete a workflow category. Scope: workflow:write. - [workflowCategoryUpdate](https://docs.bunny.com/developer/api-reference/mutations/workflowcategoryupdate): Update a workflow category. Scope: workflow:write. - [workflowCreate](https://docs.bunny.com/developer/api-reference/mutations/workflowcreate): Create a workflow. Scope: workflow:write. - [workflowDelete](https://docs.bunny.com/developer/api-reference/mutations/workflowdelete): Delete a workflow. Scope: workflow:write. - [workflowDuplicate](https://docs.bunny.com/developer/api-reference/mutations/workflowduplicate): Create a duplicate of a workflow. Scope: workflow:write. - [workflowsDefaultCreate](https://docs.bunny.com/developer/api-reference/mutations/workflowsdefaultcreate): Create/restore all of the default workflows. Scope: workflow:write. - [workflowUpdate](https://docs.bunny.com/developer/api-reference/mutations/workflowupdate): Update a workflow. Scope: workflow:write.