> ## Documentation Index
> Fetch the complete documentation index at: https://help.b2proxy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sub-user Traffic Consumption Query API

<Note>
  Users need to have the available traffic of the residential proxies to call this function.
</Note>

## **1、Query data usage (by time range)**

**This API is used to query detailed traffic consumption records within a specified time range; “st” and “et” represent UTC seconds.**

### **API URL**

/wapi/consume/chart/

### **Request Method**

GET

### **Content-Type**

none

###  Request Header Parameter

| Parameter Name | Example Value      | Parameter Type | Is this field    required | Parametric Description                       |
| :------------- | :----------------- | :------------- | :------------------------ | :------------------------------------------- |
| Authorization  | Bearer \{\{token}} | string         | Yes                       | JWT authentication – Format: Bearer \{token} |

### **Request Query Parameter**

| Parameter Name | Example Value | Parameter Type | Is this field required | Parametric Description                  |
| :------------- | :------------ | :------------- | :--------------------- | :-------------------------------------- |
| suname         | -             | string         | No                     | Sub-user username (optional)            |
| st             | 0             | integer        | No                     | Start timestamp (UTC seconds), optional |
| et             | 0             | integer        | No                     | End timestamp (UTC seconds), optional   |

### **Authentication Method**

Bearer Token

Add an Authorization parameter to the header; its value is the access token concatenated with a space after the "Bearer" prefix.

Authorization: Bearer your\_access\_token

### **Response Example**

• Sucess(200)

```json theme={null}
{
 "code":200,
 "message":"sucess.",
 "results":[
  {
    "period":"2026-08-19T00:00:00+08:00",
    "timestamp":0,
    "total_traffic_count":0
   }
  ]
}
```

• Not logged in or authentication failed(403)

```json theme={null}
{
 "code":403,
 "message":"unauthorized",
 "results":null
}
```

## **2、Obtain an API token**

**Exchange user account credentials for a WAPI token. This API does not perform Bearer token validation.**

### **API URL**

/wapi/token/

### **Request Method**

POST

### **Content-Type**

json

###  Request Header Parameter

| Parameter Name | Example Value    | Parameter Type | Is this field required | Parametric Description |
| :------------- | :--------------- | :------------- | :--------------------- | :--------------------- |
| Content-Type   | application/json | string         | Yes                    | Content Type           |

### **Request Body Parameter**

```json theme={null}
{
 "passwd":"2468",
 "sig":"0d32dfeb0abbc13769a83e4b39248df4",
 "ts":"1787109010",
 "username":"user@example.com"
}
```

| Parameter Name | Example Value                               | Parameter Type | Is this field      required | Parametric Description                                                                      |
| :------------- | :------------------------------------------ | :------------- | :-------------------------- | :------------------------------------------------------------------------------------------ |
| username       | [user@example.com](mailto:user@example.com) | string         | Yes                         | User email account                                                                          |
| passwd         | 2468                                        | string         | Yes                         | The string obtained by splitting the password into characters based on their odd positions. |

### **Response Example**

• Sucess(200)

```json theme={null}
{
 "code":200,
 "message":"sucess.",
 "results":{
  "token":"3a0f1f6b9c7f4f69a4f8a3d6"
 }
}
```

• Incorrect username or password(41003)

```json theme={null}
{
 "code":41003,
 "message":"username or passwd error.",
 "results":null
}
```
