LogoLogo
Using BunnyDeveloper
  • Overview
  • Integration points
  • Using the GraphQL API
    • New to GraphQL?
    • Using the API
    • Queries
      • account
      • accountBalance
      • accountBalances
      • accountType
      • accountTypes
      • accountingTable
      • accounts
      • apiClient
      • apiClients
      • approvalRule
      • approvalRules
      • approver
      • approvers
      • billRun
      • billRuns
      • billingDetails
      • campaign
      • campaigns
      • company
      • contact
      • contacts
      • coupon
      • coupons
      • creditNote
      • creditNoteItem
      • creditNoteItems
      • creditNotes
      • currencies
      • currency
      • currentUser
      • deal
      • dealStage
      • dealStages
      • deals
      • deepEvents
      • disputeReason
      • disputeReasons
      • draftCreditNotes
      • draftInvoices
      • email
      • emails
      • enabledOnlyForUsers
      • entities
      • entity
      • entityBranding
      • event
      • eventDetails
      • events
      • feature
      • featureUsage
      • featureUsageHistogram
      • featureUsages
      • features
      • field
      • fields
      • financialAccount
      • financialAccounts
      • formattedCreditNote
      • formattedInvoice
      • formattedQuote
      • group
      • groups
      • industries
      • industry
      • intracomVats
      • invoice
      • invoiceItem
      • invoiceItems
      • invoiceTemplate
      • invoiceTemplates
      • invoices
      • isolateTos
      • job
      • jobs
      • journalEntries
      • journalEntry
      • journalEntryLine
      • journalEntryLines
      • lead
      • leadSource
      • leadSources
      • leadStatus
      • leadStatuses
      • leads
      • monthlyReport
      • notification
      • notifications
      • owners
      • payment
      • paymentApplication
      • paymentApplications
      • paymentMethod
      • paymentMethods
      • paymentPlugins
      • payments
      • period
      • periods
      • plan
      • planChangeOptions
      • planFeature
      • planFeatures
      • plans
      • platform
      • platforms
      • plugin
      • pluginDefinition
      • pluginDefinitions
      • pluginEntities
      • pluginEntity
      • pluginParameter
      • pluginParameters
      • pluginVendor
      • pluginVendors
      • plugins
      • priceList
      • priceListChangeOptions
      • priceListCharge
      • priceListChargeOptions
      • priceListCharges
      • priceLists
      • product
      • productCategories
      • productCategory
      • products
      • quote
      • quoteChange
      • quoteChanges
      • quoteCharge
      • quoteCharges
      • quotes
      • recurringRevenue
      • recurringRevenues
      • revenueMovement
      • revenueMovements
      • revenueRecognitionExport
      • revenueRecognitionTable
      • role
      • roleScopes
      • roles
      • search
      • subscription
      • subscriptionCharge
      • subscriptionCharges
      • subscriptionFeatures
      • subscriptions
      • taxationEntityUseCodes
      • template
      • templates
      • tenant
      • tenantProvisioningChange
      • tenantProvisioningChanges
      • tenants
      • transaction
      • transactions
      • user
      • users
      • validCoupon
      • view
      • views
      • webhookEvent
      • webhookEvents
      • workflow
      • workflowActions
      • workflowCategories
      • workflowCategory
      • workflowJobLog
      • workflowJobLogs
      • workflows
    • Query filters
    • Mutations
      • accountCreate
      • accountDelete
      • accountReset
      • accountSignup
      • accountUpdate
      • accountValidateAddress
      • apiAccessTokenCreate
      • apiClientCreate
      • apiClientDelete
      • apiClientSecretRenew
      • apiClientUpdate
      • approvalRuleCreate
      • approvalRuleDelete
      • approvalRuleUpdate
      • approverCreate
      • approverDelete
      • approverUpdate
      • billingDetailsUpdate
      • campaignCreate
      • campaignDelete
      • campaignUpdate
      • checkout
      • companyUpdate
      • contactCreate
      • contactDelete
      • contactUpdate
      • couponCreate
      • couponDelete
      • couponUpdate
      • creditNoteApplyToInvoices
      • creditNoteCreate
      • creditNoteDelete
      • creditNoteIssue
      • creditNoteUpdate
      • creditNoteUpdateTaxes
      • currencyCreate
      • currencyUpdate
      • currentUserUpdate
      • dealCreate
      • dealDelete
      • dealStageCreate
      • dealStageDelete
      • dealStageUpdate
      • dealUpdate
      • demoDataCreate
      • demoDataDelete
      • disputeReasonCreate
      • disputeReasonDelete
      • disputeReasonUpdate
      • emailBrandingReset
      • emailRetry
      • entityCreate
      • entityDelete
      • entityDuplicate
      • entityUpdate
      • entityValidateAddress
      • featureCreate
      • featureDelete
      • featureUpdate
      • featureUsageCreate
      • featureUsageDelete
      • featureUsageUpdate
      • fieldCreate
      • fieldDelete
      • fieldUpdate
      • financialAccountCreate
      • financialAccountDelete
      • financialAccountUpdate
      • groupCreate
      • groupDelete
      • groupUpdate
      • industryCreate
      • invoiceAddCredit
      • invoiceCredit
      • invoiceDeleteCredit
      • invoiceGenerateNextPeriod
      • invoiceRefund
      • invoiceRegenerate
      • invoiceReissue
      • invoiceRelease
      • invoiceRetryTax
      • invoiceSendEmail
      • invoiceTemplateCreate
      • invoiceTemplateDelete
      • invoiceTemplateUpdate
      • invoiceUpdate
      • invoiceUpdateComment
      • invoiceUpdateCredit
      • invoiceUpdateCredits
      • invoiceUpdateNotes
      • invoiceUpdateTaxes
      • invoiceVoid
      • invoiceWriteOff
      • leadConvert
      • leadCreate
      • leadDelete
      • leadSourceCreate
      • leadUpdate
      • legacyCreditNoteCreate
      • legacyInvoiceCreate
      • legacyPaymentCreate
      • legacyRecurringRevenueImport
      • mutationBatch
      • paymentApplyToAccount
      • paymentApplyToInvoice
      • paymentApplyToInvoices
      • paymentUnapplyFromInvoices
      • planCreate
      • planDelete
      • planDuplicate
      • planFeatureUpdate
      • planUpdate
      • platformCreate
      • platformDelete
      • platformUpdate
      • pluginCreate
      • pluginDelete
      • pluginUpdate
      • pluginValueCreate
      • pluginValueDelete
      • pluginValueUpdate
      • portalSessionCreate
      • priceListChargeCreate
      • priceListChargeDelete
      • priceListChargeUpdate
      • priceListCreate
      • priceListDelete
      • priceListDuplicate
      • priceListUpdate
      • productCategoryCreate
      • productCategoryDelete
      • productCategoryUpdate
      • productCreate
      • productDelete
      • productDuplicate
      • productImport
      • productUpdate
      • provisioningWorkflowTest
      • quoteAccept
      • quoteAccountSignup
      • quoteAddCoupon
      • quoteApplyChanges
      • quoteApplyPriceAdjustments
      • quoteApprovalCancel
      • quoteApprovalStart
      • quoteApprove
      • quoteChangeAdd
      • quoteChangeApplyPriceAdjustment
      • quoteChangeCreate
      • quoteChangeCreateRampUp
      • quoteChangeCreateRampUpPreview
      • quoteChangeDelete
      • quoteChangeDiscountCreate
      • quoteChangeRevertPriceAdjustment
      • quoteChangeUpdate
      • quoteChangeUpdateRampUp
      • quoteChargeCreate
      • quoteChargeDelete
      • quoteChargeFreeMonthsCreate
      • quoteChargeUpdate
      • quoteCompose
      • quoteCreate
      • quoteCreateWithDeal
      • quoteDelete
      • quoteDuplicate
      • quotePlanPreview
      • quotePollSigningUrl
      • quotePreview
      • quoteRecalculateTaxes
      • quoteReject
      • quoteRemoveCoupons
      • quoteSendEmail
      • quoteSigningUrlCreate
      • quoteSubscriptionReinstate
      • quoteSubscriptionRenew
      • quoteSubscriptionUpdate
      • quoteSubscriptionUpgrade
      • quoteUndo
      • quoteUnshare
      • quoteUpdate
      • roleCreate
      • roleDelete
      • roleUpdate
      • subscriptionCancel
      • subscriptionCreate
      • subscriptionDelete
      • subscriptionReinstate
      • subscriptionSetAutoRenew
      • subscriptionTenantUpdate
      • subscriptionTrialConvert
      • subscriptionTrialConvertPreview
      • subscriptionTrialExtend
      • subscriptionUpdate
      • templateUpdate
      • tenantCreate
      • tenantDelete
      • tenantMetricsUpdate
      • tenantProvisioningChangeUpdate
      • tenantUpdate
      • userCreate
      • userDelete
      • userUpdate
      • viewCreate
      • viewDelete
      • viewUpdate
      • webhookEventRetry
      • widgetTokenCreate
      • workflowCategoryCreate
      • workflowCategoryDelete
      • workflowCategoryUpdate
      • workflowCreate
      • workflowDelete
      • workflowDuplicate
      • workflowUpdate
      • workflowsDefaultCreate
    • Authorizing API requests
    • Scopes
  • Portal session token
  • Webhooks
    • Enable webhooks
    • Tenant provisioning change
    • Checkout validation
  • Bunny SDK
    • Install the SDK
    • Create a subscription
    • Track usage for billing
    • Track tenant metrics
    • Get subscription features
  • Bunny components
    • Installation
    • Components overview
  • <Signup />
  • Customer portal
    • Portal overview
    • Popup customer portal
    • Standalone customer portal
    • Signup page
  • Sample SaaS App
    • See how it's done
  • API Reference
    • Queries
      • account
      • accountBalance
      • accountBalances
      • accountType
      • accountTypes
      • accountingTable
      • accounts
      • apiClient
      • apiClients
      • approvalRule
      • approvalRules
      • approver
      • approvers
      • billRun
      • billRuns
      • billingDetails
      • campaign
      • campaigns
      • company
      • contact
      • contacts
      • coupon
      • coupons
      • creditNote
      • creditNoteItem
      • creditNoteItems
      • creditNotes
      • currencies
      • currency
      • currentUser
      • deal
      • dealStage
      • dealStages
      • deals
      • deepEvents
      • disputeReason
      • disputeReasons
      • draftCreditNotes
      • draftInvoices
      • email
      • emails
      • enabledOnlyForUsers
      • entities
      • entity
      • entityBranding
      • event
      • eventDetails
      • events
      • feature
      • featureUsage
      • featureUsageHistogram
      • featureUsages
      • features
      • field
      • fields
      • financialAccount
      • financialAccounts
      • formattedCreditNote
      • formattedInvoice
      • formattedQuote
      • group
      • groups
      • industries
      • industry
      • intracomVats
      • invoice
      • invoiceItem
      • invoiceItems
      • invoiceTemplate
      • invoiceTemplates
      • invoices
      • isolateTos
      • job
      • jobs
      • journalEntries
      • journalEntry
      • journalEntryLine
      • journalEntryLines
      • lead
      • leadSource
      • leadSources
      • leadStatus
      • leadStatuses
      • leads
      • monthlyReport
      • notification
      • notifications
      • owners
      • payment
      • paymentApplication
      • paymentApplications
      • paymentMethod
      • paymentMethods
      • paymentPlugins
      • payments
      • period
      • periods
      • plan
      • planChangeOptions
      • planFeature
      • planFeatures
      • plans
      • platform
      • platforms
      • plugin
      • pluginDefinition
      • pluginDefinitions
      • pluginEntities
      • pluginEntity
      • pluginParameter
      • pluginParameters
      • pluginVendor
      • pluginVendors
      • plugins
      • priceList
      • priceListChangeOptions
      • priceListCharge
      • priceListChargeOptions
      • priceListCharges
      • priceLists
      • product
      • productCategories
      • productCategory
      • products
      • quote
      • quoteChange
      • quoteChanges
      • quoteCharge
      • quoteCharges
      • quotes
      • recurringRevenue
      • recurringRevenues
      • revenueMovement
      • revenueMovements
      • revenueRecognitionExport
      • revenueRecognitionTable
      • role
      • roleScopes
      • roles
      • search
      • subscription
      • subscriptionCharge
      • subscriptionCharges
      • subscriptionFeatures
      • subscriptions
      • taxationEntityUseCodes
      • template
      • templates
      • tenant
      • tenantProvisioningChange
      • tenantProvisioningChanges
      • tenants
      • transaction
      • transactions
      • user
      • users
      • validCoupon
      • view
      • views
      • webhookEvent
      • webhookEvents
      • workflow
      • workflowActions
      • workflowCategories
      • workflowCategory
      • workflowJobLog
      • workflowJobLogs
      • workflows
    • Mutations
      • accountCreate
      • accountDelete
      • accountReset
      • accountSignup
      • accountUpdate
      • accountValidateAddress
      • apiAccessTokenCreate
      • apiClientCreate
      • apiClientDelete
      • apiClientSecretRenew
      • apiClientUpdate
      • approvalRuleCreate
      • approvalRuleDelete
      • approvalRuleUpdate
      • approverCreate
      • approverDelete
      • approverUpdate
      • billingDetailsUpdate
      • campaignCreate
      • campaignDelete
      • campaignUpdate
      • checkout
      • companyUpdate
      • contactCreate
      • contactDelete
      • contactUpdate
      • couponCreate
      • couponDelete
      • couponUpdate
      • creditNoteApplyToInvoices
      • creditNoteCreate
      • creditNoteDelete
      • creditNoteIssue
      • creditNoteUpdate
      • creditNoteUpdateTaxes
      • currencyCreate
      • currencyUpdate
      • currentUserUpdate
      • dealCreate
      • dealDelete
      • dealStageCreate
      • dealStageDelete
      • dealStageUpdate
      • dealUpdate
      • demoDataCreate
      • demoDataDelete
      • disputeReasonCreate
      • disputeReasonDelete
      • disputeReasonUpdate
      • emailBrandingReset
      • emailRetry
      • entityCreate
      • entityDelete
      • entityDuplicate
      • entityUpdate
      • entityValidateAddress
      • featureCreate
      • featureDelete
      • featureUpdate
      • featureUsageCreate
      • featureUsageDelete
      • featureUsageUpdate
      • fieldCreate
      • fieldDelete
      • fieldUpdate
      • financialAccountCreate
      • financialAccountDelete
      • financialAccountUpdate
      • groupCreate
      • groupDelete
      • groupUpdate
      • industryCreate
      • invoiceAddCredit
      • invoiceCredit
      • invoiceDeleteCredit
      • invoiceGenerateNextPeriod
      • invoiceRefund
      • invoiceRegenerate
      • invoiceReissue
      • invoiceRelease
      • invoiceRetryTax
      • invoiceSendEmail
      • invoiceTemplateCreate
      • invoiceTemplateDelete
      • invoiceTemplateUpdate
      • invoiceUpdate
      • invoiceUpdateComment
      • invoiceUpdateCredit
      • invoiceUpdateCredits
      • invoiceUpdateNotes
      • invoiceUpdateTaxes
      • invoiceVoid
      • invoiceWriteOff
      • leadConvert
      • leadCreate
      • leadDelete
      • leadSourceCreate
      • leadUpdate
      • legacyCreditNoteCreate
      • legacyInvoiceCreate
      • legacyPaymentCreate
      • legacyRecurringRevenueImport
      • mutationBatch
      • paymentApplyToAccount
      • paymentApplyToInvoice
      • paymentApplyToInvoices
      • paymentUnapplyFromInvoices
      • planCreate
      • planDelete
      • planDuplicate
      • planFeatureUpdate
      • planUpdate
      • platformCreate
      • platformDelete
      • platformUpdate
      • pluginCreate
      • pluginDelete
      • pluginUpdate
      • pluginValueCreate
      • pluginValueDelete
      • pluginValueUpdate
      • portalSessionCreate
      • priceListChargeCreate
      • priceListChargeDelete
      • priceListChargeUpdate
      • priceListCreate
      • priceListDelete
      • priceListDuplicate
      • priceListUpdate
      • productCategoryCreate
      • productCategoryDelete
      • productCategoryUpdate
      • productCreate
      • productDelete
      • productDuplicate
      • productImport
      • productUpdate
      • provisioningWorkflowTest
      • quoteAccept
      • quoteAccountSignup
      • quoteAddCoupon
      • quoteApplyChanges
      • quoteApplyPriceAdjustments
      • quoteApprovalCancel
      • quoteApprovalStart
      • quoteApprove
      • quoteChangeAdd
      • quoteChangeApplyPriceAdjustment
      • quoteChangeCreate
      • quoteChangeCreateRampUp
      • quoteChangeCreateRampUpPreview
      • quoteChangeDelete
      • quoteChangeDiscountCreate
      • quoteChangeRevertPriceAdjustment
      • quoteChangeUpdate
      • quoteChangeUpdateRampUp
      • quoteChargeCreate
      • quoteChargeDelete
      • quoteChargeFreeMonthsCreate
      • quoteChargeUpdate
      • quoteCompose
      • quoteCreate
      • quoteCreateWithDeal
      • quoteDelete
      • quoteDuplicate
      • quotePlanPreview
      • quotePollSigningUrl
      • quotePreview
      • quoteRecalculateTaxes
      • quoteReject
      • quoteRemoveCoupons
      • quoteSendEmail
      • quoteSigningUrlCreate
      • quoteSubscriptionReinstate
      • quoteSubscriptionRenew
      • quoteSubscriptionUpdate
      • quoteSubscriptionUpgrade
      • quoteUndo
      • quoteUnshare
      • quoteUpdate
      • roleCreate
      • roleDelete
      • roleUpdate
      • subscriptionCancel
      • subscriptionCreate
      • subscriptionDelete
      • subscriptionReinstate
      • subscriptionSetAutoRenew
      • subscriptionTenantUpdate
      • subscriptionTrialConvert
      • subscriptionTrialConvertPreview
      • subscriptionTrialExtend
      • subscriptionUpdate
      • templateUpdate
      • tenantCreate
      • tenantDelete
      • tenantMetricsUpdate
      • tenantProvisioningChangeUpdate
      • tenantUpdate
      • userCreate
      • userDelete
      • userUpdate
      • viewCreate
      • viewDelete
      • viewUpdate
      • webhookEventRetry
      • widgetTokenCreate
      • workflowCategoryCreate
      • workflowCategoryDelete
      • workflowCategoryUpdate
      • workflowCreate
      • workflowDelete
      • workflowDuplicate
      • workflowUpdate
      • workflowsDefaultCreate
    • Types
      • Account
      • AccountAttributes
      • AccountBalance
      • AccountBalanceConnection
      • AccountBalanceEdge
      • AccountConnection
      • AccountEdge
      • AccountType
      • AccountTypeConnection
      • AccountTypeEdge
      • AccountingTable
      • AccountingTableCell
      • AccountingTableRow
      • ApiClient
      • ApiClientAttributes
      • ApiClientConnection
      • ApiClientEdge
      • ApprovalDecision
      • ApprovalRequest
      • ApprovalRule
      • ApprovalRuleAttributes
      • ApprovalRuleConnection
      • ApprovalRuleEdge
      • Approver
      • ApproverAttributes
      • ApproverConnection
      • ApproverEdge
      • Attachment
      • BatchMutation
      • BatchMutationAttributes
      • BillRun
      • BillRunConnection
      • BillRunEdge
      • BillingCycle
      • BillingDetails
      • BillingDetailsAttributes
      • BillingPeriodAmount
      • Campaign
      • CampaignAttributes
      • CampaignConnection
      • CampaignEdge
      • CheckoutPaymentMethodAttributes
      • Company
      • CompanyAttributes
      • Contact
      • ContactAttributes
      • ContactConnection
      • ContactEdge
      • Coupon
      • CouponAttributes
      • CouponConnection
      • CouponEdge
      • CouponValidate
      • CreditItemAttributes
      • CreditNote
      • CreditNoteAttributes
      • CreditNoteConnection
      • CreditNoteEdge
      • CreditNoteItem
      • CreditNoteItemAttributes
      • CreditNoteItemConnection
      • CreditNoteItemEdge
      • Currency
      • CurrencyAttributes
      • CurrencyConnection
      • CurrencyEdge
      • CurrentUser
      • CurrentUserAttributes
      • DateOption
      • Deal
      • DealAttributes
      • DealConnection
      • DealEdge
      • DealStage
      • DealStageAttributes
      • DealStageConnection
      • DealStageEdge
      • DisputeReason
      • DisputeReasonAttributes
      • DisputeReasonConnection
      • DisputeReasonEdge
      • Document
      • DynamicComponentAttributes
      • Email
      • EmailConnection
      • EmailEdge
      • EmailRecipient
      • Entity
      • EntityAttributes
      • EntityBranding
      • EntityConnection
      • EntityEdge
      • Event
      • EventConnection
      • EventDetail
      • EventDetailChange
      • EventDetailItem
      • EventEdge
      • Feature
      • FeatureAttributes
      • FeatureConnection
      • FeatureEdge
      • FeatureUsage
      • FeatureUsageAttributes
      • FeatureUsageConnection
      • FeatureUsageEdge
      • Field
      • FieldAttributes
      • FieldConnection
      • FieldEdge
      • FieldValue
      • FinancialAccount
      • FinancialAccountAttributes
      • FinancialAccountConnection
      • FinancialAccountEdge
      • FormattedChargePriceTier
      • FormattedCreditNote
      • FormattedInvoice
      • FormattedLine
      • FormattedQuote
      • Group
      • GroupAttributes
      • GroupConnection
      • GroupEdge
      • Histogram
      • HistogramData
      • HistogramDataInterval
      • Industry
      • IndustryAttributes
      • IndustryConnection
      • IndustryEdge
      • IntracomVat
      • IntracomVatConnection
      • IntracomVatEdge
      • Invoice
      • InvoiceAttributes
      • InvoiceConnection
      • InvoiceEdge
      • InvoiceItem
      • InvoiceItemConnection
      • InvoiceItemEdge
      • InvoiceMessage
      • InvoiceTemplate
      • InvoiceTemplateAttributes
      • InvoiceTemplateConnection
      • InvoiceTemplateEdge
      • InvoiceUpdateCreditsAttributes
      • Job
      • JobConnection
      • JobEdge
      • JournalEntry
      • JournalEntryConnection
      • JournalEntryEdge
      • JournalEntryLine
      • JournalEntryLineConnection
      • JournalEntryLineEdge
      • Lead
      • LeadAttributes
      • LeadConnection
      • LeadEdge
      • LeadSource
      • LeadSourceAttributes
      • LeadSourceConnection
      • LeadSourceEdge
      • LeadStatus
      • LeadStatusConnection
      • LeadStatusEdge
      • LegacyCreditNoteAttributes
      • LegacyInvoiceAttributes
      • Macro
      • Method
      • MonthlyReport
      • MonthlyReportAccount
      • MonthlyReportCategory
      • NotificationConnection
      • NotificationEdge
      • Output
      • PageInfo
      • Payment
      • PaymentApplication
      • PaymentApplicationConnection
      • PaymentApplicationEdge
      • PaymentAttributes
      • PaymentConnection
      • PaymentEdge
      • PaymentMethod
      • PaymentMethodConnection
      • PaymentMethodEdge
      • PaymentMethodMetadata
      • PaymentPlugin
      • Period
      • PeriodAmount
      • PeriodConnection
      • PeriodEdge
      • Plan
      • PlanAttributes
      • PlanChangeOptions
      • PlanConnection
      • PlanEdge
      • PlanFeature
      • PlanFeatureAttributes
      • PlanFeatureConnection
      • PlanFeatureEdge
      • Platform
      • PlatformAttributes
      • PlatformConnection
      • PlatformEdge
      • Plugin
      • PluginActionMenuItem
      • PluginAttributes
      • PluginConnection
      • PluginDefinition
      • PluginDefinitionConnection
      • PluginDefinitionEdge
      • PluginEdge
      • PluginEntity
      • PluginEntityConnection
      • PluginEntityEdge
      • PluginParameter
      • PluginParameterConnection
      • PluginParameterEdge
      • PluginValue
      • PluginValueAttributes
      • PluginVendor
      • PluginVendorConnection
      • PluginVendorEdge
      • PriceList
      • PriceListAttributes
      • PriceListChangeOptions
      • PriceListCharge
      • PriceListChargeAttributes
      • PriceListChargeConnection
      • PriceListChargeDefault
      • PriceListChargeEdge
      • PriceListChargeOptions
      • PriceListChargeTier
      • PriceListChargeTierAttributes
      • PriceListConnection
      • PriceListEdge
      • Product
      • ProductAttributes
      • ProductCategory
      • ProductCategoryAttributes
      • ProductCategoryConnection
      • ProductCategoryEdge
      • ProductConnection
      • ProductEdge
      • Quote
      • QuoteAttributes
      • QuoteChange
      • QuoteChangeConnection
      • QuoteChangeEdge
      • QuoteCharge
      • QuoteChargeAttributes
      • QuoteChargeConnection
      • QuoteChargeEdge
      • QuoteConnection
      • QuoteEdge
      • QuoteLine
      • QuotePlan
      • QuotePlanPreview
      • QuotePriceTier
      • QuotePriceTierAttributes
      • RecurringRevenue
      • RecurringRevenueConnection
      • RecurringRevenueEdge
      • RelatedObject
      • RenewalTermOption
      • RevenueMovement
      • RevenueMovementConnection
      • RevenueMovementEdge
      • RevenueRecognitionAccount
      • RevenueRecognitionDateLabel
      • RevenueRecognitionDocument
      • RevenueRecognitionExport
      • RevenueRecognitionExportRow
      • RevenueRecognitionItem
      • RevenueRecognitionMonths
      • RevenueRecognitionTable
      • Role
      • RoleAttributes
      • RoleConnection
      • RoleEdge
      • RoleScope
      • RoleScopeConnection
      • RoleScopeEdge
      • SearchResult
      • Subscription
      • SubscriptionAttributes
      • SubscriptionCharge
      • SubscriptionChargeConnection
      • SubscriptionChargeEdge
      • SubscriptionConnection
      • SubscriptionEdge
      • SubscriptionPriceTier
      • SubscriptionTenantUpdateAttributes
      • SubscriptionTieredPrice
      • TaxationEntityUseCode
      • Template
      • TemplateAttributes
      • TemplateConnection
      • TemplateEdge
      • Tenant
      • TenantAttributes
      • TenantConnection
      • TenantEdge
      • TenantMetricsAttributes
      • TenantProvisioningChange
      • TenantProvisioningChangeAttributes
      • TenantProvisioningChangeConnection
      • TenantProvisioningChangeEdge
      • TieredAmount
      • Transaction
      • TransactionConnection
      • TransactionEdge
      • UsageSubscriptionCharge
      • UsageSubscriptionChargeConnection
      • UsageSubscriptionChargeEdge
      • User
      • UserAttributes
      • UserConnection
      • UserEdge
      • UserProfile
      • UserProfileAttributes
      • View
      • ViewAttributes
      • ViewConnection
      • ViewEdge
      • WebPushAttributes
      • WebhookEvent
      • WebhookEventConnection
      • WebhookEventEdge
      • Workflow
      • WorkflowAction
      • WorkflowAttributes
      • WorkflowCategory
      • WorkflowCategoryAttributes
      • WorkflowCategoryConnection
      • WorkflowCategoryEdge
      • WorkflowConnection
      • WorkflowEdge
      • WorkflowJobLog
      • WorkflowJobLogConnection
      • WorkflowJobLogEdge
    • Enums
Powered by GitBook
On this page
  • Generate an Access Token
  • Set an authorization header
  • Handling expired access tokens

Was this helpful?

Edit on GitHub
  1. Using the GraphQL API

Authorizing API requests

PreviousworkflowsDefaultCreateNextScopes

Last updated 1 month ago

Was this helpful?

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

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. .

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 --location --request POST 'https://<subdomain>.bunny.com/oauth/token' \
--form 'grant_type="client_credentials"' \
--form 'scope="standard:read standard:write"' \
--form 'client_id="<client_id>"' \
--form 'client_secret="<client_secret>"'
require "uri"
require "net/http"

url = URI("https://<subdomain>.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_id>'],
    ['client_secret', '<client_secret>']
]
request.set_form form_data, 'multipart/form-data'
response = https.request(request)
puts response.read_body
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", "<client_id>");
formdata.append("client_secret", "<client_secret>");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://<subdomain>.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.

Success! An access token is returned.

{
    "access_token": "eyJraWQiOiJPRFNuNWpnd2pESmRJdmxfTERiYmNJTkdKcTVITHo5cEhxN292NGVsb3VZIiwiYWxnIjoiSFM1MTIifQ.eyJpc3MiOiJCbGFoIEJsYWgiLCJpYXQiOjE2NTMwOTk3NDUsImp0aSI6ImFkYjliMzY5LWJiYmMtNGU1MC1iNjdjLWE1NGU5MDZjY2I5ZCIsImNsaWVudF9pZCI6Ik9EU241amd3akRKZEl2bF9MRGJiY0lOR0pxNUhMejlwSHE3b3Y0ZWxvdVkiLCJhdWQiOiJodHRwczovL2J1bm55LmludGVybmFsIiwiZXhwIjoxNjUzMTA2OTQ1LCJzY29wZSI6IiIsInN1YiI6ImM2MTBkOTFhLWQwZDUtNDQxMi1iZTE2LWQzNWQyNjVmOTRhZCJ9.tHN1jOMYojDSbg3ryrWqu4GBCUQhIqq2mRa_heXUDDHqomTFjUoPRFMmInz4X8orIdPy4Zzxu_UsoT1MZf7_iQ",
    "token_type": "Bearer",
    "expires_in": 7200,
    "created_at": 1653099745
}

You've likely requested a scope that is not approved for this API client application

{
    "error": "invalid_scope",
    "error_description": "The requested scope is invalid, unknown, or malformed."
}

The grant_type must be client_credentials

{
    "error": "unsupported_grant_type",
    "error_description": "The authorization grant type is not supported by the authorization server."
}

Either the client_id or client_secret has been entered incorrectly or the API client has been deleted.

{
    "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 --location --request POST 'https://<subdomain>.bunny.com/graphql' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query accounts ($filter: String, $limit: Int) {\n    accounts (filter: $filter, limit: $limit) {\n        id \n        name\n    }\n}","variables":{"filter":"","limit":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.

[
    {
        "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.

Generate an access token
Include the access token in an authorization header
Handle expired access tokens
If you don't have an API client application setup yet then follow these steps