# Get subscription features

To get the active subscriptions with usage quantities and features that a tenant is entitled to use you can query the [tenant object](/developer/api-reference/types/tenant.md).

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

{% tabs %}
{% tab title="GraphQL" %}

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

**Variables**

```json
{
  "code": "tenant-553"
}
```

{% endtab %}

{% tab title="Curl" %}
{% code overflow="wrap" %}

```bash
curl --location 'https://bunny.bunny.internal/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--data '{"query":"query tenant ($code: String!) {\n  tenant (code: $code) {\n    id    \n    code    \n    name    \n    subdomain\n    latestProvisioningChange {\n        change\n        createdAt\n        features\n        id\n        updatedAt\n    }    \n  }\n}","variables":{"code":"orange-553"}}'
```

{% endcode %}
{% endtab %}

{% tab title="Node.js" %}

```javascript
let query = `query tenant ($code: String!) {
  tenant (code: $code) {
    id    
    code    
    name    
    subdomain
    latestProvisioningChange {
        change
        createdAt
        features
        id
        updatedAt
    }    
  }
}`;

let variables = {
  "code": "tenant-553"
};

let res = await bunny.query(query, variables);
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
query = <<-'GRAPHQL'
query tenant ($code: String!) {
  tenant (code: $code) {
    id    
    code    
    name    
    subdomain
    latestProvisioningChange {
        change
        createdAt
        features
        id
        updatedAt
    }    
  }
}
GRAPHQL

variables = {
  "code": "tenant-553"
}

response = BunnyApp.query(query, variables)
```

{% endtab %}
{% endtabs %}

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

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "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"
            }
        }
    }
}
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bunny.com/developer/bunny-sdk/get-subscription-features.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
