Authentication and Calling Conventions
Authentication Method
The Public API uses two-step authentication:
- First, call the token endpoint with your registered email + API Key
- Then, use the returned Bearer Token to call business endpoints
Specifically:
- The Basic Auth username is your registered email
- The Basic Auth password is the raw API Key value
- The Token is valid for 7 days by default
Get an Access Token
Endpoint:
bash
POST /v1/oauth2/tokenRequest example:
bash
curl -X POST "https://api.ipxss.com/v1/oauth2/token" \
-u "[email protected]:your_api_key"Response example:
json
{
"code": 0,
"data": {
"access_token": "your_bearer_token",
"expires_in": 604800,
"token_type": "bearer"
},
"msg": "success",
"timestamp": 1747036799
}Failure example:
json
{
"code": 40102,
"data": null,
"msg": "invalid username or api key",
"timestamp": 1747036799
}How to Call Business Endpoints
Except for the token endpoint, all other endpoints use a Bearer Token:
bash
curl -X POST "https://api.ipxss.com/v1/wallet/balance" \
-H "Authorization: Bearer your_bearer_token" \
-H "Content-Type: application/json" \
-d '{}'Successful response example:
json
{
"code": 0,
"data": {
"balance": 125.5
},
"msg": "success",
"timestamp": 1747037000
}If an endpoint supports form submission, you can also use application/x-www-form-urlencoded; the current backend is compatible with both JSON and form submissions.
Common Field Conventions
The current Public API follows these conventions:
- ip_type: normal or premium
- duration: week or month (about 7 or 30 days)
- region: uses the code:count|code:count format, for example hk:1|us:2; mix packages use
MIXISP-<id>:<qty>orMIXIPV4-<id>:<qty> - num: must equal the sum of all quantities in region
Time Field Conventions
For consumption logs and whitelist filtering, time fields use the following format:
text
YYYY-MM-DD HH:MM:SSExample:
text
2026-04-08 00:00:00If the end time is earlier than the start time, the endpoint returns a parameter error immediately.
Response Structure
All endpoints return data in the following structure:
json
{
"code": 0,
"data": {},
"msg": "success",
"timestamp": 1747036799
}Common meanings:
- code = 0 means success
- data contains business data
- msg is the status message
- timestamp is the server timestamp
Common error scenarios:
- 40101: Missing authentication information or missing Bearer Token
- 40102: Invalid Token, expired Token, or incorrect API Key credentials
- 40103: The API Key has expired, been revoked, or is unavailable
- 40001: Invalid request parameter format or missing required fields
- 40002: Business validation failed, such as insufficient balance or a resource not found
- 50201: Upstream direct procurement failed and the current request did not complete activation
- 50001: Server-side processing failed, please try again later
Usage Recommendations
- Cache the Token on the server side to avoid requesting a new one for every call
- Check balance and quota before batch calls to reduce failed requests
- When activating or renewing Static ISP resources, it is recommended to keep order-to-resource mapping records in your own business system
- If you need to integrate multiple product lines, it is recommended to build a unified API Client that reuses Token handling, error handling, and time formatting logic