# get\_\_user\_quota

`GET /user/quota`

*Get Current User Quota and Usage*

Retrieve the current organization's active subscription information and quota usage for all capabilities associated with that subscription.

#### TypeScript Client Library

```typescript
public getUserQuota = async (): Promise<QuotaResponse> => {
  return this.makeRequest<QuotaResponse>('user/quota', 'GET', null);
};
```

#### Code Samples

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

```shell
# You can also use wget
curl -X GET https://backend.flashback.tech/user/quota \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
GET https://backend.flashback.tech/user/quota HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/user/quota',
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get 'https://backend.flashback.tech/user/quota',
  params: {
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('https://backend.flashback.tech/user/quota', headers = headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://backend.flashback.tech/user/quota', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/user/quota");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{})
    req, err := http.NewRequest("GET", "https://backend.flashback.tech/user/quota", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

> Example responses

> 200 Response

```json
{
  "success": true,
  "subscription": {
    "id": "sub_123",
    "name": "Pro",
    "description": "Pro subscription"
  },
  "quotaUsage": [
    {
      "capability": {
        "id": "cap_001",
        "code": "STORAGE_TOTAL_BYTES",
        "description": "Total storage available in bytes",
        "type": "STORAGE",
        "periodType": "ALL_TIME"
      },
      "usage": {
        "current": 5368709120,
        "max": 10737418240,
        "percentage": 50
      }
    },
    {
      "capability": {
        "id": "cap_002",
        "code": "EGRESS_MONTHLY_BYTES",
        "description": "Monthly egress in bytes",
        "type": "TRAFFIC",
        "periodType": "MONTHLY"
      },
      "usage": {
        "current": 123456789,
        "max": 2147483648,
        "percentage": 6
      }
    }
  ]
}
```

> 401 Response

```json
{
  "success": false,
  "error_code": "NO_AUTH_USER"
}
```

> 404 Response

```json
{
  "success": false,
  "error_code": "NO_ACTIVE_SUBSCRIPTION"
}
```

> 500 Response

```json
{
  "success": false,
  "error_code": "INTERNAL_ERROR",
  "message": "Database connection failed"
}
```

#### Responses <a href="#get__user_quota-responses" id="get__user_quota-responses"></a>

| Status | Meaning                                                                    | Description                               | Schema |
| ------ | -------------------------------------------------------------------------- | ----------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Quota and usage retrieved successfully    | Inline |
| 401    | [Unauthorized](https://www.rfc-editor.org/rfc/rfc7235)                     | Authentication required or user not found | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)             | No active subscription                    | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal server error                     | Inline |

#### Response Schema <a href="#get__user_quota-responseschema" id="get__user_quota-responseschema"></a>

Status Code **200**

| Name            | Type      | Required | Restrictions | Description                                  |
| --------------- | --------- | -------- | ------------ | -------------------------------------------- |
| » success       | boolean   | false    | none         | Indicates if the request was successful      |
| » subscription  | object    | false    | none         | Active subscription info                     |
| »» id           | string    | false    | none         | Subscription identifier                      |
| »» name         | string    | false    | none         | Subscription name                            |
| »» description  | string    | false    | none         | Subscription description                     |
| » quotaUsage    | \[object] | false    | none         | Array of capability usage entries            |
| »» capability   | object    | false    | none         | Capability metadata                          |
| »»» id          | string    | false    | none         | Capability identifier                        |
| »»» code        | string    | false    | none         | Capability code                              |
| »»» description | string    | false    | none         | Capability description                       |
| »»» type        | string    | false    | none         | Capability type (e.g., 'STORAGE', 'TRAFFIC') |
| »»» periodType  | string    | false    | none         | Period type for quota accounting             |
| »» usage        | object    | false    | none         | Usage details                                |
| »»» current     | number    | false    | none         | Current usage value                          |
| »»» max         | number    | false    | none         | Maximum allowed usage                        |
| »»» percentage  | number    | false    | none         | Usage percentage (0-100)                     |

Status Code **401**

| Name          | Type    | Required | Restrictions | Description                             |
| ------------- | ------- | -------- | ------------ | --------------------------------------- |
| » success     | boolean | false    | none         | Indicates if the request was successful |
| » error\_code | string  | false    | none         | Error code, e.g., `NO_AUTH_USER`        |

Status Code **404**

| Name          | Type    | Required | Restrictions | Description                                |
| ------------- | ------- | -------- | ------------ | ------------------------------------------ |
| » success     | boolean | false    | none         | Indicates if the request was successful    |
| » error\_code | string  | false    | none         | Error code, e.g., `NO_ACTIVE_SUBSCRIPTION` |

Status Code **500**

| Name          | Type    | Required | Restrictions | Description                             |
| ------------- | ------- | -------- | ------------ | --------------------------------------- |
| » success     | boolean | false    | none         | Indicates if the request was successful |
| » error\_code | string  | false    | none         | Error code, e.g., `INTERNAL_ERROR`      |
| » message     | string  | false    | none         | Detailed error information              |

**Enumerated Values**

| Parameter    | Value     | Description              |
| ------------ | --------- | ------------------------ |
| » periodType | ALL\_TIME | No reset; lifetime quota |
| » periodType | DAILY     | Resets daily             |
| » periodType | WEEKLY    | Resets weekly            |
| » periodType | MONTHLY   | Resets monthly           |
| » periodType | YEARLY    | Resets yearly            |


---

# 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.flashback.tech/support-reference/platform-api-reference/user-account/get__user_quota.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.
