> For the complete documentation index, see [llms.txt](https://docs.goproxies.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.goproxies.com/proxies/resellers-api-v3/how-it-works.md).

# How it works

Accounts, subscriptions, sub-users and quotas.

## Data model

```mermaid
erDiagram
    ACCOUNT ||--o{ SUBSCRIPTION : "0..N"
    SUBSCRIPTION ||--o{ SUB_USER : "0..N"
    SUB_USER ||--o| SUB_USER_QUOTA : "0..1"
```

* **Account**: you, the reseller. One login for the whole API.
* **Subscription**: one per purchased product (residential, mobile, ...). Has its own traffic quota, period and sub-user limit.
* **Sub-user**: a proxy user that draws traffic from exactly one subscription.
* **Sub-user quota** (optional): a personal cap for one sub-user. See [Sub-user quotas](#sub-user-quotas).

## Limits

A request through a sub-user is allowed only if every applicable limit has room:

```mermaid
flowchart LR
    R[Request] --> S{Subscription active<br/>and quota left?}
    S -- no --> X[Blocked]
    S -- yes --> Q{Sub-user has a quota?}
    Q -- no --> OK[Allowed]
    Q -- yes --> U{Quota left and<br/>period valid?}
    U -- yes --> OK
    U -- no --> X
```

All sub-users of a subscription share its quota. A sub-user quota only adds a cap; it never extends the subscription.

## Blocked reasons

| `blocked_reason`        | Meaning                                                                                    |
| ----------------------- | ------------------------------------------------------------------------------------------ |
| `USER_DISABLED`         | Sub-user disabled by you                                                                   |
| `USER_QUOTA_EXCEEDED`   | Sub-user or subscription quota used up, or a non-recurring sub-user quota period has ended |
| `SUBSCRIPTION_INACTIVE` | Subscription expired or cancelled                                                          |
| `SUBSCRIPTION_MISSING`  | Subscription no longer exists                                                              |
| `PARENT_BLOCKED`        | Your account is blocked                                                                    |

## Usage

`quota_used_gb` on a sub-user is its traffic in the current period: the sub-user quota period if it has one, otherwise the subscription period. Refreshed every few minutes.

## Sub-user quotas

A sub-user quota caps one sub-user on top of its subscription. Manage it with `/api/v3/reseller/subuser-quotas`.

### Settings

| Field             | Meaning                                                                |
| ----------------- | ---------------------------------------------------------------------- |
| `quota_gb`        | Cap in GB, greater than 0                                              |
| `period_start_at` | Start of the current period. Default now; not in the future            |
| `period_seconds`  | Period length, at least 3600. Omit for a lifetime quota                |
| `recurring`       | Start a new period automatically when one ends. Needs `period_seconds` |

### Modes

{% tabs %}
{% tab title="Lifetime" %}
Counts all traffic since `period_start_at` (up to 450 days back).

```json
{"subuser_id": "SUBUSER_ID", "quota_gb": 50}
```

{% endtab %}

{% tab title="One-off period" %}
Counts traffic within one period. After it ends the sub-user stays blocked until you change or remove the quota.

```json
{"subuser_id": "SUBUSER_ID", "quota_gb": 10, "period_seconds": 604800}
```

{% endtab %}

{% tab title="Recurring" %}
Counts traffic per period and starts a new one automatically; each new period counts only its own traffic.

```json
{"subuser_id": "SUBUSER_ID", "quota_gb": 5, "period_seconds": 86400, "recurring": true}
```

{% endtab %}
{% endtabs %}

### Lifecycle

```mermaid
stateDiagram-v2
    [*] --> Active: create
    Active --> Blocked: used ≥ quota_gb<br/>or one-off period ended
    Blocked --> Active: renewal (recurring)<br/>or raise quota_gb / change period
    Active --> [*]: delete
    Blocked --> [*]: delete
```

### Rules

* Usage is the sub-user's traffic from `period_start_at` until now (at most `period_seconds`). Changing `period_start_at` or `period_seconds` recalculates it for the new window, so it can go down or up (e.g. moving the start back counts older traffic). Changing `quota_gb` or `recurring` keeps current usage.
* `PATCH` with `period_seconds: 0` turns the quota into a lifetime quota.
* A blocked sub-user shows `blocked: true` and `blocked_reason: USER_QUOTA_EXCEEDED`.
* A quota larger than the subscription quota is allowed; the subscription limit applies first.
* Sub-users that still have a legacy API traffic limit can't get a quota (`409 legacy_limit`); remove the legacy limit first.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.goproxies.com/proxies/resellers-api-v3/how-it-works.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
