Sub-Users
The link provided below directs to a page that elaborates on the concept of a sub-user within our system.
It's important to note that almost every endpoint related to sub-users, with the notable exceptions of the index
and delete
endpoints, will return a Subuser resource upon a successful call.
{
"id": 5,
"hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
"username": "subuser_231",
"password": "asffqwv2f3w4214v",
"traffic_available": 0.25,
"traffic_used": 0
}
Note that you should not use the id
field. It is a legacy field that will be removed in the future.
Create Sub-User
POST
/residential-subusers
Body Parameters
username
String
username of the subuser
password
String
password of the subuser
traffic
Float
traffic (GB) that will be assigned to the subuser
limits
Array
optional parameter to define limits that will be assigned to the subuser. The structure may consist of the following keys: daily_limit, monthly_limit, and/or lifetime_limit.
"limits": {
"daily_limit": 5000,
"monthly_limit": 150000,
"lifetime_limit": 1000000
}
Example request:
curl -X POST https://resi-api.iproyal.com/v1/residential-subusers \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_api_token>" \
-d '{
"username": "subuser123",
"password": "securepassword",
"traffic": 10.0,
}'
Example response:
{
"id": 5,
"hash": "02JVRQ5BF83PTW19G1SRD955J0",
"username": "subuser123",
"password": "securepassword",
"traffic_available": 10,
"traffic_used": 0
}
Get Sub-User
GET
/residential-subusers/{ hash }
Query Parameters
hash
String
hash of the subuser
Example request:
curl -X GET "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
-H "Authorization: Bearer <your_api_token>"
Example response:
{
"id": 5,
"hash": "02JVRQ5BF83PTW19G1SRD955J0",
"username": "subuser123",
"password": "securepassword",
"traffic_available": 10,
"traffic_used": 0
}
Get Sub-Users
GET
/residential-subusers
Query Parameters
page
Integer
Number of the page
per_page
Integer
Number of subusers per page
search
String
Search that will be used to filter subusers by username
Example request:
curl -X GET "https://resi-api.iproyal.com/v1/residential-subusers?page=1&per_page=10&search=username_search" \
-H "Authorization: Bearer <your_api_token>"
Example response:
{
"data": [
{
"id": 5,
"hash": "02JVRQ5BF83PTW19G1SRD955J0",
"username": "subuser123",
"password": "securepassword",
"traffic_available": 10,
"traffic_used": 0
}
],
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://resi-api.iproyal.com/v1/residential-subusers",
"per_page": 20,
"to": 1,
"total": 1
}
}
Update Sub-User
UPDATE
/residential-subusers/{ hash }
Query Parameters
hash
String
hash of the subuser
Body Parameters
username
String
username of the subuser
password
String
password of the subuser
traffic
Float
traffic (GB) that will be assigned to the subuser
limits
Array
optional parameter to define limits that will be assigned to the subuser. The structure may consist of the following keys: daily_limit, monthly_limit, and/or lifetime_limit.
"limits": {
"daily_limit": 5000,
"monthly_limit": 150000,
"lifetime_limit": 1000000
}
Example request:
curl -X PUT "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type: application/json" \
-d '{
"username": "new_username",
"password": "new_password",
"traffic": 5.0
}'
Example response:
{
"id": 5,
"hash": "02JVRQ5BF83PTW19G1SRD955J0",
"username": "new_username",
"password": "new_password",
"traffic_available": 5,
"traffic_used": 0
}
Delete Sub-User
DELETE
/residential-subusers/{ hash }
Query Parameters
hash
String
hash of the subuser
Example request:
curl -X DELETE "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type: application/json"
Add Traffic to Sub-User
POST
/residential-subusers/{ hash }/give-traffic
Query Parameters
hash
String
hash of the subuser
Body Parameters
amount
Float
amount of traffic (GB) to give
Example request:
curl -X POST "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>/give-traffic" \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type: application/json" \
-d '{
"amount": 5.0
}'
Example response:
{
"id": 5,
"hash": "02JVRQ5BF83PTW19G1SRD955J0",
"username": "new_username",
"password": "new_password",
"traffic_available": 15,
"traffic_used": 0
}
Take Traffic From Sub-User
POST
/residential-subusers/{ hash }/take-traffic
Query Parameters
hash
String
hash of the subuser
Body Parameters
amount
Float
amount of traffic (GB) to give
Example request:
curl -X POST "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>/take-traffic" \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type: application/json" \
-d '{
"amount": 5.0
}'
Example response:
{
"id": 5,
"hash": "02JVRQ5BF83PTW19G1SRD955J0",
"username": "new_username",
"password": "new_password",
"traffic_available": 10,
"traffic_used": 0
}
Last updated
Was this helpful?