> For the complete documentation index, see [llms.txt](https://docs.hypersolutions.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hypersolutions.co/api-reference/usage-statistics.md).

# Usage & Status Codes

Check your remaining quota with the Usage API, and understand the HTTP status codes the Hyper Solutions API returns.

### Checking your usage

Use the Usage API to monitor your remaining quota and consumption:

## Get usage statistics

> Retrieves detailed usage statistics for all products and plans associated with the API key

```json
{"openapi":"3.0.0","info":{"title":"JustHyped Usage Statistics API","version":"1.0.0"},"servers":[{"url":"https://api.hypersolutions.co","description":"Main server for usage statistics"}],"paths":{"/usage":{"get":{"summary":"Get usage statistics","description":"Retrieves detailed usage statistics for all products and plans associated with the API key","operationId":"getUsageStatistics","parameters":[{"in":"header","name":"x-api-key","required":true,"schema":{"type":"string"},"description":"Your API key for authentication"}],"responses":{"200":{"description":"OK Usage statistics successfully retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"balanceEuro":{"type":"number","format":"float","description":"Current balance in Euros"},"plans":{"type":"array","description":"List of plans with their usage statistics","items":{"type":"object","properties":{"expiresAt":{"type":"string","format":"date-time","description":"ISO 8601 date when this plan expires"},"requestsUsed":{"type":"integer","description":"Number of requests used from this plan"},"requestsQuota":{"type":"integer","description":"Total number of requests allocated to this plan"},"requestsRemaining":{"type":"integer","description":"Number of requests remaining (quota - used)"},"product":{"type":"string","description":"Name of the product (e.g., \"akamai\", \"datadome\", \"incapsula\")"},"numRequests":{"type":"integer","description":"Total number of requests for this plan"}}}}}}}}},"401":{"description":"Unauthorized - API key is missing or invalid","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}},"403":{"description":"Forbidden - API key is disabled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}}}}}}}
```

#### Checking a key for an organization

Organization software can send `x-app-key` and `x-app-signature` along with `x-api-key`. `/usage` then checks the key against the organization, the same way the API does before serving a request. You can use this to validate a key before sending real requests.

The signature is checked before membership. A key that isn't in the organization only gets `not_organization_member` once the request is correctly signed.

| Status | `code`                                                                        | Means                                                                                   |
| ------ | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `401`  | [`missing_app_signature`](/api-reference/errors.md#missing_app_signature)     | `x-app-key` is set but `x-app-signature` is missing                                     |
| `401`  | [`invalid_app_key`](/api-reference/errors.md#invalid_app_key)                 | No organization has this `x-app-key`                                                    |
| `401`  | [`invalid_app_signature`](/api-reference/errors.md#invalid_app_signature)     | `x-app-signature` does not verify against the organization's app secret, or has expired |
| `403`  | [`not_organization_member`](/api-reference/errors.md#not_organization_member) | The account the API key belongs to is not a member of the organization                  |

These responses have the same `error`, `code` and `docs` fields as the API's own refusals.

Without organization headers, `/usage` checks only the API key itself, with the same codes as the API:

* `401` [`missing_api_key`](/api-reference/errors.md#missing_api_key), [`malformed_api_key`](/api-reference/errors.md#malformed_api_key) or [`invalid_api_key`](/api-reference/errors.md#invalid_api_key) when the key is missing, not a valid UUID, or does not exist.
* `403` [`api_key_disabled`](/api-reference/errors.md#api_key_disabled) when the key is disabled.

### Status codes

These are the responses the Hyper Solutions API itself returns:

| Status | Means                                                               | Fix                                                                                                                                                           |
| ------ | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200`  | Payload generated successfully                                      | Replay the returned payload and `headers` object on the target                                                                                                |
| `401`  | Missing or invalid API key, organization key or signature           | Check the `x-api-key` header and your key at [hypersolutions.co/keys](https://hypersolutions.co/keys). See [Authentication](/api-reference/authentication.md) |
| `402`  | No plan or pay-as-you-go balance left for this product              | Buy or renew a plan, or top up your balance                                                                                                                   |
| `403`  | Key disabled, product not enabled, or target domain not whitelisted | Fix what the error message names                                                                                                                              |

Refusals for `401`, `402` and `403` carry a `code` naming the exact reason; [Errors](/api-reference/errors.md) lists every code and its fix.

{% hint style="info" %}
Compress your request bodies, some sensor payloads are large. The SDKs auto-compress bodies over 1000 bytes. See [Compression](/api-reference/compression.md).
{% endhint %}
