API documentation
Two ways to drive RoyalNetwork programmatically: the native Standard API and a drop-in PerfectPanels-compatible endpoint, so an existing panel integration keeps working.
curl https://royalnet.work/api/v1/account/balance \
-H "Authorization: Bearer $TOKEN"
curl -X POST https://royalnet.work/api/v1/order/create \
-H "Authorization: Bearer $TOKEN" \
-d "region=eu" -d "traffic=30" -d "period=90"
Overview
Every subscription sold by the platform can also be sold through an API. Both APIs operate on the same orders, balances and servers as the dashboard: an order created by API appears in the customer panel, and a renewal done there is visible to the API.
| API | Base path | Use it when |
|---|---|---|
| Standard API | https://royalnet.work/api/v1 |
You are writing your own client and want the full feature set (renewals, limit changes, key rotation, order metadata). |
| PerfectPanels API | https://royalnet.work/api/perfect |
You already run PerfectPanel and want to resell these subscriptions without changing your panel. |
Units and money
- All amounts are US dollars. The display currencies on the website never change what an order costs.
trafficis gigabytes,usersis the number of simultaneous connections.periodis the subscription length in days (30,60,90,120,240).- An order has one limit type: traffic or connections, never both.
Available regions
| Code | Region | Orderable |
|---|---|---|
iri |
伊朗 | yes |
ind |
印度 | yes |
chn |
中国 | no |
usa |
美国 | yes |
eu |
欧洲 | yes |
Authentication
Every request carries the API token of an active customer or reseller account as a bearer token. The token is shown in the customer panel (Account → API token) and can be rotated there at any time; rotation invalidates the old token immediately.
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
The token identifies the account, so an order lookup is already scoped: an API client can only ever see and change its own orders.
Errors
The Standard API answers with a consistent envelope. Check
success first, then error when it is
false.
{
"success": false,
"error": "order_not_found",
"message": "Order not found or does not belong to you"
}
| HTTP | error | Meaning |
|---|---|---|
| 401 | missing_token | No bearer token was sent. |
| 401 | invalid_token | The token is wrong, rotated or the account is not active. |
| 400 | invalid_parameters | A field is missing or out of range; the message names it. |
| 404 | order_not_found | No such order, or it belongs to another account. |
| 400 | insufficient_balance | The balance does not cover the order; the response includes required. |
| 400 | order_cannot_renew | The renewal window rules are not met (see below). |
| 400 | order_cannot_cancelled | Trial or already finished orders cannot be cancelled. |
| 500 | renewal_failed / modification_failed | A server-side operation failed; retry, then contact support. |
The PerfectPanels API answers in its own shape: { "error": "..." }
with HTTP 400 for a bad request and the documented object on success.
Limits & rate limits
| Rule | Value |
|---|---|
| Traffic per order | 1 – 100 GB |
| Connections per order | 1 – 20 |
| Periods | 30, 60, 90, 120, 240 days |
| Increase | Traffic may not exceed 100 GB, connections may not exceed 20 |
| Renewal window | Traffic left ≤ 20% of the limit, or days left ≤ 10% of the period |
| Trial | One per region per account per 7 days |
| Rate limit | Throttled per token; a 429 means slow down |
Standard API /api/v1
All paths below are relative to https://royalnet.work/api/v1.
Create an order
/order/create
charges the balance immediately
| Field | Type | Notes |
|---|---|---|
region | string | One of the region codes above. |
period | int | 30, 60, 90, 120 or 240. |
traffic | int | GB. Required for a traffic order, omit for a connection order. |
users | int | Connections. Required for a connection order. |
link | string | Optional owner contact: an email address or a phone in +1234567890 form. |
curl -X POST https://royalnet.work/api/v1/order/create \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-d "region=eu" -d "traffic=30" -d "period=90"
{
"success": true,
"message": "Order created successfully",
"data": {
"id": 1042,
"region": "eu",
"traffic": 30,
"users": 0,
"period": 90,
"expire": "2026-01-23T10:00:00.000000Z",
"cost": 12.5,
"balance": 87.5,
"subscription": "https://sub.example.com/abc123"
}
}
Request a trial
/order/trial
free, one per region per week
| Field | Type | Notes |
|---|---|---|
region | string | Region code. |
link | string | Optional contact, same format as above. |
Read an order
/order/detail?id=1042
/order/key?id=1042
client credentials
/order/link?id=1042
subscription link
Renew
/order/renew
Renewal is only allowed once the subscription is finishing:
- traffic-based order: remaining traffic ≤ 20% of the limit;
- connection-based order: remaining days ≤ 10% of the period.
| Field | Type | Notes |
|---|---|---|
id | int | Order to renew. |
period | int | New period in days. |
traffic / users | int | Optional new limit; unused traffic or days are added on top. |
Increase / decrease a limit
/order/increase
amount in GB or connections
/order/decrease
cannot cut below current usage
Activate, deactivate, regenerate
/order/activate
/order/deactivate
/order/regenerate
new credentials; devices must re-import
All three take only id.
Update order metadata
/order/update
| Field | Type | Notes |
|---|---|---|
name | string | Friendly label, max 30 characters. |
email | Notification address. | |
phone_number | string | Max 20 characters. |
Cancel
/order/cancel?id=1042
refunds the unused part
The unused share of the subscription is credited back to the balance. Trials and finished orders cannot be cancelled.
Account
/account/balance
/account/keys
/account/links
Metadata
/meta/regions
/meta/locations
/meta/protocols
Use /meta/regions to discover what can be ordered right now
instead of hard-coding region codes.
Network check
/network/check
which server answers this IP
/network/verify?id=1042
probe a subscription end to end
PerfectPanels API /api/perfect
How it works
This is a single endpoint that speaks the PerfectPanel
protocol: one POST to https://royalnet.work/api/perfect with an
action field. It exists so a PerfectPanel installation can resell
these subscriptions as a provider without any custom code.
- Authentication is the same bearer token.
- Services are generated from the live price list, so the panel always sees current availability and rates.
- Rates are returned in the panel's convention: USD × 1000.
action=services
Lists everything that can be sold. Categories follow
[REGION] Traffic Based (30D) and
[REGION] User Based (30D).
curl -X POST https://royalnet.work/api/perfect \
-H "Authorization: Bearer $TOKEN" \
-d "action=services"
[
{
"service": 1,
"name": "10GB - Unlimited User - 30 Days",
"type": "Default",
"category": "[EU] Traffic Based (30D)",
"rate": "1250.000",
"min": 1,
"max": 10,
"refill": false,
"cancel": false
}
]
action=add
Creates an order and charges the balance.
| Field | Type | Notes |
|---|---|---|
action | string | add |
service | int | A service id from action=services. |
link | string | Customer contact: email or +1234567890. |
quantity | int | Between the service's min and max. |
{ "order": 1042 }
action=status
Accepts one or more order ids (orders, comma separated).
{
"charge": "1250.000",
"start_count": null,
"status": "active",
"remains": 30,
"currency": "USD"
}
remains is remaining gigabytes for a traffic order and remaining
days for a connection order. Status values mirror the panel:
active, inactive, finished,
blocked.
action=balance
{ "balance": "87.5000", "current": "USD" }
Connect a PerfectPanel
- In PerfectPanel: Providers → Add provider → API.
- URL:
https://royalnet.work/api/perfect - Key: the customer's API token from the RoyalNetwork panel.
- Save, then press Sync services. The generated catalogue appears as categories grouped by region and period.
Need help?
Open a ticket from the dashboard (Support) or contact us. Include the order id and the timestamp of the failing call - both are logged.