Sub-Users

The link provided below directs to a page that elaborates on the concept of a sub-user within our system.

Sub-Users


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.

SubuserResource
{
    "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.


When adding traffic to a sub-user through creation or updating, the traffic will be taken from the main account. Likewise, when you delete a sub-user or take traffic from a sub-user - it will be returned to the main user.


Create Sub-User

POST /residential-subusers

Body Parameters

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
         }'

Get Sub-User

GET /residential-subusers/{ hash }

Query Parameters

Example request:

curl -X GET "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
     -H "Authorization: Bearer <your_api_token>"

Get Sub-Users

GET /residential-subusers

Query Parameters

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>"

Update Sub-User

UPDATE /residential-subusers/{ hash }

Query Parameters

Body Parameters

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
         }'

Delete Sub-User

DELETE /residential-subusers/{ hash }

Query Parameters

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

Body Parameters

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
         }'

Take Traffic From Sub-User

POST /residential-subusers/{ hash }/take-traffic

Query Parameters

Body Parameters

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
         }'

Last updated