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 get the active subscriptions with usage quantities and features that a tenant is entitled to use you can query the tenant object.

Query

To query the tenant object use the unique code that you assigned for the tenant. The code will typically be the unique identifier for that tenant in your SaaS application.

query tenant ($code: String!) {
  tenant (code: $code) {
    id    
    code    
    name    
    subdomain
    latestProvisioningChange {
        change
        createdAt
        features
        id
        updatedAt
    }    
  }
}

Variables

{
  "code": "tenant-553"
}

Response

The response will include a lastProvisioningChange section that shows exactly what features and quantities the tenant is entitled to.

It is possible in Bunny for a tenant to subscribe to multiple different products, therefore having multiple subscriptions.

In most cases a tenant will only have a single subscription but as best practice we recommend using the `latestProvisioningChange.change.features` section of the response payload to get all of the features and quantities combined across all subscriptions for the tenant.

{
    "data": {
        "tenant": {
            "id": "418",
            "code": "tenant-553",
            "name": "Superdesk",
            "subdomain": null,
            "account": {
                "id": 48,
                "name": "Superdesk",
                "billing_day": 14,
            },
            "latestProvisioningChange": {
                "change": {
                    "features": [
                        {
                            "code": "workflows",
                            "name": "Workflows",
                            "value": "custom",
                            "quantity": null,
                            "plan": {
                                "code": "super_product",
                                "name": "Super Product"
                            },
                            "price_list": {
                                "code": "super_product_monthly",
                                "name": "Monthly"
                            }
                        },
                        {
                            "code": "users",
                            "name": "Users",
                            "value": null,
                            "quantity": 50,
                            "plan": {
                                "code": "super_product",
                                "name": "Super Product"
                            },
                            "price_list": {
                                "code": "super_product_monthly",
                                "name": "Monthly"
                            }
                        },
                        {
                            "code": "crm",
                            "name": "Crm",
                            "value": null,
                            "quantity": null,
                            "plan": {
                                "code": "super_product",
                                "name": "Super Product"
                            },
                            "price_list": {
                                "code": "super_product_monthly",
                                "name": "Monthly"
                            }
                        }
                    ],
                    "subscriptions": [
                        {
                            "state": "active",
                            "start_date": "2023-05-16",
                            "end_date": "2024-05-15",
                            "trial_start_date": null,
                            "trial_end_date": null,
                            "plan": {
                                "code": "super_product",
                                "name": "Super Product"
                            },
                            "price_list": {
                                "code": "super_product_monthly",
                                "name": "Monthly"
                            }
                            "features": [
                                {
                                    "code": "workflows",
                                    "name": "Workflows",
                                    "value": "custom",
                                    "quantity": null
                                },
                                {
                                    "code": "users",
                                    "name": "Users",
                                    "value": null,
                                    "quantity": 50
                                },
                                {
                                    "code": "crm",
                                    "name": "Crm",
                                    "value": null,
                                    "quantity": null
                                }
                            ]
                        }
                    ]
                },
                "createdAt": "2023-05-16T07:06:11-07:00",
                "features": "Workflows, Users, Crm",
                "id": "542",
                "updatedAt": "2023-05-16T07:06:11-07:00"
            }
        }
    }
}

Last updated

Was this helpful?