> This is part 1 of 2 of the full documentation (pages 1–100 of 191).
> The content is paginated: fetch every part to see all of it.
> Next part: https://docs.iproyal.com/llms-full.txt/1
> Page index: https://docs.iproyal.com/llms.txt

# Overview

Welcome to IPRoyal documentation.\
\
These documents provide everything you need to get started using our services. If something is missing or you want to share feedback, please contact us at <support@iproyal.com> or via chat on our [website](https://iproyal.com/).

### Useful Links

Our [Help Center](https://help.iproyal.com/en/) offers answers to the most frequently asked questions about our services, billing, account settings, and more.

Our [blog](https://iproyal.com/blog/) offers proxy-related news, product updates, integration tutorials, web scraping guides, code examples, and expert insights.

We also offer several free tools to make your proxy usage more convenient. These include [browser extensions](https://dashboard.iproyal.com/proxy-managers), a Windows-based [proxy tester](https://dashboard.iproyal.com/proxy-tester), and an [IP lookup](https://iproyal.com/ip-lookup/) page.


# Residential

IPRoyal currently offers over 64M [Residential Proxies](https://iproyal.com/residential-proxies/) in over 195 countries. This number is constantly growing, so our clients can rely on fresh proxies for all sorts of tasks.

### Key Advantages of IPRoyal Residential Proxies <a href="#key-advantages-of-iproyal-residential-proxies" id="key-advantages-of-iproyal-residential-proxies"></a>

* **Highly competitive pricing**

We offer some of the lowest prices in the industry with advanced features, high reliability, and [excellent customer satisfaction](https://www.trustpilot.com/review/iproyal.com).

* **Exclusive proxy pool**

With over 64M residential IPs in over 195 countries, we guarantee efficient web scraping, SEO research, data aggregation, social media management, and more.

* **Precise targeting**

Choose proxies from any part of the world (country, state, or city) with a single click and no extra cost.

* **Pay-as-you-go option**

No contracts, no wasted bandwidth, and no monthly limits - you only pay for what you need.

* **No data expiration**

Once you purchase your residential proxy traffic - it’s yours forever. It never expires, so you can use it whenever you want.

* **24/7 support**

With an average response time of just 58 seconds, our skilled team of experts is available around the clock and ready to help you set up and make the most of your proxies.

### Technical Features of IPRoyal Residential Proxies <a href="#technical-features-of-iproyal-residential-proxies" id="technical-features-of-iproyal-residential-proxies"></a>

* **Advanced session control**

Get a new IP on each request or use a sticky session of up to 7 days.

* **Unlimited simultaneous sessions**

No limits and restrictions - use as many connections and scale your operations as needed.

* **Dual authentication**

Username/password and IP whitelisting available for the highest compatibility with scrapers, bots, and other tools.

* **HTTP(S) and SOCKS5 support**

Choose the protocol that suits your needs to get the best results with any usage case.

* **API access**

Integrate our residential proxies into your infrastructure, manage sub-users, and more.

<br>

<br>


# Dashboard

In this section, we provide concise yet comprehensive guidance on navigating and utilizing the dashboard features. This section includes various subsections, each focused on different aspects of the dashboard, from setting up and managing proxies to understanding metrics and adjusting settings. Whether you're a novice or an experienced user, you'll find straightforward instructions to optimize your use of our services through the dashboard.


# Making an Order

Welcome to the step-by-step guide for placing an order for proxies on our website. In this section, we will provide you with detailed screenshots and clear explanations to ensure a seamless and straightforward ordering process. Our aim is to make your experience as intuitive and efficient as possible. Let's walk through the process together, showing you exactly how to order your first GB of data!

***

To begin your purchase of Residential proxies, navigate to the 'Residential' section (<mark style="color:orange;">1</mark>) on the sidebar menu. This action will direct you to the Residential proxies dashboard.

Once you're on the dashboard, click the '+ Create a new order' button (<mark style="color:orange;">2</mark>). This will initiate the process for you to start creating your proxy order with your desired specifications.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FZfz8iK6exW20wX6yQG8d%2Fa1.webp?alt=media&amp;token=c3b33588-79ec-4aaf-a9bf-eeed3a4b7fb7" alt=""><figcaption></figcaption></figure>

***

Firstly, we recommend you examine the discount table (<mark style="color:orange;">1</mark>) with detailed information about pricing and bundle discounts that could provide additional value to your purchase. It's worth taking a moment to review discounts for larger volume purchases.

Next, you will specify the amount of data you need for your proxies. Locate the 'Number of GB' field (<mark style="color:orange;">2</mark>), and enter the desired quantity of gigabytes that suits your requirements.

After setting the amount, select your preferred payment option (<mark style="color:orange;">3</mark>). You can create a subscription where the purchased amount is added to your account automatically each month, or the pay-as-you-go option.

Proceed to finalize your order by clicking the 'Buy now' button in the panel (<mark style="color:orange;">4</mark>). This will take you to the payment and confirmation process.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FMRzyQjHLqNoHyqfpywCa%2Fa2.webp?alt=media&amp;token=04c5dae6-b104-4fb8-955a-701b73a68235" alt=""><figcaption></figcaption></figure>

***

You're almost there! The final step is to complete your payment for the order.

As displayed on the 'Complete order' page, you can choose from multiple payment options for your convenience. Whether you prefer to use a credit card, cryptocurrency, PayPal, or Google Pay, simply select your preferred payment method and fill in the required details (<mark style="color:orange;">1</mark>).

Once you have entered your payment information, review your order summary to ensure everything is correct. If you have a coupon code, enter it and click "Apply" (<mark style="color:orange;">2</mark>).

After all of this is done, click the 'Complete order' button (<mark style="color:orange;">3</mark>) to finalize your purchase.

Rest assured, all transactions are secure, and you have the option to save your payment information for future purchases.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FXmrNjOZBPtkH8gZjHmZK%2Fa3.webp?alt=media&amp;token=8ebac21b-024d-4916-b75a-ce397e01c4c2" alt=""><figcaption></figcaption></figure>

***

Congratulations! Your order for residential proxies has been successfully processed. You will see a confirmation message.

This page will also display the information about your order (<mark style="color:orange;">1</mark>).

You can also use the "Note" panel to add any notes to your order for future reference (<mark style="color:orange;">2</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FRuA7jFVlN3GpegjXVQh1%2Fa4.webp?alt=media&amp;token=2d831e36-f46e-4823-a460-0e8ec4111eaf" alt=""><figcaption></figcaption></figure>


# Statistics

In the 'Statistics' section of your Residential Proxies dashboard, you have the ability to monitor and analyze your proxy usage over time. This interactive graph, outlined by the orange dotted border in the image, provides a visual representation of your proxy traffic, which you can further adjust by selecting a specific time period. This can help you understand peak usage times or identify trends. Additionally, you have the option to filter the data by specific websites and choose the units of measurement (such as MB or GB).

For a more detailed review or record-keeping purposes, you can download the report by clicking the 'Download report' button. This tool is essential for managing your proxies effectively and ensuring that your usage aligns with your needs and expectations.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FRlGnidMTt5PnZsJ7odk5%2FA1.png?alt=media&amp;token=1a6a47c5-c1bd-40a6-8a4d-8477e17cf1af" alt=""><figcaption></figcaption></figure>


# Configuration

Whether you're looking to automate account maintenance or tailor your proxy settings for specific tasks, the 'Configuration' section offers detailed information on how to customize and manage various settings to enhance your proxy experience. This section is divided into several key subsections, each dedicated to a specific configuration area. These include setting up automatic top-ups to ensure uninterrupted service, accessing proxies effectively, and utilizing advanced features like IP Whitelisting and IP Skipping for refined control over your proxy connections.


# Automatic Top-Up

In this section of the dashboard, you have the convenience of setting up 'Auto Top-Up' for your account. To get started, toggle the 'Enable auto top-up' switch (<mark style="color:orange;">1</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FcxbXrxHHS2qoysz1lQtI%2FIMG12.png?alt=media&amp;token=4c3d8f25-e71b-446c-9f16-5b4a3c3abc60" alt=""><figcaption></figcaption></figure>

When enabled, this feature allows your account to automatically add more GB to your available traffic when it reaches a predetermined level, ensuring uninterrupted service.

You can choose your payment method (<mark style="color:orange;">1</mark>), set the threshold at which the top-up should occur under 'When to add' (<mark style="color:orange;">2</mark>), and specify the amount of GB to be added automatically under 'Amount to add' (<mark style="color:orange;">3</mark>). There's also a field that displays your current balance for clarity, and the option to apply a coupon if you have one (<mark style="color:orange;">4</mark>). Once you have configured your settings, simply click 'Save' (<mark style="color:orange;">5</mark>) to activate the auto top-up feature.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FfA6GNQKApqjmVLG689nQ%2FIMG13.png?alt=media&amp;token=9a10419f-7b98-4dac-ad65-a1f1ed8ab198" alt=""><figcaption></figcaption></figure>

<br>


# Proxy Access

Before continuing, we recommend visiting our 'Proxy' documentation to understand how it works and the meaning of the inputs in the panel.

{% content-ref url="/pages/YsqZFj8WraiuRhTt2v1o" %}
[Proxy](/proxies/residential/proxy)
{% endcontent-ref %}

This is your proxy access configuration panel, where you can customize the settings for your proxy usage. The panel offers a variety of inputs for detailed configuration. Each setting allows you to tailor the proxy behavior to your exact requirements, such as selecting the country, state/region, ISP, and type, as well as defining rotation preferences.

{% hint style="info" %}
To enable filtering by ISP or 'Skip ISP Static' features, please contact support.
{% endhint %}

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FGV0rctOZ1TMGyXfiXQDe%2FC1.png?alt=media&amp;token=cb76fe40-0c56-4b8d-af4d-0ea6a706798c" alt=""><figcaption></figcaption></figure>

Further down, you will find the formatted proxy list section. This area displays your proxies in a ready-to-use format, complete with all necessary details for each proxy connection. You have the convenient option to 'Copy' the list to your clipboard or 'Download list' for offline use. You can also select the format that best fits your needs and specify the quantity of proxies you wish to view or export. This streamlined approach ensures quick and easy access to your proxy information for immediate use.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FZ4aruLgZFx2h3dVvXaFj%2FC2.png?alt=media&amp;token=b446cdef-dd1e-4efe-a391-b5516792da0c" alt=""><figcaption></figcaption></figure>


# Whitelisting IPs

In this section, we'll walk you through the steps for managing IP whitelists. We recommend reviewing our 'IP Whitelisting' documentation beforehand to familiarize yourself with the concept.

{% content-ref url="/pages/PBzy0SbyeQr4h9Dg3uon" %}
[IP Whitelisting](/proxies/residential/proxy/ip-whitelisting)
{% endcontent-ref %}

***

Navigate to the 'Residential' section on the sidebar menu (<mark style="color:orange;">1</mark>), which brings you to the main dashboard for Residential Proxies.

From there, find the 'Whitelist' (<mark style="color:orange;">2</mark>) button. Clicking this button enables you to manage and edit your whitelist settings, where you can specify and manage whitelist entries.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FuZwG4Y2elPwLRKPwQRqO%2FD1.png?alt=media&amp;token=7ed4ed84-e5b6-4fbd-a618-287f16e9841f" alt=""><figcaption></figcaption></figure>

On the configuration page, select the 'Add' option.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F6zmTxlbE5BQO7rY0KGBX%2FD2.png?alt=media&amp;token=b6e78724-540c-4474-a372-c09bf1014446" alt=""><figcaption></figcaption></figure>

Configure your proxy (<mark style="color:orange;">1</mark>). For more information about configuration and input meanings, head to the 'Proxy' section.

{% content-ref url="/pages/YsqZFj8WraiuRhTt2v1o" %}
[Proxy](/proxies/residential/proxy)
{% endcontent-ref %}

Enter the IP address you want to associate with this configuration (<mark style="color:orange;">2</mark>).

Create your whitelist entry (<mark style="color:orange;">3</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FMsRmOJtuJby93Rp5KyVb%2FD3ENG.png?alt=media&amp;token=97a8ad4e-cc99-4a9a-b95a-3a19b3650c61" alt=""><figcaption></figcaption></figure>

Every entry has buttons to manage it (<mark style="color:orange;">1</mark>).

Further down, you will find the formatted proxy list section. This area displays your proxies in a ready-to-use format (<mark style="color:orange;">2</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FCEmSmWv19p708Hh39anG%2FD4.png?alt=media&amp;token=ef019a8a-2a1c-47ee-b8cd-0217e59b0506" alt=""><figcaption></figcaption></figure>


# IP Skipping

{% hint style="info" %}
To enable this feature, please contact support.
{% endhint %}

In this section, we'll walk you through the steps for managing IP skipping lists. We recommend reviewing our 'IP Skipping' documentation beforehand to familiarize yourself with the concept.

{% content-ref url="/pages/Nh6TilMcEjAEiOmYxPSU" %}
[IP Skipping](/proxies/residential/proxy/ip-skipping)
{% endcontent-ref %}

***

Navigate to the 'Residential' section on the sidebar menu (<mark style="color:orange;">1</mark>), which brings you to the main dashboard for Residential Proxies.

From there, find the 'IP skipping' (<mark style="color:orange;">2</mark>) button. Clicking this button enables you to manage and edit your IP skipping settings, where you can specify and manage IP skipping entries.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Fev9u3tKD5Va84XZ8GhDx%2FE1.png?alt=media&amp;token=888970eb-63ae-4309-a584-60b936d6d0e6" alt=""><figcaption></figcaption></figure>

First, begin by creating a list. This is achieved by entering a title (<mark style="color:orange;">1</mark>) for the list and clicking the 'Create' button.\
\
Once you create a list, it will appear in our 'Skip IP List' table (<mark style="color:orange;">2</mark>). Here, you will find an 'Edit' button, which you need to click in order to start adding the IP ranges you wish to skip.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FgC9MSqQeiAoJIXmDkNbT%2FE2.png?alt=media&amp;token=d16c6204-428f-420f-9f1b-89f608e73b4b" alt=""><figcaption></figcaption></figure>

Clicking the 'Edit' button opens a modal window that enables you to add multiple IP ranges, change the list name, and of course, save the list.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F8IDrwFxRLsbRWz6zCtOq%2FE3.png?alt=media&amp;token=9e65aa86-610d-42c0-b68f-50e289595f9e" alt=""><figcaption></figcaption></figure>


# Domain Filtering (previously Allowances)

In this section, we’ll walk you through the steps for managing domains accessible via our proxies. We recommend reviewing our 'Domain Filtering (previously ‘Allowances’) documentation beforehand to familiarize yourself with the concept.

{% content-ref url="/pages/5LjQKbOW8wKysYUfsrl0" %}
[Domain Filtering (previously Allowances)](/proxies/residential/proxy/domain-filtering-previously-allowances)
{% endcontent-ref %}

Navigate to the ‘Residential’ section on the sidebar menu (<mark style="color:orange;">1</mark>), which brings you to the main dashboard for Residential Proxies.

From there, find the 'Domain Filtering' (previously ‘Allowances’) (<mark style="color:orange;">2</mark>) button. Clicking this button enables you to manage and edit domain blocklist and whitelist settings, where you can specify which domains will be accessible via our proxies.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FGYXCuUq0mJQEONCQsDc8%2FF1.png?alt=media&amp;token=e8d7e5c1-31bf-4c8a-b51c-e1b582490e24" alt=""><figcaption></figcaption></figure>

The ‘Restrictions’ (<mark style="color:orange;">1</mark>) section enables you to create a list of domains our proxies will not access. All you need is to provide a URL in the designated field (<mark style="color:orange;">2</mark>) and click the ‘Add’ (<mark style="color:orange;">3</mark>) button. You can modify the list of blocked domains by clicking the ‘Remove’ (<mark style="color:orange;">4</mark>) button next to the entry you want to remove.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FvY4px3vAGkiJAqvgZqn1%2FF2.png?alt=media&amp;token=c9fed68a-08fd-4328-941c-f809ae375dc4" alt=""><figcaption></figcaption></figure>

Alternatively, you can use the ‘Permissions’ (<mark style="color:orange;">1</mark>) section to create a list of domains that our proxies can access. All you need is to provide a URL in the designated field (<mark style="color:orange;">2</mark>) and click the ‘Add’ button (<mark style="color:orange;">3</mark>). You can modify the list of whitelisted domains by clicking the ‘Remove’ (<mark style="color:orange;">4</mark>) button next to the entry you want to remove.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FlFmEengRSLd3XRoF8BOo%2FF3.png?alt=media&amp;token=00d88dcc-5a6c-4ade-b1b8-da07432335fc" alt=""><figcaption></figcaption></figure>

**Note**: As long as you have a single domain in your allowed sites list, all other domains will not be accessible via our proxies.


# Orders

In the orders section, outlined by the orange dotted border in the image, you can track and manage your orders. This part of the dashboard presents a table listing all your transactions, including order ID, any associated notes, order date, the amount paid, the amount of traffic available before the order, and the current status of each order. You can search for specific orders using a note or ID, filter the entries displayed per page, and filter by order status. For each listed order, there are options to view detailed information. You also have the option to download the invoice for all confirmed orders. This feature is designed to give you a clear and organized view of your past activity and assist in managing your purchases effectively.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F8TjLqX0PkqtLY6SSYLPz%2FG1.png?alt=media&amp;token=cb9a713e-8d47-483d-a86e-814eb642e568" alt=""><figcaption></figcaption></figure>


# Subscription

Our Residential Proxies are available in two payment plans - pay-as-you-go and subscription. The subscription feature offers a simple and efficient way for our users to ensure a steady supply of traffic without the hassle of reordering. This option also comes with an exclusive 5% discount.

In this section, we’ll walk you through the steps for managing a subscription.

—\
Navigate to the 'Residential' (<mark style="color:orange;">1</mark>) section on the sidebar menu, which brings you to the main dashboard for Residential Proxies.

From there, find the 'Subscription' (<mark style="color:orange;">2</mark>) banner to see the current status of your subscription.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FVIrRl5Rrj5CBxQxZgOR1%2FIMG1.png?alt=media&amp;token=a6418e24-0c70-453b-92a3-56161f3a989f" alt=""><figcaption></figcaption></figure>

If your subscription is active, you will see its details - status (<mark style="color:orange;">1</mark>), next payment date (<mark style="color:orange;">2</mark>), amount of traffic you subscribed to (<mark style="color:orange;">3</mark>), and the price (<mark style="color:orange;">4</mark>). Can click the 'Manage subscription' (<mark style="color:orange;">5</mark>) button to get more information.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FqgBpWVyxbSUVxYQcUv6s%2FIMG2.png?alt=media&amp;token=9d596ab4-6cb9-4f01-9238-b03261a32859" alt=""><figcaption></figcaption></figure>

On this page, you have several options. You can change your payment method (<mark style="color:orange;">1</mark>), upgrade (<mark style="color:orange;">2</mark>) or cancel (<mark style="color:orange;">3</mark>) your subscription, and get an overview of your subscription history (<mark style="color:orange;">4</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F0nDo5qYuIlzVaOtKtKF5%2FIMG3.png?alt=media&amp;token=5b768c95-97ff-4d71-a2c8-f32b222fad2f" alt=""><figcaption></figcaption></figure>

Clicking the 'Upgrade plan' (<mark style="color:orange;">1</mark>) button will take you to the order placement page.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FIHyTsAQZQjdPmgMF0HvL%2FIMG4.png?alt=media&amp;token=e2092830-8e7e-4bac-a8dd-8ffbcd74a0ff" alt=""><figcaption></figcaption></figure>

You will see the pricing and available discounts (<mark style="color:orange;">1</mark>), where you can choose a subscription upgrade, as well as your current subscription details and pricing (<mark style="color:orange;">2</mark>). Add the number of GB (<mark style="color:orange;">3</mark>) you want to add to your subscription, and you’ll see the updated pricing (<mark style="color:orange;">4</mark>). Click the 'Continue' (<mark style="color:orange;">5</mark>) button.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FiAH94tHbqnOO6h1IBC1Q%2FIMG5.png?alt=media&amp;token=afaf0bbd-0761-4a97-8fb9-52bf939078b7" alt=""><figcaption></figcaption></figure>

Select the payment method (<mark style="color:orange;">1</mark>) and click the 'Complete order' (<mark style="color:orange;">2</mark>) button.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Fe8eevAX9QBF9Lsx6OzA6%2FIMG6.png?alt=media&amp;token=596c46f8-64ac-4bdc-88d6-5e38b8b432c5" alt=""><figcaption></figcaption></figure>

Clicking the 'Cancel plan' (<mark style="color:orange;">1</mark>) button will bring up a confirmation prompt. Click the 'Yes, cancel' (<mark style="color:orange;">2</mark>) button to cancel your subscription or the 'Not now' (<mark style="color:orange;">3</mark>) button to go back.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FE2pm2ZzABoQLjmlMoxYY%2FIMG7.png?alt=media&amp;token=b4c56875-fbef-4174-b54d-c21e3d9e7a33" alt=""><figcaption></figcaption></figure>

If your subscription isn’t activated, you can click the 'Reactivate' (<mark style="color:orange;">1</mark>) button to reactivate it without changing any settings.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FvdNY8pHTloajkMPhUyt3%2FIMG8.png?alt=media&amp;token=439e5b48-dfce-4245-8f3e-a927d094491b" alt=""><figcaption></figcaption></figure>

Select the payment method (<mark style="color:orange;">1</mark>) and click the 'Complete order' (<mark style="color:orange;">2</mark>) button.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FObyPJDtTEjrGOtbW4uQS%2FIMG9.png?alt=media&amp;token=123810a9-8f85-455f-8361-70e48553bb34" alt=""><figcaption></figcaption></figure>

If your subscription is active, you also have the option to add extra traffic without changing the plan. The amount of traffic you can add this way equals your current subscription. To do this, click the 'Quick top-up' button (<mark style="color:orange;">1</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FLrXy7nhM8L5mjoZLclRl%2FIMG10.png?alt=media&amp;token=f3238b1a-655a-45cc-a8ca-c89d6b63acdd" alt=""><figcaption></figcaption></figure>

Select the payment method (<mark style="color:orange;">1</mark>) and click the 'Complete order' (<mark style="color:orange;">2</mark>) button.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FaWbOZqgzQt2zhVXRltHw%2FIMG11.png?alt=media&amp;token=29285c61-a998-423b-a979-e23f842c9220" alt=""><figcaption></figcaption></figure>

<br>


# Sub-Users

In this section, we'll walk you through the steps for managing sub-users. We recommend reading our 'Sub-Users' introduction beforehand to familiarize yourself with the concept.

{% content-ref url="/pages/8pKoiDpXpxe7vuHC9BF8" %}
[Sub-Users](/proxies/residential/sub-users)
{% endcontent-ref %}

***

Navigate to the 'Residential' section on the sidebar menu (<mark style="color:orange;">1</mark>), which brings you to the main dashboard for Residential Proxies.

From there, find the 'Sub-Users' (<mark style="color:orange;">2</mark>) button. Clicking on this button will bring you to the sub-users dashboard.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FfiBx84DXM3FBK9rLMO6q%2FH1.png?alt=media&amp;token=73407da3-541e-4f5f-b8a8-7f5c11f65e7d" alt=""><figcaption></figcaption></figure>

If you haven't created any sub-users yet, you will initially see a brief introduction. By clicking the 'Sub-Users Dashboard' button, you will be directed to the panel where you can create your first sub-user.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FPO6wpEH68IfmwCygqqbZ%2FH2.png?alt=media&amp;token=278c473b-4f30-40a2-8c48-ad43078bbf13" alt=""><figcaption></figcaption></figure>

The 'Create Sub-User' page features three input fields.&#x20;

The first is for the sub-user's username (<mark style="color:orange;">1</mark>), which is used to connect to the proxy.

&#x20;The second field is for setting the password (<mark style="color:orange;">2</mark>).

And the third is 'Assign Traffic' (<mark style="color:orange;">3</mark>). The number entered in this field is the amount of traffic (in GB) that will be deducted from your (the main user's) account and allocated to the sub-user.

After filling out these inputs, click the 'Create' (<mark style="color:orange;">4</mark>) button to finalize the creation of your sub-user.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FnvtsCZnwhmZmdbnhlNEa%2FH3.png?alt=media&amp;token=714f5555-359a-46ca-8cfc-9181f3369266" alt=""><figcaption></figcaption></figure>

Congratulations on creating your first sub-user. The image below illustrates the interface you'll encounter following the creation.&#x20;

It includes:

* a button for adding additional sub-users (<mark style="color:orange;">1</mark>);
* a display panel indicating your main user’s remaining traffic (<mark style="color:orange;">2</mark>);
* a table listing all sub-users with a search feature for easy navigation (<mark style="color:orange;">3</mark>).

Equally crucial are the management buttons (<mark style="color:orange;">4</mark>) adjacent to each sub-user entry, which provide options to create whitelists and generate proxies for them.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FslKCKQSl97fSAlo8Sx7x%2FH4.png?alt=media&amp;token=f4a0a962-a7ae-4637-876e-c80cfc3cd9cb" alt=""><figcaption></figcaption></figure>


# Proxy

In this section, we will delve into the creation and configuration of a proxy string. We'll cover how to target specific locations, apply rotation settings, select the appropriate protocol, and more. Additionally, we will demonstrate how to make a request using a proxy.

To begin, it's important to understand that a proxy string comprises four elements: **host**, **port**, **username**, and **password**. While there are multiple methods to combine these four elements, for the sake of simplicity, we will adopt the format: **HOST:PORT:USERNAME:PASSWORD**.

Residential proxies utilize the **password** segment of the string to configure the aforementioned settings. For instance, consider the following proxy string designed to target the state of California in the USA:

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FZ69IdA0jtTQBKDd2aAxd%2FIPR%20Dokumentacija_1200x400.png?alt=media&amp;token=a55280d1-1d47-442b-902b-c0bc924006c5" alt=""><figcaption></figcaption></figure>

As mentioned earlier, the string has four main sections (highlighted in blue), and the last one is labeled 'Password.' This section holds all the configuration details for the proxy.

### Proxy Regions

We offer multiple proxy regions:

* `proxy.iproyal.com` - Germany region
* `us.proxy.iproyal.com` - US region
* `sg.proxy.iproyal.com` - Singapore region

For automatic region selection, use `geo.iproyal.com` - it will automatically connect you to the most optimal region based on your request IP location.


# Location

Location targeting is arguably the most crucial aspect of configuring a proxy. Users frequently need to access a proxy server in a specific location for various purposes. IPRoyal offers extensive possibilities in this regard, enabling users to target a region, country, state, or city and even a specific internet service provider (ISP) within that location. We will explore these options in greater detail in the subsequent paragraphs, focusing on the comprehensive location-targeting capabilities provided by IPRoyal within this section.

### Region

`_region-` is the key for region configuration. Adding this value will tell our router to filter proxies that are located in this region.&#x20;

Example:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_region-europe@geo.iproyal.com:12321 -L https://google.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_region-europe';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_region-europe'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_region-europe';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}

<details>

<summary>Supported region values</summary>

* `africa`
* `arabstates`
* `asiapacific`
* `europe`
* `middleeast`
* `northamerica`
* `southlatinamerica`

</details>

### Country

`_country-` is the key for country configuration. The value of this parameter is a two letter country code ([ISO 3166-1 alpha-2 format](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).

You can select more than one country. When resolving a proxy with this configuration, our router will randomly select one of the countries you had set as a value for the country key.

Examples:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-dk,it,ie@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_country-dk,it,ie';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-dk,it,ie'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-dk,it,ie';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}

### City

`_city-` is the key to target a city. The value should be a name of the city.

{% hint style="warning" %}
Additionally, it's essential to specify the country when targeting a specific city, as multiple countries may have cities with the same name.
{% endhint %}

Example:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-de_city-berlin@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321';
$country = 'country-de';
$city = 'city-berlin';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
$headers = [
    "X-Country: $country",
    "X-City: $city"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-de_city-berlin'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-de_city-berlin';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}

### State

`_state-` is used to target a state in the **US**. The value should be the name of the state.

{% hint style="warning" %}
Be sure to select the **US** as a country.
{% endhint %}

Example:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-us_state-iowa@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_country-us_state-iowa';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-us_state-iowa'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-us_state-iowa';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}

### ISP

{% hint style="info" %}
Available only with verified ID and after spending $1,000 or more.
{% endhint %}

`_isp-` is used to target a specific **ISP** (Internet service provider) in a location. The value should be a concatenated name of the provider.

{% hint style="warning" %}
Be sure to chain it to a city. A single ISP is often present in many cities or even countries.
{% endhint %}

Example:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-gb_city-birmingham_isp-skyuklimited@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_country-gb_city-birmingham_isp-skyuklimited';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-gb_city-birmingham_isp-skyuklimited'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-gb_city-birmingham_isp-skyuklimited';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}

### Geolocation

`_geolocation-` is used to target exit nodes near a specific geographic point. The value is a comma-separated list of latitude, longitude, radius (in miles), and an optional strict flag.  &#x20;

**Format:**

```
_geolocation-LAT,LON,RADIUS[,strict]
```

* `LAT` - latitude, a decimal between -90 and 90.&#x20;
* `LON` - longitude, a decimal between -180 and 180. &#x20;
* `RADIUS` - search radius in miles. Must be at least 10. &#x20;
* Non-strict (default) - without the strict flag, exit nodes inside the radius are preferred. If no exit nodes are available inside the radius, the closest exit nodes by distance are used instead, so a request is always routed.
* `Strict` - optional. With the `strict` flag appended, only exit nodes that fall inside the radius are used. If none are available, the request fails. Use this when precise geographic targeting matters more than availability.

**Examples:**

Target exit nodes within 10 miles of Vilnius (54.6872, 25.2797) (if not found in a 10 mile radius, return closest ones):

```
curl -v -x http://username123:password321_geolocation-54.6872,25.2797,10@geo.iproyal.com:12321 -L http://example.com
```

Same target, but only accept exit nodes strictly inside the radius (if not found, request will fail):

```
curl -v -x http://username123:password321_geolocation-54.6872,25.2797,10,strict@geo.iproyal.com:12321 -L http://example.com
```


# Rotation

In the realm of proxy sessions, we offer two distinct types of rotation: 'Sticky' and 'Randomize'. Each type serves a different purpose, catering to the varying needs of our users.

### Sticky

This option allows you to maintain a consistent proxy for the duration of your session. With sticky sessions, you can configure a 'lifetime' parameter, which determines how long the same proxy will be used before it switches to a new one. This is particularly useful for tasks that require a sustained connection to the same IP address, such as maintaining a consistent session while accessing web resources that have session-based authentication or tracking.

1. The `_session-` key instructs our routing system to either create or resolve a unique session for the connection. The value assigned to this key must be a random alphanumeric string, precisely **8 characters** in length. This ensures the uniqueness and integrity of the session.
2. The `_lifetime-` key directs the router regarding the duration for which the session remains valid. The minimum duration is set at **1 second**, and the maximum extends to **7 days**. It is crucial to note the format here: only one unit of time can be specified. This parameter plays a pivotal role in defining the operational span of a sticky session, balancing between session stability and security needs.<br>

Examples:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-br_session-sgn34f3e_lifetime-10m@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_country-br_session-sgn34f3e_lifetime-10m';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-br_session-sgn34f3e_lifetime-10m'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-br_session-sgn34f3e_lifetime-10m';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}

### Randomize

Randomize sessions provide a new proxy with each request. This means that every time you make a request, it comes from a different IP address. This approach is ideal for tasks that require a high level of anonymity and reduced traceability, such as web scraping or accessing content without revealing a consistent identity.&#x20;

**To use this type of rotation, you don't need to add anything to the proxy string.**

**Note**: To reduce IP rotation and improve performance of your proxies, add the  `_forcerandom-1` tag to your proxy string. This will increase the pool of selected locations.&#x20;

### Killswitch

By default, if a sticky session's IP becomes unavailable, the system silently assigns a replacement.&#x20;

To disable this behavior, add the `_killswitch-1` flag to your proxy string. When the flag is added, the proxy returns an `HTTP 410` code response instead of rotating to a new IP.&#x20;

This is useful for workflows where an undetected IP change would cause errors or data integrity issues.

{% tabs %}
{% tab title="cURL" %}

```
curl -x http://username123:password321_session-sgn34f3e_lifetime-30m_killswitch-1@geo.iproyal.com:12321 -L https://ipv4.icanhazip.com
```

{% endtab %}
{% endtabs %}


# High-End Pool

{% hint style="info" %}
This feature is available with active subscription only.
{% endhint %}

When activated, the 'High-End Pool' option grants you access to the swiftest and most reliable proxies in our selection. Please be aware, however, that the trade-off for this enhanced quality is a smaller pool of available proxies than what is typically accessible.

To enable this feature, you will need to add the `_streaming-` key with value **1**.

Example:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-br_streaming-1@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_country-br_streaming-1';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-br_streaming-1';
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-br_streaming-1';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth,
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}


# Skipping Static ISP

{% hint style="info" %}
To enable this feature, please contact support.
{% endhint %}

When enabled, this option instructs our router to skip static proxies.

To enable this feature, you will need to add the `_skipispstatic-` key with value **1**.

Example:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-br_skipispstatic-1@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_country-br_skipispstatic-1';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-br_skipispstatic-1'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-br_skipispstatic-1';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}


# IP Whitelisting

In the preceding sections, we discussed various configurations that can be applied to a proxy via the proxy string. IP Whitelisting is a feature that streamlines this process by allowing you to preserve your proxy configuration string and link it to a specific IP address. Essentially, this feature enables you to establish a preset configuration and associate it with an IP. Consequently, this eliminates the need for authentication credentials, permitting a direct connection to the proxy using just the **HOST:PORT** format. This method enhances ease of access while maintaining the security and specificity of your proxy settings.

### What Are the Benefits of IP Whitelisting <a href="#what-are-the-benefits-of-ip-whitelisting" id="what-are-the-benefits-of-ip-whitelisting"></a>

Whitelisting IPs offers several advantages over the more common username/password authentication.

* Enhanced security
* Improved access control
* Abuse prevention
* Easier scaling

For further guidance on utilizing this feature, please refer to the 'Whitelisting IPs' subsection located within the 'Dashboard' section of our documentation.

{% content-ref url="/pages/jpwjwKrbsGKsVt7VWceQ" %}
[Whitelisting IPs](/proxies/residential/dashboard/configuration/whitelisting-ips)
{% endcontent-ref %}


# IP Skipping

{% hint style="info" %}
To enable this feature, please contact support.
{% endhint %}

The IP skipping feature enables you to compile multiple lists of IP ranges that will be automatically bypassed during the IP resolution process for your proxy connection.

To enable this feature you will need to add the `_skipipslist-` key, value of the key is **ULID** (id) of the generated list.

Example:

{% tabs %}
{% tab title="cURL" %}

```
curl -v -x http://username123:password321_country-br_skipipslist-01GRBHR1DMBFRH8VW7APEWD5BQ@geo.iproyal.com:12321 -L http://example.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'username123';
$password = 'password321_country-br_skipipslist-01GRBHR1DMBFRH8VW7APEWD5BQ';
$proxy = 'geo.iproyal.com:12321';
$url = 'http://example.com';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from requests.auth import HTTPProxyAuth

username = 'username123'
password = 'password321_country-br_skipipslist-01GRBHR1DMBFRH8VW7APEWD5BQ'
proxy = 'geo.iproyal.com:12321'
url = 'http://example.com'

proxies = {
    'http': f'http://{proxy}',
    'https': f'http://{proxy}',
}

auth = HTTPProxyAuth(username, password)

response = requests.get(url, proxies=proxies, auth=auth)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const http = require('http');

const username = 'username123';
const password = 'password321_country-br_skipipslist-01GRBHR1DMBFRH8VW7APEWD5BQ';
const proxyHost = 'geo.iproyal.com';
const proxyPort = 12321;
const targetUrl = 'http://example.com';

const targetUrlObj = new URL(targetUrl);
const targetHost = targetUrlObj.host;
const targetPath = targetUrlObj.pathname;

const auth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');

const options = {
  host: proxyHost,
  port: proxyPort,
  method: 'GET',
  path: targetUrl,
  headers: {
    'Host': targetHost,
    'Proxy-Authorization': auth
  }
};

const req = http.request(options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}
{% endtabs %}

For further information on how to create and manage these lists, please refer to the 'IP Skipping' subsection located within the 'Dashboard' section of our documentation.

{% content-ref url="/pages/gmZJgntSzAmsHbx88vk2" %}
[IP Skipping](/proxies/residential/dashboard/configuration/ip-skipping)
{% endcontent-ref %}


# Domain Filtering (previously Allowances)

The Domain Filtering (previously Allowances) feature is split into two sections:

* **Restrictions** section that enables you to list domains our proxies will not access
* **Permissions** section that enables you to create a whitelist of accessible domains

For further information on how to create and manage these lists, please refer to the 'Domain Filtering' (previously ‘Allowances’) subsection located within the ‘Dashboard’ section of our documentation.

{% content-ref url="/pages/PJVYfwbN2RowIuCyeXJM" %}
[Domain Filtering (previously Allowances)](/proxies/residential/dashboard/configuration/domain-filtering-previously-allowances)
{% endcontent-ref %}

<br>


# Protocols

When configuring your proxy, it's important to consider the protocol that best suits your needs. There are two primary types available: HTTP/HTTPS and SOCKS5. Each protocol operates on its distinct set of ports and serves different purposes. We offer two primary types of proxy protocols.

{% hint style="warning" %}
Please note that our Residential proxies are compatible with **TCP** connections.
{% endhint %}

### HTTP/HTTPS

This is the most widely used protocol for web browsing. Our HTTP proxies are ideal for accessing websites and managing web-based traffic. For enhanced security, particularly when handling sensitive data, our HTTPS proxy adds an encryption layer to secure the data transmission between the client and the server. These proxies typically function on ports designated explicitly for HTTP or HTTPS traffic.

### SOCKS5

For a more versatile solution, our SOCKS5 proxies handle all types of traffic, not just limited to web browsing. This makes them particularly suitable for activities such as P2P sharing and VoIP calls. SOCKS5 proxies offer improved performance and security features and operate on different ports than those used by HTTP/HTTPS, accommodating a broader range of traffic types.

{% hint style="info" %}
In the upcoming 'Making Requests' section, we will delve into the specifics of how to effectively use each of these protocols.
{% endhint %}


# Making Requests

In this section, we'll show practical examples of using the proxy string we've created. We'll focus on setting up HTTP/HTTPS and SOCKS5 connections, illustrated through examples in various programming languages.

{% hint style="warning" %}
Keep in mind that the ports will differ depending on the protocol **(HTTP/SOCKS5)**.
{% endhint %}

### HTTP/HTTPS

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v -x http://username123:password321_country-us_state-california@geo.iproyal.com:12321 -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://ipv4.icanhazip.com';
$proxy = 'geo.iproyal.com:12321';
$proxyAuth = 'username123:password321_country-us_state-california';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
```

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');

const url = 'https://ipv4.icanhazip.com';
const proxyOptions = {
  host: 'geo.iproyal.com',
  port: 12321,
  auth: {
    username: 'username123',
    password: 'password321_country-us_state-california'
  }
};

axios.get(url, { proxy: proxyOptions })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
proxy = 'geo.iproyal.com:12321'
proxy_auth = 'username123:password321_country-us_state-california'
proxies = {
    'http': f'http://{proxy_auth}@{proxy}',
    'https': f'http://{proxy_auth}@{proxy}'
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}

### SOCKS5

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v -x socks5://username123:password321_country-us_state-california@geo.iproyal.com:32325 -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

<pre class="language-php"><code class="lang-php"><strong>&#x3C;?php
</strong>
$url = 'https://ipv4.icanhazip.com';
$proxy = 'geo.iproyal.com:32325';
$proxyAuth = 'username123:password321_country-us_state-california';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
</code></pre>

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');
const SocksProxyAgent = require('socks-proxy-agent');

const url = 'https://ipv4.icanhazip.com';
const socksProxy = 'socks5://username123:password321_country-us_state-california@geo.iproyal.com:32325';
const agent = new SocksProxyAgent(socksProxy);

axios.get(url, { httpAgent: agent, httpsAgent: agent })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
socks5_proxy = 'socks5://username123:password321_country-us_state-california@geo.iproyal.com:32325'
proxies = {
    'http': socks5_proxy,
    'https': socks5_proxy
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}


# Response Codes

When a request fails, Residential Proxies return an HTTP response code to indicate what went wrong. Use these codes to diagnose issues and adjust your configuration accordingly.

**500 - Internal Error**

An internal process failed - such as an inability to verify or resolve a request component. Retry the request. If the issue persists, contact IPRoyal Support.

**503 - No Exits Available**

No proxy exit nodes match the filters you specified. Review your session parameters (such as country, city) and verify that the requested location or filter combination is currently available.

**504 - Exit Connection Failed**

An exit node was selected but could not establish a connection. This is typically a transient network issue. Retry the request or adjust your target parameters.


# China Entry Nodes

To improve connectivity and reliability when accessing our Residential Proxies from China (or nearby regions), we provide a set of alternative regional entry domains.

These domains function exactly like our standard proxy gateway, but may offer better stability, lower latency, and fewer connection issues for specific geographies.

| Region    | Entry domain    |
| --------- | --------------- |
| US        | us.xpt9k2wq.com |
| Europe    | eu.xpt9k2wq.com |
| Singapore | sg.xpt9k2wq.com |
| Hong Kong | hk.xpt9k2wq.com |
| Australia | au.xpt9k2wq.com |

### How to Use These Nodes

Simply replace your usual proxy hostname with one of the regional domains.

Here's a cURL example with Singapore entry domain:

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v -x http://username123:password321@sg.xpt9k2wq.com:12321 -L https://ipv4.icanhazip.com
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
NOTE: Geo-routing is not supported using these nodes at the moment.
{% endhint %}


# Sub-Users

Our system's sub-user feature is a powerful tool designed to enable our users to become resellers, thereby opening up new business opportunities. By leveraging this feature, users are empowered to create and manage numerous sub-users, essentially setting up a network that can be offered to other parties. This feature not only facilitates the expansion of our users' service offerings but also allows them to establish and grow their own businesses. It's a seamless way for users to scale operations, diversify their business models, and explore new revenue streams by reselling access to sub-users.

Users can easily manage their sub-users directly through our streamlined dashboard. This allows for quick adjustments and oversight of sub-user activities, ensuring the smooth operation of their reseller functions.

{% content-ref url="/pages/mBCMOxxUALC0M6dRVj4r" %}
[Sub-Users](/proxies/residential/dashboard/sub-users)
{% endcontent-ref %}


# API

{% hint style="danger" %}
As of September 15, 2025, the [legacy API](https://documenter.getpostman.com/view/10917935/Uz5KjZ8k) has been deprecated and is no longer supported. Please migrate to the new API to ensure uninterrupted service.
{% endhint %}

### URL

**`https://resi-api.iproyal.com/v1`**

### Authorization

Authentication is managed via the **`Authorization`** header. To ensure secure access, all requests must include this header, followed by your API token, prefixed with the word "Bearer" and a space. The format should be:&#x20;

**`Authorization`**`:`**`Bearer <your_api_token>`**

Your API token is available on the dashboard's **Settings** page in the 'API' section. Here, you can also reset your token if necessary. Keep it secure and update your applications with the new token if you reset it.


# Sessions

### Remove Sessions <a href="#remove-sessions" id="remove-sessions"></a>

<mark style="color:red;">`DELETE`</mark> `/sessions`

**Body Parameters**

| Name                      | Type  | Description                            |
| ------------------------- | ----- | -------------------------------------- |
| residential\_user\_hashes | Array | Array of user hashes to reset sessions |

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X DELETE https://resi-api.iproyal.com/v1/sessions \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{"residential_user_hashes":["hash1","hash2","hash3"]}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/sessions';
$residential_user_hashes = ['hash1', 'hash2', 'hash3'];
$data = json_encode(['residential_user_hashes' => $residential_user_hashes]);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$headers = [
    "Authorization: Bearer $api_token",
    "Content-Type: application/json"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/sessions'
residential_user_hashes = ['hash1', 'hash2', 'hash3']
data = {'residential_user_hashes': residential_user_hashes}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.delete(url, headers=headers, json=data)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/sessions';
const residentialUserHashes = ['hash1', 'hash2', 'hash3'];
const data = JSON.stringify({ residential_user_hashes: residentialUserHashes });

const options = {
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${apiToken}`,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(url, options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String url = "https://resi-api.iproyal.com/v1/sessions";

        String requestBody = "{\"residential_user_hashes\": [\"hash1\", \"hash2\", \"hash3\"]}";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + apiToken)
                .header("Content-Type", "application/json")
                .header("X-HTTP-Method-Override", "DELETE")
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response);
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_api_token>"
	sessionsURL = "https://resi-api.iproyal.com/v1/sessions"
)

func main() {
	data := map[string]interface{}{
		"residential_user_hashes": []string{"hash1", "hash2", "hash3"},
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodDelete, sessionsURL, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}
	
	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/sessions";
        string[] residentialUserHashes = { "hash1", "hash2", "hash3" };

        var data = new
        {
            residential_user_hashes = residentialUserHashes
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");
            client.DefaultRequestHeaders.Add("Content-Type", "application/json");

            var jsonData = JsonConvert.SerializeObject(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.DeleteAsync(url, content);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# User

## Get User information <a href="#get-user-information" id="get-user-information"></a>

<mark style="color:green;">`GET`</mark> `/residential/me`

Get information about the available traffic on the main user and subusers count

**Example request:**

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/me';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/me'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/me';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/me";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	meURL    = "https://resi-api.iproyal.com/v1/me"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, meURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/me";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "available_traffic": 32.6,
    "subusers_count": 13,
    "residential_user_hash": "01H7YCG0R9GYY1YCPS2S4QA6WB"
}
```


# Access

## Get Entry Nodes

<mark style="color:green;">`GET`</mark>  `/access/entry-nodes`

Different entry nodes help to determine the faster route from the country you are situated in.

{% hint style="info" %}
In almost all cases, you should use **`geo.iproyal.com`** which will automatically determine the best server for your location.
{% endhint %}

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/access/entry-nodes \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/entry-nodes';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/entry-nodes'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/entry-nodes';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/access/entry-nodes";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken     = "<your_api_token>"
	entryNodesURL = "https://resi-api.iproyal.com/v1/access/entry-nodes"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, entryNodesURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/access/entry-nodes";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
[
    {
        "dns": "proxy.iproyal.com",
        "ips": ["91.239.130.34"],
        "ports": [
            {
                "name": "http|https",
                "port": 12321,
                "alternative_ports": [
                    11200,
                    ...
                ]
            },
            {
                "name": "socks5",
                "port": 32325,
                "alternative_ports": [
                    51200,
                    ...
                ]
            }
        ]
    },
    {
        "dns": "us.proxy.iproyal.com",
        "ips": ["23.146.144.102", "23.146.144.102"],
        "ports": [
            {
                "name": "http|https",
                "port": 12321,
                "alternative_ports": [
                    11246,
                    ...
                ]
            },
            {
                "name": "socks5",
                "port": 32325,
                "alternative_ports": [
                    51200,
                    ...
                ]
            }
        ]
    },
    ...
]
```

## Get Countries

<mark style="color:green;">`GET`</mark>  `/access/countries`

Returns a list of countries, cities, states, and ISPs (Internet Service Providers) that could be used to target a specific proxy. It also returns prefixes to use for each. For more information on how to build a proxy string, refer to our 'Proxy' subsection.

[Proxy](/proxies/residential/proxy)

{% hint style="info" %}
Depending on some settings set for you as a user, it will return different results.

* **Identity verification** - provides a larger selection of options.
* **Skip ISP Static** *(Admin activatable)* - on top of verified identity, skips static proxies.
* **ISPs enabled** (*Admin activatable*) - includes ISPs in every location.
  {% endhint %}

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/access/countries \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/countries';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/countries'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/countries';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/access/countries";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken    = "<your_api_token>"
	countriesURL = "https://resi-api.iproyal.com/v1/access/countries"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, countriesURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/access/countries";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "prefix": "_country-",
    "countries": [
        {
            "code": "am",
            "name": "Armenia",
            "cities": {
                "prefix": "_city-",
                "options": [
                    {
                        "code": "armavir",
                        "name": "Armavir",
                        "isps": {
                            "prefix": "_isp-",
                            "options": [
                                {
                                    "code": "prostieresheniallc",
                                    "name": "Prostie Reshenia LLC"
                                }
                            ]
                        }
                    }
                ]
            },
            "states": {
                "prefix": "_state-",
                "options": [
                    {
                        "code": "armavir",
                        "name": "Armavir",
                        "cities": {
                            "prefix": "_city-",
                            "options": [
                                {
                                    "code": "armavir",
                                    "name": "Armavir",
                                    "isps": {
                                        "prefix": "_isp-",
                                        "options": []
                                    }
                                }
                            ]
                        },
                        "isps": {
                            "prefix": "_isp-",
                            "options": [
                                {
                                    "code": "prostieresheniallc",
                                    "name": "Prostie Reshenia LLC"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

```

## Get Regions

Similarly to [#countries](#countries "mention"), it returns available regions for use when targeting a proxy.

<mark style="color:green;">`GET`</mark>  `/access/regions`

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/access/regions \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/regions';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/regions'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/regions';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/access/regions";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken  = "<your_api_token>"
	regionsURL = "https://resi-api.iproyal.com/v1/access/regions"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, regionsURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/access/regions";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "prefix": "_region-",
    "regions": [
        {
            "code": "africa",
            "name": "Africa"
        },
        {
            "code": "arabstates",
            "name": "Arab States"
        },
        {
            "code": "asiapacific",
            "name": "Asia & Pacific"
        },
        {
            "code": "europe",
            "name": "Europe"
        },
        {
            "code": "middleeast",
            "name": "Middle east"
        },
        {
            "code": "northamerica",
            "name": "North America"
        },
        {
            "code": "southlatinamerica",
            "name": "South/Latin America"
        }
    ]
}
```

## Get Country Sets

<mark style="color:green;">`GET`</mark>  `/access/country-sets`

Similarly to [#countries](#countries "mention"), it returns available country sets to use when targeting a proxy.

**Example request:**&#x20;

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/access/country-sets \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/country-sets';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/country-sets'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/country-sets';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/access/country-sets";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	countrySetsURL = "https://resi-api.iproyal.com/v1/access/country-sets"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, countrySetsURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/access/country-sets";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "prefix": "_set-",
    "countrySets": [
        {
            "code": "courir",
            "name": "COURIR"
        },
        {
            "code": "mesh1",
            "name": "MESH 1"
        },
        {
            "code": "mesh2",
            "name": "MESH 2"
        },
        {
            "code": "nikeas",
            "name": "NIKE ASIA"
        },
        {
            "code": "nikeeu",
            "name": "NIKE EU"
        },
        {
            "code": "nikena",
            "name": "NIKE US"
        },
        {
            "code": "zalando",
            "name": "ZALANDO"
        }
    ]
}
```

## Generate Proxy List

<mark style="color:blue;">`POST`</mark>  `/access/generate-proxy-list`

{% hint style="info" %}
If **`subuser_hash`** is supplied, **`username`** and **`password`** are not needed, and vice versa - if **`username`** and **`password`** are supplied - **`subuser_hash`** is not needed.
{% endhint %}

{% hint style="info" %}
The location you wish to use needs to be prefixed with a "prefix" that is described in the [#get-countries](#get-countries "mention"), for example if you want to target Singapore - "**\_country-sg**"
{% endhint %}

**Body Parameters**

<table><thead><tr><th width="154">Name</th><th width="167">Type</th><th width="201">Description</th><th>Available options</th></tr></thead><tbody><tr><td>format</td><td>String</td><td>Format in which proxy strings will be returned</td><td><p></p><pre><code><strong>{hostname}:{port}:{username}:{password}
</strong>{hostname}:{port}@{username}:{password}
{username}:{password}:{hostname}:{port}
</code></pre></td></tr><tr><td>hostname</td><td>String</td><td>Hostname that will be used</td><td><a data-mention href="#entry-nodes">#entry-nodes</a></td></tr><tr><td>port</td><td>String</td><td>Port as protocol type</td><td><pre><code>http|https
socks5
</code></pre></td></tr><tr><td>rotation</td><td>String</td><td>Rotation that will be used</td><td><p></p><pre><code>sticky
random
</code></pre></td></tr><tr><td>subuser_hash</td><td>String</td><td>Subuser that will be used</td><td></td></tr><tr><td>location</td><td>String</td><td>Location that will be used</td><td><a data-mention href="#get-countries">#get-countries</a></td></tr><tr><td>proxy_count</td><td>Integer</td><td>Proxy count that will be returned</td><td></td></tr><tr><td>username</td><td>String</td><td>Username that will be used</td><td></td></tr><tr><td>password</td><td>String</td><td>Password that will be used</td><td></td></tr><tr><td>lifetime</td><td>String</td><td>For sticky sessions this will tell how long this session will last</td><td><pre><code>5s
10m
20h

</code></pre></td></tr></tbody></table>

**Example request:**&#x20;

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST https://resi-api.iproyal.com/v1/access/generate-proxy-list \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer <your_api_token>" \
     -d '{
           "format": "{hostname}:{port}:{username}:{password}",
           "hostname": "example.hostname.com",
           "port": "http|https",
           "rotation": "sticky",
           "location": "_country-sg",
           "proxy_count": 10,
           "subuser_hash": "example_subuser_hash",
           "lifetime": "2h"
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/generate-proxy-list';

$data = [
    'format' => '{hostname}:{port}:{username}:{password}',
    'hostname' => 'example.hostname.com',
    'port' => 'http|https',
    'rotation' => 'sticky',
    'location' => '_country-sg',
    'proxy_count' => 10,
    'subuser_hash' => 'example_subuser_hash'
];

$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    "Authorization: Bearer $api_token"
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/generate-proxy-list'

data = {
    'format': '{hostname}:{port}:{username}:{password}',
    'hostname': 'example.hostname.com',
    'port': 'http|https',
    'rotation': 'sticky',
    'location': '_country-sg',
    'proxy_count': 10,
    'subuser_hash': 'example_subuser_hash'
}

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {api_token}'
}

response = requests.post(url, json=data, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/generate-proxy-list';

const data = JSON.stringify({
  format: '{hostname}:{port}:{username}:{password}',
  hostname: 'example.hostname.com',
  port: 'http|https',
  rotation: 'sticky',
  location: '_country-sg',
  proxy_count: 10,
  subuser_hash: 'example_subuser_hash'
});

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/access/generate-proxy-list";

        String requestBody = """
            {
                "format": "{hostname}:{port}:{username}:{password}",
                "hostname": "example.hostname.com",
                "port": "http|https",
                "rotation": "sticky",
                "location": "_country-sg",
                "proxy_count": 10,
                "subuser_hash": "example_subuser_hash",
                "lifetime": "2h"
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken  = "<your_api_token>"
	proxyURL  = "https://resi-api.iproyal.com/v1/access/generate-proxy-list"
)

func main() {
	data := map[string]interface{}{
		"format":        "{hostname}:{port}:{username}:{password}",
		"hostname":      "example.hostname.com",
		"port":          "http|https",
		"rotation":      "sticky",
		"location":      "_country-sg",
		"proxy_count":   10,
		"subuser_hash":  "example_subuser_hash",
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, proxyURL, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Text;
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/access/generate-proxy-list";

        var data = new
        {
            format = "{hostname}:{port}:{username}:{password}",
            hostname = "example.hostname.com",
            port = "http|https",
            rotation = "sticky",
            location = "_country-sg",
            proxy_count = 10,
            subuser_hash = "example_subuser_hash"
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
[
    "geo.iproyal.com:0:info@iproyal.com:royal123_session-abc123_lifetime-24h",
    "geo.iproyal.com:0:info@iproyal.com:royal123_session-cba321_lifetime-24h",
]
```


# Orders

## Get Orders

<mark style="color:green;">`GET`</mark> `/residential/orders`

**Query Parameters**

| Name      | Type    | Description                      |
| --------- | ------- | -------------------------------- |
| page      | Integer | Number of page                   |
| per\_page | Integer | Number of orders to get per page |

#### Example request:

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://resi-api.iproyal.com/v1/residential/orders?page=1&per_page=10" \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/residential/orders?page=1&per_page=10';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/residential/orders?page=1&per_page=10'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/residential/orders?page=1&per_page=10';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/residential/orders?page=1&per_page=10";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	url    = "https://resi-api.iproyal.com/v1/residential/orders?page=1&per_page=10"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/residential/orders?page=1&per_page=10";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### Example response:

```json
{
  "data": [
    {
      "id": 4,
      "note": null,
      "product_name": "Residential",
      "status": "confirmed",
      "amount": 50,
      "quantity": 10,
      "order_billing_type": "subscription",
      "created_at": "2025-06-26 10:01:50"
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 20,
    "total": 1
  }
}
```

## Create Order

<mark style="color:blue;">`POST`</mark> `/residential/orders`

**Body Parameters:**

| Name                 | Type    | Description                                                                                              |
| -------------------- | ------- | -------------------------------------------------------------------------------------------------------- |
| quantity             | Integer | GB quantity                                                                                              |
| coupon\_code         | String  | A discount code to apply to the order, if available.                                                     |
| card\_id             | Integer | If supplied - card will be billed for this order, if not - we will try to deduct the amount from balance |
| order\_billing\_type | String  | `subscription` or `regular` default - `subscription`                                                     |

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST https://resi-api.iproyal.com/v1/residential/orders \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{"quantity": 10}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/residential/orders';

$data = ['quantity' => 10];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/residential/orders'

data = {'quantity': 10}

headers = {
    'Authorization': 'Bearer ' + api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';

const data = JSON.stringify({quantity: 10});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: '/v1/residential/orders',
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + apiToken,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_api_token>";
        String url = "https://resi-api.iproyal.com/v1/residential/orders";

        String requestBody = """
            {
                "quantity": 10
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "log"
    "net/http"
)

const (
    apiToken = "<your_api_token>"
    url      = "https://resi-api.iproyal.com/v1/residential/orders"
)

func main() {
    data := map[string]interface{}{
        "quantity": 10,
    }
    
    jsonData, err := json.Marshal(data)
    if err != nil {
        log.Fatal("Error marshaling JSON:", err)
    }
    
    req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
    if err != nil {
        log.Fatal("Error creating request:", err)
    }
    
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal("Error making request:", err)
    }
    defer resp.Body.Close()
    
    fmt.Println("Status Code:", resp.StatusCode)
    
    responseBody, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatal("Error reading response body:", err)
    }
    
    var jsonResponse map[string]interface{}
    err = json.Unmarshal(responseBody, &jsonResponse)
    if err != nil {
        log.Fatal("Error unmarshaling JSON:", err)
    }
    
    fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/residential/orders";

        var data = new
        {
            quantity = 10,
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Response:**

```json
{
    "id": 4,
    "note": null,
    "product_name": "Residential",
    "status": "confirmed",
    "amount": 50,
    "quantity": 10,
    "order_billing_type": "subscription",
    "created_at": "2025-06-26 10:01:50"
}
```

## Calculate Pricing

<mark style="color:green;">`GET`</mark> `/residential/orders/calculate-pricing`

**Query Parameters:**

| Name                 | Type    | Description                                          |
| -------------------- | ------- | ---------------------------------------------------- |
| quantity             | Integer | Required. The amount of the product to order.        |
| coupon\_code         | String  | Optional. Discount code for the order.               |
| order\_billing\_type | String  | `subscription` or `regular` default - `subscription` |

#### Example request:

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/residential/orders/calculate-pricing \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{"quantity": 10}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';

$data = ['quantity' => 10];
$url = 'https://resi-api.iproyal.com/v1/residential/orders/calculate-pricing' . http_build_query($data);

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/residential/orders/calculate-pricing'

data = {'quantity': 10}

headers = {
    'Authorization': 'Bearer ' + api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';

const data = JSON.stringify({quantity: 10});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: '/v1/residential/orders/calculate-pricing',
  method: 'GET',
  headers: {
    'Authorization': 'Bearer ' + api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        Number quantity = 10;
        String url = "https://resi-api.iproyal.com/v1/residential/orders/calculate-pricing?quantity=" + quantity;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + accessToken)
                .GET()
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "log"
    "net/http"
)

const (
    apiToken = "<your_api_token>"
    url      = "https://resi-api.iproyal.com/v1/residential/orders/calculate-pricing"
)

func main() {
    data := map[string]interface{}{
        "quantity": 10,
    }
    
    jsonData, err := json.Marshal(data)
    if err != nil {
        log.Fatal("Error marshaling JSON:", err)
    }
    
    req, err := http.NewRequest(http.MethodGet, url, bytes.NewBuffer(jsonData))
    if err != nil {
        log.Fatal("Error creating request:", err)
    }
    
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal("Error making request:", err)
    }
    defer resp.Body.Close()
    
    fmt.Println("Status Code:", resp.StatusCode)
    
    responseBody, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatal("Error reading response body:", err)
    }
    
    var jsonResponse map[string]interface{}
    err = json.Unmarshal(responseBody, &jsonResponse)
    if err != nil {
        log.Fatal("Error unmarshaling JSON:", err)
    }
    
    fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_key>";
        string baseUrl = "https://resi-api.iproyal.com/v1/residential/orders/calculate-pricing";
        int quantity = 10;
        string url = $"{baseUrl}?quantity={quantity}";
        
        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + apiToken);
            
            HttpResponseMessage response = await client.GetAsync(url);
            Console.WriteLine((int)response.StatusCode);
            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### Example response:

```json
{
  "total": 50
}
```


# Subscription

## Get Subscription

<mark style="color:green;">`GET`</mark> `/residential/subscription`

#### Example request:

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/residential/subscription';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/residential/subscription'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/residential/subscription';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/residential/subscription";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	url    = "https://resi-api.iproyal.com/v1/residential/subscription"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/residential/subscription";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### Example response:

```json
{
  "quantity": 1000,
  "amount": 3150,
  "status": "paid",
  "next_payment_date": "2025-07-26",
  "payment_method": "balance",
  "card_id": null
}
```

## Delete Subscription

<mark style="color:red;">`DELETE`</mark> `/residential/subscription`

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X DELETE https://resi-api.iproyal.com/v1/residential/subscription \
     -H "Authorization: Bearer <your_api_token>"
     -H "Content-Type: application/json" 
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/residential/subscription';

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/residential/orders'

headers = {
    'Authorization': 'Bearer ' + api_token,
    'Content-Type': 'application/json'
}

response = requests.delete(url, headers=headers)

print(response.status_code)
if response.status_code == 204:
    print("Subscription deleted successfully")
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');
const apiToken = '<your_api_token>';

const options = {
  hostname: 'resi-api.iproyal.com',
  path: '/v1/residential/subscription',
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer ' + apiToken,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  console.log('Status Code:', res.statusCode);
  let responseData = '';
  res.on('data', (chunk) => {
    responseData += chunk;
  });
  res.on('end', () => {
    if (responseData) {
      console.log('Response:', responseData);
    } else {
      console.log('No response body');
    }
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String url = "https://resi-api.iproyal.com/v1/residential/subscription";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .DELETE()
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "encoding/json"
    "fmt"
    "io"
    "log"
    "net/http"
)

const (
    apiToken = "<your_api_token>"
    url      = "https://resi-api.iproyal.com/v1/residential/subscription"
)

func main() {
    req, err := http.NewRequest(http.MethodDelete, url, nil)
    if err != nil {
        log.Fatal("Error creating request:", err)
    }
    
    req.Header.Set("Authorization", "Bearer "+apiToken)
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal("Error making request:", err)
    }
    defer resp.Body.Close()
    
    fmt.Println("Status Code:", resp.StatusCode)
    
    responseBody, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatal("Error reading response body:", err)
    }
    
    if len(responseBody) > 0 {
        var jsonResponse map[string]interface{}
        err = json.Unmarshal(responseBody, &jsonResponse)
        if err != nil {
            log.Fatal("Error unmarshaling JSON:", err)
        }
        fmt.Printf("%+v\n", jsonResponse)
    } else {
        fmt.Println("No response body")
    }
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/residential/subscription";
        
        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + apiToken);
            HttpResponseMessage response = await client.DeleteAsync(url);
            Console.WriteLine((int)response.StatusCode);
            
            string responseText = await response.Content.ReadAsStringAsync();
            
            if (!string.IsNullOrEmpty(responseText))
            {
                var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
                Console.WriteLine(jsonResponse);
            }
            else
            {
                Console.WriteLine("No response body");
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Change payment method

<mark style="color:blue;">`POST`</mark> `/residential/subscription/change-payment-method`

**Query Parameters:**

| Name            | Type    | Description                       |
| --------------- | ------- | --------------------------------- |
| payment\_method | String  | `balance` or `card`               |
| card\_id        | Integer | Card that is attached to the user |

#### Example request:

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST https://resi-api.iproyal.com/v1/residential/subscription/change-payment-method \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer <your_api_token>" \
     -d '{
           "payment_method": "card",
           "card_id": 1231
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/residential/subscription/change-payment-method';

$data = [
    'payment_method' => 'card',
    'card_id' => 1231
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/residential/subscription/change-payment-method';

data = {
    'payment_method': 'card',
    'card_id': 1231
}

headers = {
    'Authorization': 'Bearer ' + api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';

const data = JSON.stringify({payment_method: 'balance'});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: '/v1/residential/subscription/change-payment-method',
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + apiToken,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://resi-api.iproyal.com/v1/residential/subscription/change-payment-method";

        String requestBody = """
            {
                "payment_method": "card",
                "card_id": 1231
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "log"
    "net/http"
)

const (
    apiToken = "<your_api_token>"
    url      = "https://resi-api.iproyal.com/v1/residential/subscription/change-payment-method"
)

func main() {
    data := map[string]interface{}{
        "payment_method": "balance",
    }

    jsonData, err := json.Marshal(data)
    if err != nil {
        log.Fatal("Error marshaling JSON:", err)
    }

    req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
    if err != nil {
        log.Fatal("Error creating request:", err)
    }

    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal("Error making request:", err)
    }
    defer resp.Body.Close()

    fmt.Println("Status Code:", resp.StatusCode)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/residential/subscription/change-payment-method";

        var data = new
        {
            payment_method = "card",
            card_id = 322
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# Sub-Users

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

[Sub-Users](/proxies/residential/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.

{% code title="SubuserResource" %}

```json
{
    "id": 5,
    "hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
    "username": "subuser_231",
    "password": "asffqwv2f3w4214v",
    "traffic_available": 0.25,
    "traffic_used": 0
}
```

{% endcode %}

{% hint style="warning" %}
Note that you should not use the **`id`** field. It is a legacy field that will be removed in the future.
{% endhint %}

***

{% hint style="info" %}
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.
{% endhint %}

***

## Create Sub-User

<mark style="color:blue;">`POST`</mark>  `/residential-subusers`

**Body Parameters**

<table><thead><tr><th width="142">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td>username</td><td>String</td><td>username of the subuser</td></tr><tr><td>password</td><td>String</td><td>password of the subuser</td></tr><tr><td>traffic</td><td>Float</td><td>traffic (GB) that will be assigned to the subuser</td></tr><tr><td>limits</td><td>Array</td><td><p>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.</p><pre><code>"limits": {                 
                 "daily_limit": 5000,
                 "monthly_limit": 150000,
                 "lifetime_limit": 1000000
}
</code></pre></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/residential-subusers';

$data = [
    'username' => 'subuser123',
    'password' => 'securepassword',
    'traffic' => 10.0
];

$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    "Authorization: Bearer $api_token"
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/residential-subusers'

data = {
    'username': 'subuser123',
    'password': 'securepassword',
    'traffic': 10.0
}

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {api_token}'
}

response = requests.post(url, json=data, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/residential-subusers';

const data = JSON.stringify({
  username: 'subuser123',
  password: 'securepassword',
  traffic: 10.0
});

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String url = "https://resi-api.iproyal.com/v1/residential-subusers";

        String requestBody = """
            {
                "username": "subuser123",
                "password": "securepassword",
                "traffic": 10.0
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken          = "<your_api_token>"
	residentialSubusersURL = "https://resi-api.iproyal.com/v1/residential-subusers"
)

func main() {
	data := map[string]interface{}{
		"username": "subuser123",
		"password": "securepassword",
		"traffic":  10.0,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, residentialSubusersURL, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/residential-subusers";

        var data = new
        {
            username = "subuser123",
            password = "securepassword",
            traffic = 10.0
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 5,
    "hash": "02JVRQ5BF83PTW19G1SRD955J0",
    "username": "subuser123",
    "password": "securepassword",
    "traffic_available": 10,
    "traffic_used": 0
}
```

## Get Sub-User

<mark style="color:green;">`GET`</mark>  `/residential-subusers/{ hash }`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>hash</code></td><td>String</td><td>hash of the subuser</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = "https://resi-api.iproyal.com/v1/residential-subusers/{hash}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $api_token"
]);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
hash = '<subuser_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-subusers/{hash}'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const hash = '<subuser_hash>';
const url = `https://resi-api.iproyal.com/v1/residential-subusers/${hash}`;

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${api_token}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();

```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String subuserHash = "<subuser_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-subusers/%s", subuserHash);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	subuserHash = "<subuser_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-subusers/%s", subuserHash)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string hash = "<subuser_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-subusers/{hash}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 5,
    "hash": "02JVRQ5BF83PTW19G1SRD955J0",
    "username": "subuser123",
    "password": "securepassword",
    "traffic_available": 10,
    "traffic_used": 0
}
```

## Get Sub-Users

<mark style="color:green;">`GET`</mark>  `/residential-subusers`

**Query Parameters**

<table><thead><tr><th width="134">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td>page</td><td>Integer</td><td>Number of the page</td></tr><tr><td>per_page</td><td>Integer</td><td>Number of subusers per page</td></tr><tr><td>search</td><td>String</td><td>Search that will be used to filter subusers by username</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$page = 1;
$per_page = 10;
$search = 'username_search';

$url = "https://resi-api.iproyal.com/v1/residential-subusers?page=$page&per_page=$per_page&search=$search";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $api_token"
]);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
page = 1
per_page = 10
search = 'username_search'

url = f'https://resi-api.iproyal.com/v1/residential-subusers?page={page}&per_page={per_page}&search={search}'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const page = 1;
const per_page = 10;
const search = 'username_search';

const url = `https://resi-api.iproyal.com/v1/residential-subusers?page=${page}&per_page=${per_page}&search=${search}`;

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${api_token}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        int page = 1;
        int perPage = 10;
        String search = "username_search";

        String urlString = String.format(
            "https://resi-api.iproyal.com/v1/residential-subusers?page=%d&per_page=%d&search=%s", 
            page, perPage, search
        );

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_api_token>"
	page     = 1
	perPage  = 10
	search   = "username_search"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-subusers?page=%d&per_page=%d&search=%s", page, perPage, search)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        int page = 1;
        int perPage = 10;
        string search = "username_search";
        string url = $"https://resi-api.iproyal.com/v1/residential-subusers?page={page}&per_page={perPage}&search={search}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "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

<mark style="color:orange;">`UPDATE`</mark>  `/residential-subusers/{ hash }`

**Query Parameters**

<table><thead><tr><th width="178">Name</th><th width="112">Type</th><th>Description</th></tr></thead><tbody><tr><td>hash</td><td>String</td><td>hash of the subuser</td></tr></tbody></table>

**Body Parameters**

<table><thead><tr><th width="173">Name</th><th width="122">Type</th><th>Description</th></tr></thead><tbody><tr><td>username</td><td>String</td><td>username of the subuser</td></tr><tr><td>password</td><td>String</td><td>password of the subuser</td></tr><tr><td>traffic</td><td>Float</td><td>traffic (GB) that will be assigned to the subuser</td></tr><tr><td>limits</td><td>Array</td><td><p>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.</p><pre><code>"limits": {                 
                 "daily_limit": 5000,
                 "monthly_limit": 150000,
                 "lifetime_limit": 1000000
}
</code></pre></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$hash = '<subuser_hash>';
$username = 'new_username';
$password = 'new_password';
$traffic = 5.0;

$url = "https://resi-api.iproyal.com/v1/residential-subusers/$hash";

$data = [
    'username' => $username,
    'password' => $password,
    'traffic' => $traffic
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'UPDATE',
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
hash = '<subuser_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-subusers/{hash}'

data = {
    'username': 'new_username',
    'password': 'new_password',
    'traffic': 5.0
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.put(url, json=data, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const hash = '<subuser_hash>';
const data = JSON.stringify({
  username: 'new_username',
  password: 'new_password',
  traffic: 5.0
});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-subusers/${hash}`,
  method: 'UPDATE',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String subuserHash = "<subuser_hash>";
        String url = "https://resi-api.iproyal.com/v1/residential-subusers/" + subuserHash;

        String requestBody = """
            {
                "username": "new_username",
                "password": "new_password",
                "traffic": 5.0
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .PUT(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken    = "<your_api_token>"
	subuserHash = "<subuser_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-subusers/%s", subuserHash)

	data := map[string]interface{}{
		"username": "new_username",
		"password": "new_password",
		"traffic":  5.0,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPut, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string hash = "<subuser_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-subusers/{hash}";

        var data = new
        {
            username = "new_username",
            password = "new_password",
            traffic = 5.0
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");
            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PutAsync(url, content);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 5,
    "hash": "02JVRQ5BF83PTW19G1SRD955J0",
    "username": "new_username",
    "password": "new_password",
    "traffic_available": 5,
    "traffic_used": 0
}
```

## Delete Sub-User

<mark style="color:red;">`DELETE`</mark>  `/residential-subusers/{ hash }`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>hash</code></td><td>String</td><td>hash of the subuser</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X DELETE "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$hash = '<subuser_hash>';

$url = "https://resi-api.iproyal.com/v1/residential-subusers/$hash";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
hash = '<subuser_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-subusers/{hash}'

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.delete(url, headers=headers)

print(response.status_code)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const hash = '<subuser_hash>';

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-subusers/${hash}`,
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String subuserHash = "<subuser_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-subusers/%s", subuserHash);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("DELETE");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("DELETE request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"log"
	"net/http"
)

const (
	apiToken    = "<your_api_token>"
	subuserHash = "<subuser_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-subusers/%s", subuserHash)

	req, err := http.NewRequest(http.MethodDelete, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody := new(bytes.Buffer)
	_, err = responseBody.ReadFrom(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(responseBody.String())
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string hash = "<subuser_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-subusers/{hash}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.DeleteAsync(url);

            Console.WriteLine((int)response.StatusCode);
            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Add Traffic to Sub-User

<mark style="color:blue;">`POST`</mark>  `/residential-subusers/{ hash }/give-traffic`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>hash</code></td><td>String</td><td>hash of the subuser</td></tr></tbody></table>

**Body Parameters**

<table><thead><tr><th width="142">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Float</td><td>amount of traffic (GB) to give</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$hash = '<subuser_hash>';
$amount = 5.0;

$url = "https://resi-api.iproyal.com/v1/residential-subusers/$hash/give-traffic";

$data = [
    'amount' => $amount
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
hash = '<subuser_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-subusers/{hash}/give-traffic'

data = {
    'amount': 5.0
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const hash = '<subuser_hash>';
const amount = 5.0;
const data = JSON.stringify({ amount });

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-subusers/${hash}/give-traffic`,
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String subuserHash = "<subuser_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-subusers/%s/give-traffic", subuserHash);

        String jsonData = String.format("{\"amount\": %s}", 5.0);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setDoOutput(true);

            OutputStream os = connection.getOutputStream();
            os.write(jsonData.getBytes());
            os.flush();
            os.close();

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("POST request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken    = "<your_api_token>"
	subuserHash = "<subuser_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-subusers/%s/give-traffic", subuserHash)

	data := map[string]interface{}{
		"amount": 5.0,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string hash = "<subuser_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-subusers/{hash}/give-traffic";

        var data = new
        {
            amount = 5.0
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);
            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 5,
    "hash": "02JVRQ5BF83PTW19G1SRD955J0",
    "username": "new_username",
    "password": "new_password",
    "traffic_available": 15,
    "traffic_used": 0
}
```

## Take Traffic From Sub-User

<mark style="color:blue;">`POST`</mark>  `/residential-subusers/{ hash }/take-traffic`

**Query Parameters**

<table><thead><tr><th width="134">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td>hash</td><td>String</td><td>hash of the subuser</td></tr></tbody></table>

**Body Parameters**

<table><thead><tr><th width="142">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Float</td><td>amount of traffic (GB) to give</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$hash = '<subuser_hash>';
$amount = 5.0;

$url = "https://resi-api.iproyal.com/v1/residential-subusers/$hash/take-traffic";

$data = [
    'amount' => $amount
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
hash = '<subuser_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-subusers/{hash}/take-traffic'

data = {
    'amount': 5.0
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const hash = '<subuser_hash>';
const amount = 5.0;
const data = JSON.stringify({ amount });

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-subusers/${hash}/take-traffic`,
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String subuserHash = "<subuser_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-subusers/%s/take-traffic", subuserHash);

        String jsonData = String.format("{\"amount\": %s}", 5.0);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setDoOutput(true);

            OutputStream os = connection.getOutputStream();
            os.write(jsonData.getBytes());
            os.flush();
            os.close();

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("POST request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken    = "<your_api_token>"
	subuserHash = "<subuser_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-subusers/%s/take-traffic", subuserHash)

	data := map[string]interface{}{
		"amount": 5.0,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string hash = "<subuser_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-subusers/{hash}/take-traffic";

        var data = new
        {
            amount = 5.0
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);
            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 5,
    "hash": "02JVRQ5BF83PTW19G1SRD955J0",
    "username": "new_username",
    "password": "new_password",
    "traffic_available": 10,
    "traffic_used": 0
}
```


# Whitelists

The link provided below directs to a detailed page that elaborates on the concept of a whitelist within our system.

[IP Whitelisting](/proxies/residential/proxy/ip-whitelisting)

***

It's important to note that almost every endpoint related to whitelists, with the notable exceptions of the **`index`** and **`delete`** endpoints, will return a whitelist entry resource upon a successful call.

{% code title="WhitelistEntryResource" %}

```json
{
    "hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
    "ip": "192.0.2.1",
    "port": "23234",
    "type": "http|https",
    "configuration": "_country-br_streaming-1_skipispstatic-1"
}
```

{% endcode %}

***

## Create Whitelist Entry

<mark style="color:blue;">`POST`</mark>  `/residential-users/{ residential_user_hash }/whitelist-entries`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr></tbody></table>

**Body Parameters**

<table><thead><tr><th width="149">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td>ip</td><td>String</td><td>Ip of the entry</td></tr><tr><td>port</td><td>Integer</td><td>Port that will be used</td></tr><tr><td>configuration</td><td>String</td><td>Proxy configuration</td></tr><tr><td>note</td><td>String</td><td>Proxy note</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "ip": "192.168.1.1",
           "port": 8080,
           "configuration": "some_configuration"
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$ip = '192.168.1.1';
$port = 8080;
$configuration = 'some_configuration';

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries";

$data = [
    'ip' => $ip,
    'port' => $port,
    'configuration' => $configuration
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries'

data = {
    'ip': '192.168.1.1',
    'port': 8080,
    'configuration': 'some_configuration'
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const ip = '192.168.1.1';
const port = 8080;
const configuration = 'some_configuration';
const data = JSON.stringify({ ip, port, configuration });

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/whitelist-entries`,
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String url = "https://resi-api.iproyal.com/v1/residential-users/" + residentialUserHash + "/whitelist-entries";

        String requestBody = """
            {
                "ip": "192.168.1.1",
                "port": 8080,
                "configuration": "some_configuration"
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries", residentialUserHash)

	data := map[string]interface{}{
		"ip":            "192.168.1.1",
		"port":          8080,
		"configuration": "some_configuration",
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/whitelist-entries";

        var data = new
        {
            ip = "192.168.1.1",
            port = 8080,
            configuration = "some_configuration"
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);
            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "hash": "01JVRVH56YYVG2RZDFA123ABCD",
    "ip": "192.168.1.1",
    "port": 8080,
    "type": "?",
    "configuration": "some_configuration",
    "note": null
}
```

## Get Whitelist Entry

<mark style="color:green;">`GET`</mark>  `/residential-users/{ residential_user_hash }/whitelist-entries/{ whitelist_entry_hash }`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr><tr><td>whitelist_entry_hash</td><td>String</td><td>Hash of the entry</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries/<whitelist_entry_hash>" \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$whitelist_entry_hash = '<whitelist_entry_hash>';

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries/$whitelist_entry_hash";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token"
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const whitelist_entry_hash = '<whitelist_entry_hash>';

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/whitelist-entries/${whitelist_entry_hash}`,
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${api_token}`
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String whitelistEntryHash = "<whitelist_entry_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries/%s", residentialUserHash, whitelistEntryHash);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
	whitelistEntryHash  = "<whitelist_entry_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries/%s", residentialUserHash, whitelistEntryHash)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string whitelistEntryHash = "<whitelist_entry_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/whitelist-entries/{whitelistEntryHash}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "hash": "01JVRVH56YYVG2RZDFA123ABCD",
    "ip": "192.168.1.1",
    "port": 8080,
    "type": "?",
    "configuration": "some_configuration",
    "note": null
}
```

## Get Whitelist Entries

<mark style="color:green;">`GET`</mark>  `/residential-users/{ residential_user_hash }/whitelist-entries/`

**Query Parameters**

<table><thead><tr><th width="222">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr><tr><td>page</td><td>Integer</td><td>Number of the page</td></tr><tr><td>per_page</td><td>Integer</td><td>Number of whitelist entries per page</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries?page=<page>&per_page=<per_page>" \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$page = 1;
$per_page = 10;

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries?page=$page&per_page=$per_page";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token"
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
page = 1
per_page = 10
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries?page={page}&per_page={per_page}'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const page = 1;
const per_page = 10;

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/whitelist-entries?page=${page}&per_page=${per_page}`,
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${api_token}`
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        int page = 1;
        int perPage = 10;
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries?page=%d&per_page=%d", residentialUserHash, page, perPage);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
	page                = 1
	perPage             = 10
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries?page=%d&per_page=%d", residentialUserHash, page, perPage)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        int page = 1;
        int perPage = 10;
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/whitelist-entries?page={page}&per_page={perPage}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "data": [
        {
            "hash": "01JVRVH56YYVG2RZDFA123ABCD",
            "ip": "192.168.1.1",
            "port": 8080,
            "type": "?",
            "configuration": "some_configuration",
            "note": null
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "/",
        "per_page": 20,
        "to": 1,
        "total": 1
    }
}
```

## Update Whitelist Entry

<mark style="color:orange;">`UPDATE`</mark>  `/residential-users/{ residential_user_hash }/whitelist-entries/{ whitelist_entry_hash }`

**Query Parameters**

<table><thead><tr><th width="229">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr><tr><td>whitelist_entry_hash</td><td>String</td><td>Hash of the entry</td></tr></tbody></table>

**Body Parameters**

<table><thead><tr><th width="156">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td>configuration</td><td>String</td><td>Proxy configuration</td></tr><tr><td>note</td><td>String</td><td>Proxy note</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X PUT "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries/<whitelist_entry_hash>" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "configuration": "updated_configuration"
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'

configuration = {
    'configuration': {}
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.put(url, json=configuration, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'

configuration = {
    'configuration': {}
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.put(url, json=configuration, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const whitelist_entry_hash = '<whitelist_entry_hash>';
const configuration = JSON.stringify({
  configuration: {}
});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/whitelist-entries/${whitelist_entry_hash}`,
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json',
    'Content-Length': configuration.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(configuration);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String whitelistEntryHash = "<whitelist_entry_hash>";
        String url = "https://resi-api.iproyal.com/v1/residential-users/" + residentialUserHash + "/whitelist-entries/" + whitelistEntryHash;

        String requestBody = """
            {
                "configuration": {}
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .PUT(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
	whitelistEntryHash  = "<whitelist_entry_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries/%s", residentialUserHash, whitelistEntryHash)

	configuration := map[string]interface{}{
		"configuration": map[string]interface{}{},
	}

	jsonData, err := json.Marshal(configuration)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPut, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string whitelistEntryHash = "<whitelist_entry_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/whitelist-entries/{whitelistEntryHash}";

        var configuration = new
        {
            configuration = ""
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(configuration);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PutAsync(url, content);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}

```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "hash": "01JVRVH56YYVG2RZDFA123ABCD",
    "ip": "192.168.1.1",
    "port": 8080,
    "type": "?",
    "configuration": "updated_configuration",
    "note": null
}
```

## Delete Whitelist Entry

<mark style="color:red;">`DELETE`</mark>  `/residential-users/{ residential_user_hash }/whitelist-entries/{ whitelist_entry_hash }`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr><tr><td>whitelist_entry_hash</td><td>String</td><td>Hash of the entry</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X DELETE "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries/<whitelist_entry_hash>" \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$whitelist_entry_hash = '<whitelist_entry_hash>';

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries/$whitelist_entry_hash";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token"
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.delete(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const whitelist_entry_hash = '<whitelist_entry_hash>';

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/whitelist-entries/${whitelist_entry_hash}`,
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${api_token}`
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String whitelistEntryHash = "<whitelist_entry_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries/%s", residentialUserHash, whitelistEntryHash);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("DELETE");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("DELETE request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
	whitelistEntryHash  = "<whitelist_entry_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/whitelist-entries/%s", residentialUserHash, whitelistEntryHash)

	req, err := http.NewRequest(http.MethodDelete, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string whitelistEntryHash = "<whitelist_entry_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/whitelist-entries/{whitelistEntryHash}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.DeleteAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# IP Skipping

The link provided below directs to a detailed page that elaborates on the concept of IP skipping within our system.

[IP Skipping](/proxies/residential/proxy/ip-skipping)

***

It's important to note that almost every endpoint related to IP skipping, with the notable exceptions of the **`index`** and **`delete`** endpoints, will return an IP skipping resource upon a successful call.

{% code title="IpSkippingResource" %}

```json
{
    "hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
    "title": "192.0.2.1",
    "items": [
        {
            "hash": "01HQJ5GS1NXBP562CCQFQB6XN7",
            "ip_range": "24.52.81.2/32"
        },
        {
            "hash": "01HQJ5GW9NXBCC62CCQFQB6XN7",
            "ip_range": "14.51.82.2/32"
        }
    ]
}
```

{% endcode %}

***

## Create IP Skipping List

<mark style="color:blue;">`POST`</mark>  `/residential-users/{residential_user_hash}/ips-skipping`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr></tbody></table>

**Body Parameters**

<table><thead><tr><th width="232">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td>title</td><td>String</td><td>Title of the IP skipping list</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/ips-skipping" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "title": "Your Title"
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$title = 'Your Title';

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/ips-skipping";

$data = ['title' => $title];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
title = 'Your Title'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/ips-skipping'

data = {
    'title': title
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const title = 'Your Title';

const data = JSON.stringify({
  title: title
});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/ips-skipping`,
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String url = "https://resi-api.iproyal.com/v1/residential-users/" + residentialUserHash + "/ips-skipping";

        String requestBody = """
            {
                "title": "Your Title"
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
	title               = "Your Title"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/ips-skipping", residentialUserHash)

	data := map[string]interface{}{
		"title": title,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string title = "Your Title";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/ips-skipping";

        var data = new
        {
            title = title
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
    "title": "Your Title",
    "items": [
        {
            "hash": "01HQJ5GS1NXBP562CCQFQB6XN7",
            "ip_range": "24.52.81.2/32"
        },
        {
            "hash": "01HQJ5GW9NXBCC62CCQFQB6XN7",
            "ip_range": "14.51.82.2/32"
        }
    ]
}
```

## Get IP Skipping Lists

<mark style="color:green;">`GET`</mark>  `/residential-users/{residential_user_hash}/ips-skipping`

**Query Parameters**

<table><thead><tr><th width="222">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr><tr><td>page</td><td>Integer</td><td>Page number to return</td></tr><tr><td>per_page</td><td>Integer</td><td>Number of lists returned per page</td></tr><tr><td>search_key</td><td>String</td><td>Case-insensitive substring filter. Only lists whose title contains this value are returned.</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/ips-skipping" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/ips-skipping";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/ips-skipping'

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/ips-skipping`,
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-users/%s/ips-skipping", residentialUserHash);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/ips-skipping", residentialUserHash)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Printf(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/ips-skipping";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "data": [
        {
            "hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
            "title": "Your Title",
            "items": [
                {
                    "hash": "01HQJ5GS1NXBP562CCQFQB6XN7",
                    "ip_range": "24.52.81.2/32"
                },
                {
                    "hash": "01HQJ5GW9NXBCC62CCQFQB6XN7",
                    "ip_range": "14.51.82.2/32"
                }
            ]
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "/",
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}
```

## Update IP Skipping List

<mark style="color:orange;">`UPDATE`</mark>  `/residential-users/{residential_user_hash}/ips-skipping/{ips_skipping_hash}`

**Query Parameters**

<table><thead><tr><th width="229">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr><tr><td>ips_skipping_hash</td><td>String</td><td>Hash of the IPs skipping list</td></tr></tbody></table>

**Body Parameters**

<table><thead><tr><th width="156">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td>title</td><td>String</td><td>Title of the skipping list</td></tr><tr><td>ip_ranges</td><td>Array</td><td>Ranges to be added to the list</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X PUT "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/ips-skipping/<ips_skipping_hash>" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "title": "New Title",
           "ip_ranges": ["192.168.0.0/24", "10.0.0.0/8"]
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$ips_skipping_hash = '<ips_skipping_hash>';
$title = 'New Title';
$ip_ranges = ['192.168.0.0/24', '10.0.0.0/8'];

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/ips-skipping/$ips_skipping_hash";

$data = [
    'title' => $title,
    'ip_ranges' => $ip_ranges
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
ips_skipping_hash = '<ips_skipping_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/ips-skipping/{ips_skipping_hash}'

data = {
    'title': 'New Title',
    'ip_ranges': ['192.168.0.0/24', '10.0.0.0/8']
}

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.put(url, json=data, headers=headers)

print(response.status_code)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const ips_skipping_hash = '<ips_skipping_hash>';
const title = 'New Title';
const ip_ranges = ['192.168.0.0/24', '10.0.0.0/8'];
const data = JSON.stringify({ title, ip_ranges });

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/ips-skipping/${ips_skipping_hash}`,
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String ipsSkippingHash = "<ips_skipping_hash>";
        String url = "https://resi-api.iproyal.com/v1/residential-users/" + residentialUserHash + "/ips-skipping/" + ipsSkippingHash;

        String requestBody = """
            {
                "title": "New Title",
                "ip_ranges": ["192.168.0.0/24", "10.0.0.0/8"]
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + apiToken)
                .PUT(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
	ipsSkippingHash     = "<ips_skipping_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/ips-skipping/%s", residentialUserHash, ipsSkippingHash)

	data := map[string]interface{}{
		"title":     "New Title",
		"ip_ranges": []string{"192.168.0.0/24", "10.0.0.0/8"},
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPut, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string ipsSkippingHash = "<ips_skipping_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/ips-skipping/{ipsSkippingHash}";

        var data = new
        {
            title = "New Title",
            ip_ranges = new string[] { "192.168.0.0/24", "10.0.0.0/8" }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PutAsync(url, content);

            Console.WriteLine((int)response.StatusCode);
            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}

```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
    "title": "New Title",
    "items": [
        {
            "hash": "01HQJ5GS1NXBP562CCQFQB6XN7",
            "ip_range": "192.168.0.0/24"
        },
        {
            "hash": "01HQJ5GW9NXBCC62CCQFQB6XN7",
            "ip_range": "10.0.0.0/8"
        }
    ]
}
```

## Delete IP Skipping List

<mark style="color:red;">`DELETE`</mark>  `/residential-users/{residential_user_hash}/ips-skipping/{ips_skipping_hash}`

**Query Parameters**

<table><thead><tr><th width="234">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td>residential_user_hash</td><td>String</td><td>Hash of the user</td></tr><tr><td>ips_skipping_hash</td><td>String</td><td>Hash of the IPs skipping list</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X DELETE "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/ips-skipping/<ips_skipping_hash>" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$ips_skipping_hash = '<ips_skipping_hash>';

$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/ips-skipping/$ips_skipping_hash";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
ips_skipping_hash = '<ips_skipping_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/ips-skipping/{ips_skipping_hash}'

headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}

response = requests.delete(url, headers=headers)

print(response.status_code)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const ips_skipping_hash = '<ips_skipping_hash>';

const options = {
  hostname: 'resi-api.iproyal.com',
  path: `/v1/residential-users/${residential_user_hash}/ips-skipping/${ips_skipping_hash}`,
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${api_token}`,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String residentialUserHash = "<residential_user_hash>";
        String ipsSkippingHash = "<ips_skipping_hash>";
        String urlString = String.format("https://resi-api.iproyal.com/v1/residential-users/%s/ips-skipping/%s", residentialUserHash, ipsSkippingHash);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("DELETE");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("DELETE request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"log"
	"net/http"
)

const (
	apiToken            = "<your_api_token>"
	residentialUserHash = "<residential_user_hash>"
	ipsSkippingHash     = "<ips_skipping_hash>"
)

func main() {
	url := fmt.Sprintf("https://resi-api.iproyal.com/v1/residential-users/%s/ips-skipping/%s", residentialUserHash, ipsSkippingHash)

	req, err := http.NewRequest(http.MethodDelete, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string residentialUserHash = "<residential_user_hash>";
        string ipsSkippingHash = "<ips_skipping_hash>";
        string url = $"https://resi-api.iproyal.com/v1/residential-users/{residentialUserHash}/ips-skipping/{ipsSkippingHash}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.DeleteAsync(url);

            Console.WriteLine((int)response.StatusCode);
            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# Reports

## Get Data Usage Report

<mark style="color:green;">`GET`</mark> `/residential/data-usage-report`

Returns a data usage report as a CSV file for the given residential user or sub-user. The `hash` must belong to the authenticated caller's account. An empty date range returns a CSV with headers only.

**Query Parameters**

| Name              | Type    | Description                                                                                                                                                                   |
| ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| hash              | String  | The `app_hash` of the residential user or sub-user to generate the report for                                                                                                 |
| date\_from        | String  | Start date of the report range in `Y-m-d` format                                                                                                                              |
| date\_to          | String  | End date of the report range in `Y-m-d` format. Must be on or after `date_from`                                                                                               |
| measurement\_unit | String  | Unit for traffic values. One of: `B`, `KB`, `MB`, `GB`                                                                                                                        |
| rounding\_decimal | Integer | Number of decimal places for traffic values (must be `0` or greater)                                                                                                          |
| time\_zone        | String  | *Optional.* IANA timezone name used to bucket traffic by date (e.g. `Europe/London`, `America/New_York`, `UTC`). Case-insensitive. When omitted, the default timezone is used |

All parameters except `time_zone` are required.

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://resi-api.iproyal.com/v1/residential/data-usage-report?hash=asd48w4f5c1s2a5w4f8h5t6r1v&date_from=2026-01-01&date_to=2026-01-31&measurement_unit=GB&rounding_decimal=2" \
    -H "Authorization: Bearer <your_api_token>" \
    -o data-usage-report.csv
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$query = http_build_query([
    'hash' => 'asd48w4f5c1s2a5w4f8h5t6r1v',
    'date_from' => '2026-01-01',
    'date_to' => '2026-01-31',
    'measurement_unit' => 'GB',
    'rounding_decimal' => 2,
]);

$ch = curl_init("https://resi-api.iproyal.com/v1/residential/data-usage-report?{$query}");
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer <your_api_token>']);
curl_setopt($ch, CURLOPT_FILE, fopen('data-usage-report.csv', 'w'));
curl_exec($ch);
curl_close($ch);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

params = {
    "hash": "asd48w4f5c1s2a5w4f8h5t6r1v",
    "date_from": "2026-01-01",
    "date_to": "2026-01-31",
    "measurement_unit": "GB",
    "rounding_decimal": 2,
}
headers = {"Authorization": "Bearer <your_api_token>"}

response = requests.get(
    "https://resi-api.iproyal.com/v1/residential/data-usage-report",
    params=params,
    headers=headers,
    stream=True,
)

with open("data-usage-report.csv", "wb") as f:
    for chunk in response.iter_content(chunk_size=8192):
        f.write(chunk)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const fs = require("fs");
const https = require("https");

const params = new URLSearchParams({
    hash: "asd48w4f5c1s2a5w4f8h5t6r1v",
    date_from: "2026-01-01",
    date_to: "2026-01-31",
    measurement_unit: "GB",
    rounding_decimal: "2",
});

const options = {
    headers: { Authorization: "Bearer <your_api_token>" },
};

https.get(
    `https://resi-api.iproyal.com/v1/residential/data-usage-report?${params}`,
    options,
    (res) => res.pipe(fs.createWriteStream("data-usage-report.csv")),
);
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://resi-api.iproyal.com/v1/residential/data-usage-report"
        + "?hash=asd48w4f5c1s2a5w4f8h5t6r1v"
        + "&date_from=2026-01-01"
        + "&date_to=2026-01-31"
        + "&measurement_unit=GB"
        + "&rounding_decimal=2"))
    .header("Authorization", "Bearer <your_api_token>")
    .GET()
    .build();

client.send(request, HttpResponse.BodyHandlers.ofFile(Path.of("data-usage-report.csv")));
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "io"
    "net/http"
    "os"
)

func main() {
    url := "https://resi-api.iproyal.com/v1/residential/data-usage-report" +
        "?hash=asd48w4f5c1s2a5w4f8h5t6r1v" +
        "&date_from=2026-01-01&date_to=2026-01-31" +
        "&measurement_unit=GB&rounding_decimal=2"

    req, _ := http.NewRequest("GET", url, nil)
    req.Header.Set("Authorization", "Bearer <your_api_token>")

    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()

    out, _ := os.Create("data-usage-report.csv")
    defer out.Close()
    io.Copy(out, resp.Body)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <your_api_token>");

var url = "https://resi-api.iproyal.com/v1/residential/data-usage-report"
    + "?hash=asd48w4f5c1s2a5w4f8h5t6r1v"
    + "&date_from=2026-01-01&date_to=2026-01-31"
    + "&measurement_unit=GB&rounding_decimal=2";

await using var stream = await client.GetStreamAsync(url);
await using var file = File.Create("data-usage-report.csv");
await stream.CopyToAsync(file);
```

{% endtab %}
{% endtabs %}

**Response**

The endpoint returns a CSV file as an attachment.

**Response headers:**

```
Content-Type: text/csv
Content-Disposition: attachment; filename="data-usage-{hash}-{date_from}-{date_to}.csv"
```

**Example response:**

```csv
date,hostname,port,data,measurement unit,requests count
2026-01-01,example.com,443,2.15,GB,1248
2026-01-01,api.example.com,443,4.78,GB,5310
2026-01-01,cdn.example.com,80,0.92,GB,612
2026-01-02,example.com,443,1.84,GB,1102
2026-01-02,api.example.com,443,5.23,GB,6047
2026-01-03,example.com,443,3.07,GB,2415
2026-01-03,images.example.com,443,8.41,GB,9823
,,total:,26.40,,26557
```


# Domain Access Terms

It’s important to note that certain domains will not be accessible via Residential Proxies. The requirements to access them are as follows:

The following domains become available after you confirm your identity on IPRoyal:

* Login.yahoo.com
* Login.live.com
* Linkedin.com
* All Ticketswap websites
* Banks in this[ list](https://docs.google.com/spreadsheets/d/14BQ7L-KlmILqlWEPW6G06KXnEh3JLOW_kH9msaijZjo/edit).

The following domains become available after you confirm your identity and spend over $500 on IPRoyal:

* All .gov websites
* PlayStation websites.

The following domains will remain inaccessible even when you meet these conditions:

* Secure.gsb-yourbank.com
* Digital.iberiabank.com
* Wyndlabs.ai (sharing in grass.io is not allowed)

To access these domains, you need to contact our support team via email or live chat.


# ISP

At IPRoyal, we offer a wide selection of [ISP Proxies](https://iproyal.com/isp-proxies/) across multiple countries, so our clients have access to a variety of options. We also update our proxy network regularly to ensure our clients can always rely on new proxies for all their tasks.

### Key Advantages of IPRoyal ISP Proxies <a href="#key-advantages-of-iproyal-static-residential-proxies" id="key-advantages-of-iproyal-static-residential-proxies"></a>

* **Highly competitive pricing**

We offer discounts on the number of purchased proxies, along with additional discounts for longer periods (5% off with the 60-day plan and 10% off with the 90-day plan) advanced features, high reliability, and [excellent customer satisfaction](https://www.trustpilot.com/review/iproyal.com).

* **Excellent location coverage**

Our proxies are available in many countries on four continents. We’re also constantly adding new locations. If you need a location we don’t offer, contact our support team and we’ll consider adding it.

* **Premium ISP providers**

Regardless of the location you choose, you can rest assured that each IP comes from a premium local internet service provider.

* **High speeds**

With speeds of up to 100 Mbps, we offer a reliable solution even for the most bandwidth-intensive tasks.

* **HTTPS & SOCKS5 compatible**

Choose the protocol that suits your needs to get the best results with any usage case.

* **24/7 support**

With an average response time of just 58 seconds, our skilled team of experts is available around the clock and ready to help you set up and make the most of your proxies.

### Technical Features of IPRoyal ISP Proxies <a href="#technical-features-of-iproyal-static-residential-proxies" id="technical-features-of-iproyal-static-residential-proxies"></a>

* **99.9% uptime**

Consistent uptime and reliable connections around the clock enable you to access the resources you need whenever you need them.

* **State and city targeting**

Take advantage of unmatched precision with proxy targeting at the state and city level, empowering you to tailor your operations for specific regions.

* **Dual authentication**

Enhance security by managing proxy access through username and password or IP whitelisting authentication, ensuring only authorized users can connect.

* **Dedicated IPs**

Each ISP proxy is reserved just for you to offer ultimate online privacy and full control over your online activities.

* **Unlimited sessions**

Maximize your potential with zero session restrictions for complete online freedom.

* **Easy integration & API support**

Optimize your workflow and simplify operations with a hassle-free user experience.


# Dashboard

In this part of the guide, we offer clear and thorough instructions for mastering the dashboard's functionalities. This guide is designed to be user-friendly, ensuring that both beginners and seasoned users can efficiently maximize the benefits of our services using the dashboard.


# Orders

In the 'ISP proxies' dashboard, the 'Orders' panel provides a comprehensive view of all your orders, encompassing active, expired, and unpaid ones. This panel is equipped with advanced filtering options, allowing you to sort and view orders based on a variety of criteria beyond just their status. These filters facilitate efficient management and quick access to specific orders. Each order entry includes convenient features to view its details, download an invoice, or extend its duration.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FC4kOX2CQ4FjPLUhQ7VE7%2FI1.png?alt=media&amp;token=90ef2f96-1cd4-4d10-a8ac-3153df0300a3" alt=""><figcaption></figcaption></figure>


# Order Configuration

To begin configuring your order, you first need to access its details page.

First, navigate to the 'ISP' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click on 'Details' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F5QeXI4N466JTFLaVx17l%2FA1.png?alt=media&amp;token=6984b051-fc24-4659-8122-d519a275e736" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
In the page you will find a section labeled 'Subscription'. We will discuss this feature in more detail in the 'Extending an Order' section.\
[Extending an Order](/proxies/isp/dashboard/extending-an-order)
{% endhint %}

Upon entering this page, you will first encounter the 'Proxy details' and 'Order details' toggle (<mark style="color:orange;">1</mark>). The 'Proxy details' page covers the proxy configuration options, while the 'Order details' page offers an order overview and subscription management options.

Next, you’ll see the 'Formatted Proxy List' section (<mark style="color:orange;">2</mark>).

This displays your proxies in a user-friendly format, providing all the essential details for each proxy connection. You can 'Copy' the list to your clipboard or 'Download List' for offline access. Additionally, you can choose the format and specify how many proxies to display or export. This efficient setup gives you quick access to your proxy details for immediate use.

Next, you'll find a panel designed for managing proxy credentials (<mark style="color:orange;">3</mark>). This feature enables you to change the username and password for either all proxies in the order or for individual proxies.

Finally, you will come across the ‘Whitelisted IPs’ panel (<mark style="color:orange;">4</mark>). This feature allows you to add specific IP addresses to the list and ensure only authorized users have access to your proxies. Users with authorized (or whitelisted) IPs also don’t need to use the proxy username and password for authentication.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FRpkJ3Wcz62NVkhQ9sc06%2FA2.png?alt=media&amp;token=45b9be65-e558-4350-b79f-5b0a2d1f711f" alt=""><figcaption></figcaption></figure>

By switching to the 'Order details' panel (<mark style="color:orange;">1</mark>) you will get some basic information about the order (<mark style="color:orange;">2</mark>) and the status of your subscription (<mark style="color:orange;">3</mark>). It also gives you the option of extending specific IP addresses in your order (<mark style="color:orange;">4</mark>).

Next, you will come across a panel for adding a note (<mark style="color:orange;">5</mark>). This feature allows you to write something for future reference. Importantly, you will be able to search for the order using the content of your note.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FR3eYa9RwKVtj4QLCK2wq%2FA3.png?alt=media&amp;token=c8cbba4f-fa6f-49a9-a521-f47e1145f293" alt=""><figcaption></figcaption></figure>


# Extending an Order

There is an option to extend your order, a useful feature as it ensures you keep the IPs you've been provided. There are two methods for extending:

* A manual extension where you can go to the orders dashboard and simply click 'Extend';
* A subscription. Enabling this option will let you virtually forget about manual extensions, as it automatically renews the order each time it nears expiration.

When extending your order, you also have the option to change your plan. For instance, if you initially had a 90-day plan but only need the proxies for one more day or an additional month, you can adjust the duration accordingly during the extension process. The same option is available with a subscription.

Additionally, you can select the IP addresses you want to extend or subscribe to. This option is useful if you want to downsize your order but still keep specific IPs.

{% hint style="info" %}
Note: You can only extend orders that are still active. Once order status becomes Expired, it cannot be extended or renewed.
{% endhint %}

### Manual Extension

Navigate to the 'ISP' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click 'Extend' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Fu3JyGKqEXtXiwCdOm2t0%2FC1.png?alt=media&amp;token=7ba5760a-485b-4dbb-829e-aa3de182bae2" alt=""><figcaption></figcaption></figure>

In this section, you have the flexibility to select a new plan or continue with the current one (<mark style="color:orange;">1</mark>), while also choosing specific IPs you want to extend (<mark style="color:orange;">2</mark>). Additionally, you can view the 'Expire Date' to determine when the plan is set to expire. Once you’re satisfied with your choices, click 'Continue' (<mark style="color:orange;">3</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FgselT9gqDWvVW5Kor749%2FC2.png?alt=media&amp;token=cc650d23-4987-4b78-b078-f6546918c40c" alt=""><figcaption></figcaption></figure>

Following this, you will be directed to a familiar page where you can proceed with the extension process and complete the payment for the extension.

### Subscription

To enable subscriptions, please navigate to the 'Order details' section (<mark style="color:orange;">1</mark>) on the ‘Order Configuration’ page.

On this page, you will find a panel that allows you to enable a subscription (<mark style="color:orange;">2</mark>) for this order. You can modify the plan (<mark style="color:orange;">3</mark>) and extend specific proxies (<mark style="color:orange;">4</mark>). Once you’re satisfied with your choices, select your preferred payment method (<mark style="color:orange;">5</mark>) and click ‘Save’ (<mark style="color:orange;">6</mark>) to enable a subscription.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FYkGzu04KDyWfxDwmIAuW%2FC3.png?alt=media&amp;token=301a1fc9-d19b-4538-b039-dbd97bce81fe" alt=""><figcaption></figcaption></figure>


# Using Proxy Strings

In this section, we'll show practical examples of using the proxy string we've created. We'll focus on setting up HTTP/HTTPS and SOCKS5 connections, illustrated through examples in various programming languages.

Our ISP proxies are compatible with both UDP and TCP connections.

{% hint style="warning" %}
Keep in mind that the ports will differ depending on the protocol **(HTTP/SOCKS5)**. To choose between HTTP or SOCKS5 proxies, please refer to the 'Formatted Proxy List' panel within the 'Order Configuration' section.\
\
[Order Configuration](/proxies/isp/dashboard/order-configuration)
{% endhint %}

### HTTP/HTTPS

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v -x http://191.116.125.248:12323 --proxy-user aea1bcf5cb3:e8c6a622fe -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://ipv4.icanhazip.com';
$proxy = '191.116.125.248:12323';
$proxyAuth = '1aea1bcf5cb3:e8c6a622fe';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
```

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');

const url = 'https://ipv4.icanhazip.com';
const proxyOptions = {
  host: '191.116.125.248',
  port: 12323,
  auth: {
    username: '1aea1bcf5cb3',
    password: 'e8c6a622fe'
  }
};

axios.get(url, { proxy: proxyOptions })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
proxy = '191.116.125.248:12323'
proxy_auth = '1aea1bcf5cb3:e8c6a622fe'
proxies = {
    'http': f'http://{proxy_auth}@{proxy}',
    'https': f'http://{proxy_auth}@{proxy}'
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}

### SOCKS5

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v --socks5 191.116.125.248:12324 --proxy-user aea1bcf5cb3:e8c6a622fe -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

<pre class="language-php"><code class="lang-php"><strong>&#x3C;?php
</strong>
$url = 'https://ipv4.icanhazip.com';
$proxy = '191.116.125.248:12324';
$proxyAuth = '1aea1bcf5cb3:e8c6a622fe';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
</code></pre>

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');
const SocksProxyAgent = require('socks-proxy-agent');

const url = 'https://ipv4.icanhazip.com';
const socksProxy = 'socks5://1aea1bcf5cb3:e8c6a622fe@191.116.125.248:12324';
const agent = new SocksProxyAgent(socksProxy);

axios.get(url, { httpAgent: agent, httpsAgent: agent })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
socks5_proxy = 'socks5://1aea1bcf5cb3:e8c6a622fe@191.116.125.248:12324'
proxies = {
    'http': socks5_proxy,
    'https': socks5_proxy
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}


# API

{% hint style="danger" %}
As of September 15, 2025, the [legacy API](https://documenter.getpostman.com/view/10917935/UV5WFK8M) has been deprecated and is no longer supported. Please migrate to the new API to ensure uninterrupted service.
{% endhint %}

### Base URL

**`https://apid.iproyal.com/v1/reseller`**

### Authorization

To authorize your API calls, we validate the **`X-Access-Token`** header. You can find and reset this token on the dashboard's **Settings** page in the 'API' section.


# User

## Get Balance

<mark style="color:green;">`GET`</mark>  `/balance`

Returns the user's balance.

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/balance" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/balance";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/balance'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/balance',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/balance";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/balance"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Printf(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/balance";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
884.05
```

## Get Cards

<mark style="color:green;">`GET`</mark>  `/cards`

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/cards" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;

$url = "https://apid.iproyal.com/v1/reseller/cards";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345

url = f'https://apid.iproyal.com/v1/reseller/cards'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/cards`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        int orderId = 12345;
        String urlString = String.format("https://apid.iproyal.com/v1/reseller/cards");

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/cards")

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/cards";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "data": [
        {
            "id": 2,
            "provider": "stripe",
            "custom_name": null,
            "payment_method": "card",
            "card_type": "visa",
            "currency": "USD",
            "last_four_digits": "1234",
            "expiry_date": "2026/01",
            "update_url": null,
            "cancel_url": null,
            "products_with_order_ids": [],
            "has_royal_auto_extend_enabled": false,
            "updated_at": "2025-04-11T14:06:28.000000Z"
        },
    ]
}
```


# Products

## Get Products

<mark style="color:green;">`GET`</mark>  `/products`

Returns a product list containing **plans**, **locations**, **questions** and **quantity discounts.**

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/products" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/products',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/products'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/products',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/products";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/products"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/products";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "id": 9,
            "name": "Static Residential",
            "plans": [
                {
                    "id": 4,
                    "name": "30 Days",
                    "price": 2,
                    "min_quantity": 5,
                    "max_quantity": 100000
                },
                ...
            ],
            "locations": [
                {
                    "id": 51,
                    "name": "Australia",
                    "out_of_stock": false,
                    "available_proxies_count": 1142,
                    "child_locations": []
                },
                ...
            ],
            "questions": [
                {
                    "id": 5,
                    "text": "On which website do you plan to use them?",
                    "is_required": false
                }
            ],
            "quantity_discounts": [
                {
                    "quantity_from": 99,
                    "discount_percent": 5
                },
                ...
            ]
        },
        ...
    ]
}
```


# Orders

{% hint style="info" %}
Options like **product\_id**, **location\_id**, and more can be retrieved using the **Products** endpoint.

[Products](/proxies/isp/api/products)
{% endhint %}

## Get Orders

<mark style="color:green;">`GET`</mark> `/orders`

**Query Parameters**

<table><thead><tr><th width="203.3671875">Name</th><th>Type</th><th>Description</th><th>Available options</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td><td></td></tr><tr><td>page</td><td>Integer</td><td>Number of page</td><td></td></tr><tr><td>per_page</td><td>Integer</td><td>Number of orders to get per page</td><td></td></tr><tr><td>location_id</td><td>Integer</td><td>Location id</td><td></td></tr><tr><td>status</td><td>String</td><td>Order status</td><td><p></p><pre><code>unpaid
in-progress
confirmed
refunded
expired
</code></pre></td></tr><tr><td>note_search</td><td>String</td><td>Phrases in order's note field to search by</td><td></td></tr><tr><td>order_ids</td><td>Array</td><td>Order ids to get</td><td></td></tr><tr><td>sort_by</td><td>String</td><td>Column to sort by. Required with order</td><td></td></tr><tr><td>order</td><td>String</td><td>Sort order. Required with sort_by</td><td><pre><code>asc
desc
</code></pre></td></tr><tr><td>statuses</td><td>Array</td><td>Order statuses. Must contain only values from the available options.</td><td><pre><code>unpaid
in-progress
confirmed
refunded
expired
</code></pre></td></tr><tr><td>status_is_expiring_soon</td><td>Boolean</td><td>Is order expiring soon</td><td></td></tr><tr><td>order_billing_type</td><td>String</td><td>Order billing type</td><td><pre><code>subscription
regular
</code></pre></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders?product_id=123&page=1&per_page=10&location_id=456&status=in-progress&note_search=example%20note&order_ids[]=789&order_ids[]=1011" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'page' => 1,
    'per_page' => 10,
    'location_id' => 456,
    'status' => 'in-progress',
    'note_search' => 'example note',
    'order_ids' => [789, 1011]
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'page': 1,
    'per_page': 10,
    'location_id': 456,
    'status': 'in-progress',
    'note_search': 'example note',
    'order_ids[]': [789, 1011]
}

url = 'https://apid.iproyal.com/v1/reseller/orders'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  page: 1,
  per_page: 10,
  location_id: 456,
  status: 'in-progress',
  note_search: 'example note',
});

const orderIds = [789, 1011];
orderIds.forEach(id => params.append('order_ids[]', id));

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders?${params.toString()}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/orders";

        Map<String, String> params = Map.of(
                "product_id", "123",
                "page", "1",
                "per_page", "10",
                "location_id", "456",
                "status", "in-progress",
                "note_search", "example note"
        );

        List<String> orderIds = List.of("789", "1011");

        StringBuilder queryParams = new StringBuilder();
        try {
            for (Map.Entry<String, String> entry : params.entrySet()) {
                if (queryParams.length() > 0) {
                    queryParams.append("&");
                }
                queryParams.append(URLEncoder.encode(entry.getKey(), "UTF-8"))
                        .append("=")
                        .append(URLEncoder.encode(entry.getValue(), "UTF-8"));
            }

            for (String orderId : orderIds) {
                if (queryParams.length() > 0) {
                    queryParams.append("&");
                }
                queryParams.append(URLEncoder.encode("order_ids[]", "UTF-8"))
                        .append("=")
                        .append(URLEncoder.encode(orderId, "UTF-8"));
            }

            URL url = new URL(urlString + "?" + queryParams.toString());
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	params := url.Values{}
	params.Add("product_id", "123")
	params.Add("page", "1")
	params.Add("per_page", "10")
	params.Add("location_id", "456")
	params.Add("status", "in-progress")
	params.Add("note_search", "example note")

	orderIds := []string{"789", "1011"}
	for _, id := range orderIds {
		params.Add("order_ids[]", id)
	}

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "page", "1" },
            { "per_page", "10" },
            { "location_id", "456" },
            { "status", "in-progress" },
            { "note_search", "example note" },
        };

        List<string> orderIds = new List<string> { "789", "1011" };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var query = new List<string>();
            
            foreach (var param in queryParams)
            {
                query.Add($"{Uri.EscapeDataString(param.Key)}={Uri.EscapeDataString(param.Value)}");
            }
            
            foreach (var orderId in orderIds)
            {
                query.Add($"{Uri.EscapeDataString("order_ids[]")}={Uri.EscapeDataString(orderId)}");
            }

            string queryString = string.Join("&", query);
            string urlWithParams = $"{url}?{queryString}";

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "id": 420,
            "note": null,
            "product_name": "Static Residential",
            "expire_date": "2024-04-20 10:25:12",
            "plan_name": "30 Days",
            "status": "confirmed",
            "location": "United States",
            "locations": "United States",
            "quantity": 5,
            "questions_answers": [
                {
                    "question": "Extra requirements (if you have any):",
                    "answer": "I need 128.158.97"
                }
            ],
            "proxy_data": {
                "ports": {
                    "socks5": 12324,
                    "http|https": 12323
                },
                "proxies": []
            },
            "auto_extend_settings": null,
            "extended_history": []
        },
        ...
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 2,
        "path": "https://apid.iproyal.com/v1/reseller/orders",
        "per_page": 10,
        "to": 10,
        "total": 14
    }
}
```

## Get Order

<mark style="color:green;">`GET`</mark>  `/orders/{order_id}`

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/12345" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345

url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        int orderId = 12345;
        String urlString = String.format("https://apid.iproyal.com/v1/reseller/orders/%d", orderId);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d", orderID)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "expire_date": "2024-04-20 10:25:12",
    "plan_name": "30 Days",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Calculate Pricing

<mark style="color:green;">`GET`</mark>  `/orders/calculate-pricing`

**Query Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th><th>Available options</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td><td></td></tr><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td><td></td></tr><tr><td>product_location_id</td><td>Integer</td><td>Product location id</td><td></td></tr><tr><td>quantity</td><td>Integer</td><td>Proxy quantity</td><td></td></tr><tr><td>coupon_code</td><td>String</td><td>Coupon code</td><td></td></tr><tr><td>order_id</td><td>Integer</td><td>Order id</td><td></td></tr><tr><td>order_billing_type</td><td>String</td><td>Order billing type</td><td><pre><code>subscription
regular
</code></pre></td></tr><tr><td>product_question_answers</td><td>Array</td><td>Product question answers</td><td></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'product_location_id' => 789,
    'quantity' => 10,
    'coupon_code' => 'DISCOUNT2024'
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'product_plan_id': 456,
    'product_location_id': 789,
    'quantity': 10,
    'coupon_code': 'DISCOUNT2024'
}

url = 'https://apid.iproyal.com/v1/reseller/orders/calculate-pricing'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  product_plan_id: 456,
  product_location_id: 789,
  quantity: 10,
  coupon_code: 'DISCOUNT2024'
}).toString();

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/calculate-pricing?${params}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing" +
                "?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .GET()
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing"
)

func main() {
	params := url.Values{}
	params.Add("product_id", fmt.Sprintf("%d", 123))
	params.Add("product_plan_id", fmt.Sprintf("%d", 456))
	params.Add("product_location_id", fmt.Sprintf("%d", 789))
	params.Add("quantity", fmt.Sprintf("%d", 10))
	params.Add("coupon_code", "DISCOUNT2024")

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "product_plan_id", "456" },
            { "product_location_id", "789" },
            { "quantity", "10" },
            { "coupon_code", "DISCOUNT2024" }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var urlWithParams = new UriBuilder(url) { Query = await new FormUrlEncodedContent(queryParams).ReadAsStringAsync() }.ToString();

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "pre_discount_price": 30,
    "price_with_vat": 30,
    "vat": null,
    "price": 30,
    "pre_discount_price_per_item": 3,
    "price_per_item": 3,
    "plan_discount_percent": 0,
    "location_discount_percent": 0,
    "coupon_discount_percent": 0,
    "quantity_discount_percent": 0,
    "total_discount_percent": 0,
    "quantity_required_for_next_discount": {
        "quantity": 90,
        "discount": 5
    },
    "message": null
}
```

## Create Order

<mark style="color:blue;">`POST`</mark>  `/orders`

**Body Parameters:**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td></tr><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td></tr><tr><td>product_location_id</td><td>Integer</td><td>Product location id</td></tr><tr><td>quantity</td><td>Integer</td><td>Proxy quantity</td></tr><tr><td>coupon_code</td><td>String</td><td>Coupon code</td></tr><tr><td>auto_extend</td><td>Boolean</td><td>Should the order be extended automatically. Default value is false.</td></tr><tr><td>product_question_answers</td><td>Array</td><td><p>Answers to questions</p><pre><code>{ question_id: answer, ... }
</code></pre></td></tr><tr><td>card_id</td><td>Integer</td><td>Card id. If an order is paid by card, the <code>card_id</code> must be provided; otherwise, it will be treated as a balance purchase.</td></tr><tr><td>selection</td><td>Array</td><td>You can provide multiple locations with their quantities using the <code>selection.locations</code> field. When you use this, you <strong>do not need to specify</strong> <code>product_location_id</code> and <code>quantity</code> as top-level parameters in the request body.</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_id": 123,
           "product_plan_id": 456,
           "coupon_code": "DISCOUNT2024",
           "auto_extend": true,
           "product_question_answers": {
               "question_id_1": "answer_1",
               "question_id_2": "answer_2"
           },
           "card_id": 1,
           "selection": {
             "locations": [
               {
                 "product_location_id": 789,
                 "quantity": 10
               }
             ]
           }
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/orders";

$data = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'coupon_code' => 'DISCOUNT2024',
    'auto_extend' => true,
    'product_question_answers' => [
        'question_id_1' => 'answer_1',
        'question_id_2' => 'answer_2'
    ],
    'card_id' => 1,
    'selection' => [
        'locations' => [
            ['product_location_id' => 789, 'quantity' => 10]
        ]
    ]
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/orders'

data = {
    'product_id': 123,
    'product_plan_id': 456,
    'coupon_code': 'DISCOUNT2024',
    'auto_extend': True,
    'product_question_answers': {
        'question_id_1': 'answer_1',
        'question_id_2': 'answer_2'
    },
    'card_id': 1,
    'selection': {
        'locations': [
            {'product_location_id': 789, 'quantity': 10}
        ]
    }
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const data = JSON.stringify({
  product_id: 123,
  product_plan_id: 456,
  coupon_code: 'DISCOUNT2024',
  auto_extend: true,
  product_question_answers: {
    question_id_1: 'answer_1',
    question_id_2: 'answer_2'
  },
  card_id: 1,
  selection: {
    locations: [
      { product_location_id: 789, quantity: 10 }
    ]
  }
});

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/orders',
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders";

        String requestBody = """
            {
                "product_id": 123,
                "product_plan_id": 456,
                "coupon_code": "DISCOUNT2024",
                "auto_extend": true,
                "product_question_answers": {
                    "question_id_1": "answer_1",
                    "question_id_2": "answer_2"
                },
                "card_id": 1,
                "selection": {
                    "locations": [
                        { "product_location_id": 789, "quantity": 10 },
                    ]
                }
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	data := map[string]interface{}{
		"product_id":              123,
		"product_plan_id":         456,
		"coupon_code":             "DISCOUNT2024",
		"auto_extend":             true,
		"product_question_answers": map[string]string{
			"question_id_1": "answer_1",
			"question_id_2": "answer_2",
		},
		"card_id":		   1,
		"selection": map[string]interface{}{
			"locations": []map[string]interface{}{
				{"product_location_id": 789, "quantity": 10},
		},
	},
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var data = new
        {
            product_id = 123,
            product_plan_id = 456,
            coupon_code = "DISCOUNT2024",
            auto_extend = true,
            product_question_answers = new
            {
                question_id_1 = "answer_1",
                question_id_2 = "answer_2"
            },
            card_id = 1,
            selection = new
            {
                locations = new[]
                {
                    new { product_location_id = 789, quantity = 10 },
                }
            }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Extend Order

<mark style="color:blue;">`POST`</mark>  `/orders/{order_id}/extend`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td></tr><tr><td>card_id</td><td>Integer</td><td>Card id. If an order extend is paid by card, the <code>card_id</code> must be provided; otherwise, it will be treated as a balance purchase.</td></tr><tr><td>proxies</td><td>Array</td><td>Optional list of IP addresses to extend. If omitted or empty, <strong>all</strong> proxies for the order are extended.</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/12345/extend" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_plan_id": 678,
           "card_id": 1,
           "proxies": []
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$product_plan_id = 678;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id/extend";

$data = [
    'product_plan_id' => $product_plan_id,
    'card_id' => 1,
    'proxies' => []
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345
url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}/extend'

data = {
    'product_plan_id': 678,
    'card_id': 1,
    'proxies' => []
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;
const data = JSON.stringify({
  product_plan_id: 678,
  card_id: 1,
  proxies: []
});

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}/extend`,
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>"; 
        String orderId = "12345";
        String url = "https://apid.iproyal.com/v1/reseller/orders/" + orderId + "/extend";

        String requestBody = """
            {
                "product_plan_id": 678,
                "card_id": 1,
                "proxies": []
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d/extend", orderID)

	data := map[string]interface{}{
		"product_plan_id": 678,
		"card_id": 1,
		"proxies": []string{}
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}/extend";

        var data = new
        {
            product_plan_id = 678,
            card_id = 1,
            proxies = Array.Empty<string>()
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": [],
        "extended_proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Toggle Order Auto Extend

<mark style="color:blue;">`POST`</mark>  `/orders/toggle-auto-extend`

**Body parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Available options</th></tr></thead><tbody><tr><td>order_id</td><td>Integer</td><td>Order id</td><td></td></tr><tr><td>is_enabled</td><td>Boolean</td><td>Should the auto extend be enabled or disabled</td><td></td></tr><tr><td>product_plan_id</td><td>Integer</td><td>The product plan ID for the order. This is not required, and will default to the current product id of the order if empty</td><td></td></tr><tr><td>payment_type</td><td>String</td><td>Payment type for the extend. Not required if <code>is_enabled</code> is false</td><td><p></p><pre><code>card
balance
</code></pre></td></tr><tr><td>card_id</td><td>Integer</td><td>The id of the card used to pay for the extend. Not required if <code>payment_type</code> is <code>balance</code></td><td></td></tr></tbody></table>

**Example request:**

{% tabs fullWidth="false" %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "order_id": 123,
           "product_plan_id": 3,
           "is_enabled": true,
           "payment_type": "card",
           "card_id": 1
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

$data = [
    'order_id' => 123,
    'product_plan_id' => 3,
    'is_enabled' => true,
    'payment_type' => 'card',
    'card_id' => 1
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend'

data = {
	'order_id': 123,
	'product_plan_id': 3,
	'is_enabled': True,
	'payment_type': 'card',
	'card_id': 1
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const data = JSON.stringify({
	order_id: 123,
	product_plan_id: 3,
	is_enabled: true,
	payment_type: 'card',
	card_id: 1
});

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/orders/toggle-auto-extend',
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

        String requestBody = """
            {
	            "order_id": 123,
	            "product_plan_id": 3,
		    "is_enabled": true,
		    "payment_type": "card",
		    "card_id": 1
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend"
)

func main() {
	data := map[string]interface{}{
		"order_id":        123,
		"product_plan_id": 3,
		"is_enabled":      true,
		"payment_type":    "card",
		"card_id":         1,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}

```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

        var data = new
        {
            order_id = 123,
            product_plan_id = 3,
            is_enabled = true,
            payment_type = "card",
            card_id = 1
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "order_id": 202,
    "is_enabled": true,
    "product_plan_id": 3,
    "payment_type": "balance",
    "card_id": null
}
```


# Proxies

## Get Proxy Availability

<mark style="color:green;">`GET`</mark>  `/access/availability/static-residential`

Returns a list of countries with available proxies count.

{% hint style="warning" %}
To use this feature, the admin must enable it. This feature requires a minimum total spend of $10000.
{% endhint %}

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/access/availability/static-residential" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/access/availability/static-residential";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/access/availability/static-residential'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/access/availability/static-residential',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/access/availability/static-residential";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/access/availability/static-residential"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/access/availability/static-residential";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "country_code": "DE",
            "country_name": "Germany",
            "available_ips": 2887
        },
        {
            "country_code": "GB",
            "country_name": "United Kingdom",
            "available_ips": 2351
        },
        {
            "country_code": "US",
            "country_name": "United States",
            "available_ips": 1112
        },
        {
            "country_code": "NL",
            "country_name": "Netherlands",
            "available_ips": 1293
        },
        {
            "country_code": "IT",
            "country_name": "Italy",
            "available_ips": 1812
        },
        ...
    ]
}
```

## Change Credentials

<mark style="color:blue;">`POST`</mark>  `/orders/proxies/change-credentials`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>order_id</td><td>Integer</td><td>Order id</td></tr><tr><td>proxies</td><td>Array</td><td>List of proxies</td></tr><tr><td>username</td><td>String</td><td>Proxy connection username</td></tr><tr><td>password</td><td>String</td><td>Proxy connection password</td></tr><tr><td>random_password</td><td>Boolean</td><td>Should we assign a random password</td></tr><tr><td>is_reset</td><td>Boolean</td><td>Should we assign a random username and password</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "order_id": 12345,
           "username": "new_username",
           "password": "new_password",
           "random_password": false,
           "is_reset": true,
           "proxies": ["proxy1", "proxy2"]
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$proxies = ['proxy1', 'proxy2'];
$username = 'new_username';
$password = 'new_password';
$random_password = false;
$is_reset = true;

$url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode([
        'proxies' => $proxies,
        'order_id' => $order_id,
        'username' => $username,
        'password' => $password,
        'random_password' => $random_password,
        'is_reset' => $is_reset,
    ])
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345
proxies = ['proxy1', 'proxy2']
username = 'new_username'
password = 'new_username'
random_password = False
is_reset = True

url = 'https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

payload = {
    'order_id': order_id,
    'proxies': proxies,
    'username': username,
    'password': password,
    'random_password': random_password,
    'is_reset': is_reset
}

response = requests.post(url, json=payload, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;
const proxies = ['proxy1', 'proxy2'];
const username = 'new_username';
const password = 'new_password';
const random_password = false;
const is_reset = true;

const data = JSON.stringify({
    order_id: order_id,
    proxies: proxies,
    username: username,
    password: password,
    random_password: random_password,
    is_reset: is_reset
});

const options = {
    hostname: 'apid.iproyal.com',
    path: '/v1/reseller/orders/proxies/change-credentials',
    method: 'POST',
    headers: {
        'X-Access-Token': api_token,
        'Content-Type': 'application/json',
    }
};

const req = https.request(options, (res) => {
    let responseData = '';

    res.on('data', (chunk) => {
        responseData += chunk;
    });

    res.on('end', () => {
        console.log(responseData);
    });
});

req.on('error', (error) => {
    console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials";

        String requestBody = """
            {
                "order_id": 12345,
                "username": "new_username",
                "password": "new_password",
                "random_password": false,
                "is_reset": true,
                "proxies": ["proxy1", "proxy2"]
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
)

func main() {
	proxies := []string{"proxy1", "proxy2"}
	orderID := 12345
	username := "new_username"
	password := "new_password"
	randomPassword := false
	isReset := true

	requestBody := map[string]interface{}{
		"order_id":        orderID,
		"username":        username,
		"password":        password,
		"random_password": randomPassword,
		"is_reset":        isReset,
		"proxies":         proxies,
	}

	jsonData, err := json.Marshal(requestBody)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	url := "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials"
	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        
        var requestBody = new
        {
            order_id = 12345,
            username = "new_username",
            password = "new_password",
            random_password = false,
            is_reset = true,
            proxies = new string[] { "proxy1", "proxy2" }
        };

        string url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);
            
            var jsonData = JsonSerializer.Serialize(requestBody);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# Datacenter

At IPRoyal, we offer a wide selection of [Datacenter Proxies](https://iproyal.com/datacenter-proxies/) across multiple countries, so our clients have access to a variety of options. We also update our proxy network regularly to ensure our clients can always rely on new proxies for all their tasks.

### Key Advantages of IPRoyal Datacenter Proxies <a href="#key-advantages-of-iproyal-datacenter-proxies" id="key-advantages-of-iproyal-datacenter-proxies"></a>

* **Highly competitive pricing**

We offer some of the lowest prices in the industry with advanced features, high reliability, and [excellent customer satisfaction](https://www.trustpilot.com/review/iproyal.com).

* **Excellent location coverage**

Our proxies are available in many countries on four continents. We’re also constantly adding support for new locations.

* **High speeds**

With speeds of up to 100 Mbps, we offer a reliable solution even for the most bandwidth-intensive tasks.

* **HTTPS & SOCKS5 compatible**

Choose the protocol that suits your needs to get the best results with any usage case.

* **24/7 support**

With an average response time of just 58 seconds, our skilled team of experts is available around the clock and ready to help you set up and make the most of your proxies.

* **Versatile plans**

Being able to choose the exact number of proxies makes our services more accessible to a broader range of users who don’t have to commit to large packages.

### Technical Features of IPRoyal Datacenter Proxies <a href="#technical-features-of-iproyal-datacenter-proxies" id="technical-features-of-iproyal-datacenter-proxies"></a>

* **Dedicated IPs**

Each datacenter proxy is reserved just for you to offer ultimate online privacy and full control over your online activities.

* **State and city targeting**

Take advantage of unmatched precision with proxy targeting at the state and city level, empowering you to tailor your operations for specific regions.

* **Dual authentication**

Enhance security by managing proxy access through username and password or IP whitelisting authentication, ensuring only authorized users can connect.

* **Unlimited sessions**

Maximize your potential with zero session restrictions for complete online freedom.

* **99.9% uptime**

Consistent uptime and reliable connections around the clock enable you to access the resources you need whenever you need them.

* **Easy integration & API support**

Optimize your workflow and simplify operations with a hassle-free user experience.


# Dashboard

In this part of the guide, we offer clear and thorough instructions for mastering the dashboard's functionalities. This guide is designed to be user-friendly, ensuring that both beginners and seasoned users can efficiently maximize the benefits of our services using the dashboard.


# Making an Order

Welcome to the step-by-step guide for placing an order for proxies on our website. In this section, we will provide you with detailed screenshots and clear explanations to ensure a seamless and straightforward ordering process. Our aim is to make your experience as intuitive and efficient as possible. Let's walk through the process together, showing you exactly how to order your first Datacenter proxies!

***

To begin your purchase of Datacenter proxies, navigate to the 'Datacenter' section (<mark style="color:orange;">1</mark>) on the sidebar menu. This action will direct you to the Datacenter proxies dashboard.

Once you're on the dashboard, click the 'Create a new order' button (<mark style="color:orange;">2</mark>). This will initiate the process for you to start creating your proxy order with your desired specifications.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FwPCFRBYwnUBWbhErWRqI%2FDC1.png?alt=media&amp;token=bf8c9a52-0aa7-46ea-8c01-ce1144da013a" alt=""><figcaption></figcaption></figure>

Firstly, we recommend you examine the discount table (<mark style="color:orange;">1</mark>) with detailed information about pricing and bundle discounts that could provide additional value to your purchase. It's worth taking a moment to review discounts for larger volume purchases.

Next, you will need to choose a plan (<mark style="color:orange;">2</mark>) that specifies the duration, in days, for which you require your proxies to be active.

Following the selection of your plan, you will find an input field labeled 'Proxy location.' (<mark style="color:orange;">3</mark>) Choose one of the available countries.

The next step involves choosing the number of proxies for your order (<mark style="color:orange;">4</mark>). Simply enter the quantity of proxies you wish to order in this straightforward step.

Next, you have the option to customize your proxies location further by adding a specific city or state (<mark style="color:orange;">5</mark>). The available options depend on the country you selected in the 'Proxy location' field.<br>

Finally, you can use the 'Extra requirements' (<mark style="color:orange;">6</mark>) option. This option is designed to cater to any specific requirements you may have. Whether you have a particular subnet in mind or a preferred provider you wish to prioritize, you can provide us with direct instructions for your order in this field (<mark style="color:orange;">7</mark>).

Lastly, there is a summary panel that displays the total price of your order. It also includes a button that you must click to proceed with the purchase. (<mark style="color:orange;">8</mark>)

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FuF1g6GW46TnxezQ5Mc1T%2FDC2.png?alt=media&amp;token=9e7821fd-0826-48f2-b323-b32666b2880b" alt=""><figcaption></figcaption></figure>

You're almost there! The final step is to complete your payment for the order.&#x20;

As displayed on the 'Complete order' page, you have multiple payment options to choose from for your convenience. Whether you prefer to use a credit card, cryptocurrency, PayPal, or Google Pay, simply select your preferred payment method and fill in the required details (<mark style="color:orange;">1</mark>).&#x20;

Once you have entered your payment information, review your order summary to ensure everything is correct. If you have a coupon code, enter it and click "Apply" (<mark style="color:orange;">2</mark>).

After all of this is done, click the 'Complete order' button (<mark style="color:orange;">3</mark>) to finalize your purchase.

Rest assured, all transactions are secure, and you have the option to save your payment information for future purchases.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FFWRF9dDzxT9oKb9TzFOm%2Fm3.webp?alt=media&amp;token=b4fcf25a-21ea-48a5-843e-4c1b7bbaa7e6" alt=""><figcaption></figcaption></figure>

Congratulations! Your order has been successfully processed. You will see a confirmation message.&#x20;

{% hint style="info" %}
This page also features a variety of options to customize your order, such as automatic extensions, credentials management, and more. These options will be detailed in the 'Order Configuration' subsection.<br>

[Order Configuration](/proxies/datacenter/dashboard/order-configuration)
{% endhint %}

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FZ7mDlC1r9UULvXiY1oyl%2Fm4.webp?alt=media&amp;token=e83e1d73-0160-4749-937f-38be8a43d05b" alt=""><figcaption></figcaption></figure>


# Orders

In the 'Datacenter Proxies' dashboard, the 'Orders' panel provides a comprehensive view of all your orders, encompassing active, expired, and unpaid ones. This panel is equipped with advanced filtering options, allowing you to sort and view orders based on a variety of criteria beyond just their status. These filters facilitate efficient management and quick access to specific orders. Each order entry includes convenient features to view its details, download an invoice, or extend its duration.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Flok35oV95HsTFdbX5tfI%2FJ1.png?alt=media&amp;token=eb135336-5392-4510-a0f7-a6b440621d4f" alt=""><figcaption></figcaption></figure>


# Order Configuration

To begin configuring your order, you first need to access its details page.

First, navigate to the 'Datacenter' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click on 'Details' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FSa3jvkaC9xbZaBz6jIWY%2FB1.png?alt=media&amp;token=b58ce971-5f9f-43a7-8a49-a6a188bbbf2e" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
In the page you will find a section labeled 'Subscription'. We will discuss this feature in more detail in the 'Extending an Order' section.\
[Extending an Order](/proxies/isp/dashboard/extending-an-order)
{% endhint %}

Upon entering this page, you will first encounter the 'Proxy details' and 'Order details' toggle (<mark style="color:orange;">1</mark>). The 'Proxy details' page covers the proxy configuration options, while the 'Order details' page offers an order overview and subscription management options.

Next, you’ll see the 'Formatted Proxy List' section (<mark style="color:orange;">2</mark>).

This displays your proxies in a user-friendly format, providing all the essential details for each proxy connection. You can 'Copy' the list to your clipboard or 'Download List' for offline access. Additionally, you can choose the format and specify how many proxies to display or export. This efficient setup gives you quick access to your proxy details for immediate use.

Next, you'll find a panel designed for managing proxy credentials (<mark style="color:orange;">3</mark>). This feature enables you to change the username and password for either all proxies in the order or for individual proxies.

Finally, you will come across the ‘Whitelisted IPs’ panel (<mark style="color:orange;">4</mark>). This feature allows you to add specific IP addresses to the list and ensure only authorized users have access to your proxies. Users with authorized (or whitelisted) IPs also don’t need to use the proxy username and password for authentication.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F0YaJ2443CWgOOu1YVDcI%2FB2.png?alt=media&amp;token=d8a00aeb-d081-4fc3-911a-39d03cf2ad39" alt=""><figcaption></figcaption></figure>

By switching to the 'Order details' panel (<mark style="color:orange;">1</mark>) you will get some basic information about the order (<mark style="color:orange;">2</mark>) and the status of your subscription (<mark style="color:orange;">3</mark>). It also gives you the option of extending specific IP addresses in your order (<mark style="color:orange;">4</mark>).

Next, you will come across a panel for adding a note (<mark style="color:orange;">5</mark>). This feature allows you to write something for future reference. Importantly, you will be able to search for the order using the content of your note.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FejfpOcTOdgIIqtYMKCPm%2FB3.png?alt=media&amp;token=5f73c469-fa40-4d4e-8b37-52b640abca78" alt=""><figcaption></figcaption></figure>


# Extending an Order

There is an option to extend your order, a useful feature as it ensures you keep the IPs you've been provided. There are two methods for extending:

* A manual extension where you can go to the orders dashboard and simply click 'Extend';
* A subscription. Enabling this will let you virtually forget about manual extensions, as it automatically renews the order each time it nears expiration.

When extending your order, you also have the option to change your plan. For instance, if you initially had a 90-day plan but only need the proxies for one more day or an additional month, you can adjust the duration accordingly during the extension process. The same option is available with a subscription.

Additionally, you can select the IP addresses you want to extend or subscribe to. This option is useful if you want to downsize your order but still keep specific IPs.

{% hint style="info" %}
Note: You can only extend orders that are still active. Once order status becomes Expired, it cannot be extended or renewed.
{% endhint %}

### Manual Extension

Navigate to the 'Datacenter' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click on 'Extend' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F1HLTfM0XSmjJTSZwemU0%2FD1.png?alt=media&amp;token=509c1213-44b4-4d32-97b9-7f7808599d66" alt=""><figcaption></figcaption></figure>

In this section, you have the flexibility to select a new plan or continue with the current one (<mark style="color:orange;">1</mark>), while also choosing specific IPs you want to extend (<mark style="color:orange;">2</mark>). Additionally, you can view the 'Expire Date' to determine when the plan is set to expire. Once you’re satisfied with your choices, click 'Continue' (<mark style="color:orange;">3</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Fm2CCk1BuJmUf8zXKyru0%2FD2.png?alt=media&amp;token=cfd26819-efd9-4490-9015-2389d74d4c57" alt=""><figcaption></figcaption></figure>

Following this, you will be directed to a familiar page where you can proceed with the extension process and complete the payment for the extension.

### Subscription

To enable subscriptions, please navigate to the 'Order details' section (<mark style="color:orange;">1</mark>) on the ‘Order Configuration’ page.

On this page, you will find a panel that allows you to enable a subscription (<mark style="color:orange;">2</mark>) for this order. You can modify the plan (<mark style="color:orange;">3</mark>) and extend specific proxies (<mark style="color:orange;">4</mark>). Once you’re satisfied with your choices, select your preferred payment method (<mark style="color:orange;">5</mark>) and click ‘Save’ (<mark style="color:orange;">6</mark>) to enable a subscription.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FzXUp8e82p1PYYqCziLgf%2FD3.png?alt=media&amp;token=bd708f6c-6e2e-489a-be1b-161ab96a9319" alt=""><figcaption></figcaption></figure>


# Using Proxy Strings

In this section, we'll show practical examples of using the proxy string we've created. We'll focus on setting up HTTP/HTTPS and SOCKS5 connections, illustrated through examples in various programming languages.

Our Datacenter proxies are compatible with both UDP and TCP connections.

{% hint style="warning" %}
Keep in mind that the ports will differ depending on the protocol **(HTTP/SOCKS5)**. To choose between HTTP or SOCKS5 proxies, please refer to the 'Formatted Proxy List' panel within the 'Order Configuration' section.\
\
[Order Configuration](/proxies/isp/dashboard/order-configuration)
{% endhint %}

### HTTP/HTTPS

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v -x http://45.12.106.20:12323 --proxy-user 1a725103c093:d510a22638 -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://ipv4.icanhazip.com';
$proxy = '45.12.106.20:12323';
$proxyAuth = '1a725103c093:d510a22638';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
```

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');

const url = 'https://ipv4.icanhazip.com';
const proxyOptions = {
  host: '45.12.106.20',
  port: 12323,
  auth: {
    username: '1a725103c093',
    password: 'd510a22638'
  }
};

axios.get(url, { proxy: proxyOptions })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
proxy = '45.12.106.20:12323'
proxy_auth = '1a725103c093:d510a22638'
proxies = {
    'http': f'http://{proxy_auth}@{proxy}',
    'https': f'http://{proxy_auth}@{proxy}'
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}

### SOCKS5

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v --socks5 45.12.106.20:12324 --proxy-user 1a725103c093:d510a22638 -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

<pre class="language-php"><code class="lang-php"><strong>&#x3C;?php
</strong>
$url = 'https://ipv4.icanhazip.com';
$proxy = '45.12.106.20:12324';
$proxyAuth = '1a725103c093:d510a22638';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
</code></pre>

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');
const SocksProxyAgent = require('socks-proxy-agent');

const url = 'https://ipv4.icanhazip.com';
const socksProxy = 'socks5://1a725103c093:d510a22638@45.12.106.20:12324';
const agent = new SocksProxyAgent(socksProxy);

axios.get(url, { httpAgent: agent, httpsAgent: agent })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
socks5_proxy = 'socks5://1a725103c093:d510a22638@45.12.106.20:12324'
proxies = {
    'http': socks5_proxy,
    'https': socks5_proxy
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}


# API

{% hint style="danger" %}
As of September 15, 2025, the [legacy API](https://documenter.getpostman.com/view/10917935/UV5WFK8M) has been deprecated and is no longer supported. Please migrate to the new API to ensure uninterrupted service.
{% endhint %}

### Base URL

**`https://apid.iproyal.com/v1/reseller`**

### Authorization

To authorize your API calls, we validate the **`X-Access-Token`** header. You can find and reset this token on the dashboard's **Settings** page in the 'API' section.


# User

## Get Balance

<mark style="color:green;">`GET`</mark>  `/balance`

Returns the user's balance.

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/balance" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/balance";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/balance'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/balance',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/balance";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/balance"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/balance";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JObject.Parse(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
884.05
```

## Get Cards

<mark style="color:green;">`GET`</mark>  `/cards`

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/cards" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;

$url = "https://apid.iproyal.com/v1/reseller/cards";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345

url = f'https://apid.iproyal.com/v1/reseller/cards'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/cards`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        int orderId = 12345;
        String urlString = String.format("https://apid.iproyal.com/v1/reseller/cards");

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/cards")

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/cards";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "data": [
        {
            "id": 2,
            "provider": "stripe",
            "custom_name": null,
            "payment_method": "card",
            "card_type": "visa",
            "currency": "USD",
            "last_four_digits": "1234",
            "expiry_date": "2026/01",
            "update_url": null,
            "cancel_url": null,
            "products_with_order_ids": [],
            "has_royal_auto_extend_enabled": false,
            "updated_at": "2025-04-11T14:06:28.000000Z"
        },
    ]
}
```


# Products

## Get Products

<mark style="color:green;">`GET`</mark>  `/products`

Returns a product list containing **plans**, **locations**, **questions** and **quantity discounts.**

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/products" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/products',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/products'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/products',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/products";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/products"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/products";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}

```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "id": 9,
            "name": "Static Residential",
            "plans": [
                {
                    "id": 4,
                    "name": "30 Days",
                    "price": 2,
                    "min_quantity": 5,
                    "max_quantity": 100000
                },
                ...
            ],
            "locations": [
                {
                    "id": 51,
                    "name": "Australia",
                    "out_of_stock": false,
                    "child_locations": []
                },
                ...
            ],
            "questions": [
                {
                    "id": 5,
                    "text": "On which website do you plan to use them?",
                    "is_required": false
                }
            ],
            "quantity_discounts": [
                {
                    "quantity_from": 99,
                    "discount_percent": 5
                },
                ...
            ]
        },
        ...
    ]
}
```


# Orders

{% hint style="info" %}
Options like **product\_id**, **location\_id**, and more can be retrieved using the **Products** endpoint.

[Products](/proxies/isp/api/products)
{% endhint %}

## Get Orders

<mark style="color:green;">`GET`</mark> `/orders`

**Query Parameters**

<table><thead><tr><th width="202.640625">Name</th><th>Type</th><th>Description</th><th>Available options</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td><td></td></tr><tr><td>page</td><td>Integer</td><td>Number of page</td><td></td></tr><tr><td>per_page</td><td>Integer</td><td>Number of orders to get per page</td><td></td></tr><tr><td>location_id</td><td>Integer</td><td>Location id</td><td></td></tr><tr><td>status</td><td>String</td><td>Order status</td><td><p></p><pre><code>unpaid
in-progress
confirmed
refunded
expired
</code></pre></td></tr><tr><td>note_search</td><td>String</td><td>Phrases in order's note field to search by</td><td></td></tr><tr><td>order_ids</td><td>Array</td><td>Order ids to get</td><td></td></tr><tr><td>sort_by</td><td>String</td><td>Column to sort by. Required with order</td><td></td></tr><tr><td>order</td><td>String</td><td>Sort order. Required with sort_by</td><td><pre><code>asc
desc
</code></pre></td></tr><tr><td>statuses</td><td>Array</td><td>Order statuses. Must contain only values from the available options.</td><td><pre><code>unpaid
in-progress
confirmed
refunded
expired
</code></pre></td></tr><tr><td>status_is_expiring_soon</td><td>Boolean</td><td>Is order expiring soon</td><td></td></tr><tr><td>order_billing_type</td><td>String</td><td>Order billing type</td><td><pre><code>subscription
regular
</code></pre></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders?product_id=123&page=1&per_page=10&location_id=456&status=in-progress&note_search=example%20note&order_ids[]=789&order_ids[]=1011" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'page' => 1,
    'per_page' => 10,
    'location_id' => 456,
    'status' => 'in-progress',
    'note_search' => 'example note',
    'order_ids' => [789, 1011]
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'page': 1,
    'per_page': 10,
    'location_id': 456,
    'status': 'in-progress',
    'note_search': 'example note',
    'order_ids[]': [789, 1011]
}

url = 'https://apid.iproyal.com/v1/reseller/orders'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  page: 1,
  per_page: 10,
  location_id: 456,
  status: 'in-progress',
  note_search: 'example note',
});

const orderIds = [789, 1011];
orderIds.forEach(id => params.append('order_ids[]', id));

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders?${params.toString()}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/orders";

        Map<String, String> params = Map.of(
                "product_id", "123",
                "page", "1",
                "per_page", "10",
                "location_id", "456",
                "status", "in-progress",
                "note_search", "example note"
        );

        List<String> orderIds = List.of("789", "1011");

        StringBuilder queryParams = new StringBuilder();
        try {
            for (Map.Entry<String, String> entry : params.entrySet()) {
                if (queryParams.length() > 0) {
                    queryParams.append("&");
                }
                queryParams.append(URLEncoder.encode(entry.getKey(), "UTF-8"))
                        .append("=")
                        .append(URLEncoder.encode(entry.getValue(), "UTF-8"));
            }

            for (String orderId : orderIds) {
                if (queryParams.length() > 0) {
                    queryParams.append("&");
                }
                queryParams.append(URLEncoder.encode("order_ids[]", "UTF-8"))
                        .append("=")
                        .append(URLEncoder.encode(orderId, "UTF-8"));
            }

            URL url = new URL(urlString + "?" + queryParams.toString());
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	params := url.Values{}
	params.Add("product_id", "123")
	params.Add("page", "1")
	params.Add("per_page", "10")
	params.Add("location_id", "456")
	params.Add("status", "in-progress")
	params.Add("note_search", "example note")

	orderIds := []string{"789", "1011"}
	for _, id := range orderIds {
		params.Add("order_ids[]", id)
	}

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}

```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "page", "1" },
            { "per_page", "10" },
            { "location_id", "456" },
            { "status", "in-progress" },
            { "note_search", "example note" },
        };

        List<string> orderIds = new List<string> { "789", "1011" };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var query = new List<string>();
            
            foreach (var param in queryParams)
            {
                query.Add($"{Uri.EscapeDataString(param.Key)}={Uri.EscapeDataString(param.Value)}");
            }
            
            foreach (var orderId in orderIds)
            {
                query.Add($"{Uri.EscapeDataString("order_ids[]")}={Uri.EscapeDataString(orderId)}");
            }

            string queryString = string.Join("&", query);
            string urlWithParams = $"{url}?{queryString}";

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "data": [
        {
            "id": 420,
            "note": null,
            "product_name": "Static Residential",
            "plan_name": "30 Days",
            "expire_date": "2024-04-20 10:25:12",
            "status": "confirmed",
            "location": "United States",
            "locations": "United States",
            "quantity": 5,
            "questions_answers": [
                {
                    "question": "Extra requirements (if you have any):",
                    "answer": "I need 128.158.97"
                }
            ],
            "proxy_data": {
                "ports": {
                    "socks5": 12324,
                    "http|https": 12323
                },
                "proxies": []
            },
            "auto_extend_settings": null,
            "extended_history": []
        },
        ...
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 2,
        "path": "https://apid.iproyal.com/v1/reseller/orders",
        "per_page": 10,
        "to": 10,
        "total": 14
    }
}
```

## Get Order

<mark style="color:green;">`GET`</mark>  `/orders/{order_id}`

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/12345" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345

url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        int orderId = 12345;
        String urlString = String.format("https://apid.iproyal.com/v1/reseller/orders/%d", orderId);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d", orderID)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada"
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Calculate Pricing

<mark style="color:green;">`GET`</mark>  `/orders/calculate-pricing`

**Query Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th><th>Available options</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td><td></td></tr><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td><td></td></tr><tr><td>product_location_id</td><td>Integer</td><td>Product location id</td><td></td></tr><tr><td>quantity</td><td>Integer</td><td>Proxy quantity</td><td></td></tr><tr><td>coupon_code</td><td>String</td><td>Coupon code</td><td></td></tr><tr><td>order_id</td><td>Integer</td><td>Order id</td><td></td></tr><tr><td>order_billing_type</td><td>String</td><td>Order billing type</td><td><pre><code>subscription
regular
</code></pre></td></tr><tr><td>product_question_answers</td><td>Array</td><td>Product question answers</td><td></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'product_location_id' => 789,
    'quantity' => 10,
    'coupon_code' => 'DISCOUNT2024'
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'product_plan_id': 456,
    'product_location_id': 789,
    'quantity': 10,
    'coupon_code': 'DISCOUNT2024'
}

url = 'https://apid.iproyal.com/v1/reseller/orders/calculate-pricing'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  product_plan_id: 456,
  product_location_id: 789,
  quantity: 10,
  coupon_code: 'DISCOUNT2024'
}).toString();

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/calculate-pricing?${params}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing" +
                "?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .GET()
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing"
)

func main() {
	params := url.Values{}
	params.Add("product_id", fmt.Sprintf("%d", 123))
	params.Add("product_plan_id", fmt.Sprintf("%d", 456))
	params.Add("product_location_id", fmt.Sprintf("%d", 789))
	params.Add("quantity", fmt.Sprintf("%d", 10))
	params.Add("coupon_code", "DISCOUNT2024")

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "product_plan_id", "456" },
            { "product_location_id", "789" },
            { "quantity", "10" },
            { "coupon_code", "DISCOUNT2024" }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var urlWithParams = new UriBuilder(url) { Query = await new FormUrlEncodedContent(queryParams).ReadAsStringAsync() }.ToString();

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "pre_discount_price": 30,
    "price_with_vat": 30,
    "vat": null,
    "price": 30,
    "pre_discount_price_per_item": 3,
    "price_per_item": 3,
    "plan_discount_percent": 0,
    "location_discount_percent": 0,
    "coupon_discount_percent": 0,
    "quantity_discount_percent": 0,
    "total_discount_percent": 0,
    "quantity_required_for_next_discount": {
        "quantity": 90,
        "discount": 5
    },
    "message": null
}
```

## Create Order

<mark style="color:blue;">`POST`</mark>  `/orders`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td></tr><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td></tr><tr><td>product_location_id</td><td>Integer</td><td>Product location id</td></tr><tr><td>quantity</td><td>Integer</td><td>Proxy quantity</td></tr><tr><td>coupon_code</td><td>String</td><td>Coupon code</td></tr><tr><td>auto_extend</td><td>Boolean</td><td>Should the order be extended automatically. Default value is false.</td></tr><tr><td>product_question_answers</td><td>Array</td><td><p>Answers to questions</p><pre><code>{ question_id: answer, ... }
</code></pre></td></tr><tr><td>card_id</td><td>Integer</td><td>Card id. If an order is paid by card, the <code>card_id</code> must be provided; otherwise, it will be treated as a balance purchase.</td></tr><tr><td>selection</td><td>Array</td><td>You can provide multiple locations with their quantities using the <code>selection.locations</code> field. When you use this, you <strong>do not need to specify</strong> <code>product_location_id</code> and <code>quantity</code> as top-level parameters in the request body.</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_id": 123,
           "product_plan_id": 456,
           "coupon_code": "DISCOUNT2024",
           "auto_extend": true,
           "product_question_answers": {
               "question_id_1": "answer_1",
               "question_id_2": "answer_2"
           },
           "card_id": 1,
           "selection": {
             "locations": [
               {
                 "product_location_id": 789,
                 "quantity": 10
               }
             ]
           }
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/orders";

$data = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'coupon_code' => 'DISCOUNT2024',
    'auto_extend' => true,
    'product_question_answers' => [
        'question_id_1' => 'answer_1',
        'question_id_2' => 'answer_2'
    ],
    'card_id' => 1,
    'selection' => [
        'locations' => [
            ['product_location_id' => 789, 'quantity' => 10]
        ]
    ]
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/orders'

data = {
    'product_id': 123,
    'product_plan_id': 456,
    'coupon_code': 'DISCOUNT2024',
    'auto_extend': True,
    'product_question_answers': {
        'question_id_1': 'answer_1',
        'question_id_2': 'answer_2'
    },
    'card_id': 1,
    'selection': {
        'locations': [
            {'product_location_id': 789, 'quantity': 10}
        ]
    }
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const data = JSON.stringify({
  product_id: 123,
  product_plan_id: 456,
  coupon_code: 'DISCOUNT2024',
  auto_extend: true,
  product_question_answers: {
    question_id_1: 'answer_1',
    question_id_2: 'answer_2'
  },
  card_id: 1,
  selection: {
    locations: [
      { product_location_id: 789, quantity: 10 },
    ]
  }
});

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/orders',
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders";

        String requestBody = """
            {
                "product_id": 123,
                "product_plan_id": 456,
                "coupon_code": "DISCOUNT2024",
                "auto_extend": true,
                "product_question_answers": {
                    "question_id_1": "answer_1",
                    "question_id_2": "answer_2"
                },
                "card_id" 1,
                "selection": {
                    "locations": [
                        { "product_location_id": 789, "quantity": 10 },
                    ]
                }
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	data := map[string]interface{}{
		"product_id":              123,
		"quantity":                10,
		"coupon_code":             "DISCOUNT2024",
		"auto_extend":             true,
		"product_question_answers": map[string]string{
			"question_id_1": "answer_1",
			"question_id_2": "answer_2",
		},
		"card_id":		   1,
		"selection": map[string]interface{}{
			"locations": []map[string]interface{}{
				{"product_location_id": 789, "quantity": 10},
		},
	},
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var data = new
        {
            product_id = 123,
            product_plan_id = 456,
            coupon_code = "DISCOUNT2024",
            auto_extend = true,
            product_question_answers = new
            {
                question_id_1 = "answer_1",
                question_id_2 = "answer_2"
            },
            card_id = 1,
            selection = new
            {
                locations = new[]
                {
                    new { product_location_id = 789, quantity = 10 },
                }
            }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Extend Order

<mark style="color:blue;">`POST`</mark>  `/orders/{order_id}/extend`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td></tr><tr><td>card_id</td><td>Integer</td><td>Card id. If an order extend is paid by card, the <code>card_id</code> must be provided; otherwise, it will be treated as a balance purchase.</td></tr><tr><td>proxies</td><td>Array</td><td>Optional list of IP addresses to extend. If omitted or empty, <strong>all</strong> proxies for the order are extended.</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/12345/extend" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_plan_id": 678,
           "card_id": 1,
           "proxies": []
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$product_plan_id = 678;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id/extend";

$data = [
    'product_plan_id' => $product_plan_id,
    'card_id' => 1,
    'proxies' => []
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345
url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}/extend'

data = {
    'product_plan_id': 678,
    'card_id': 1,
    'proxies': []
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;
const data = JSON.stringify({
  product_plan_id: 678,
  card_id: 1,
  proxies: []
});

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}/extend`,
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>"; 
        String orderId = "12345";
        String url = "https://apid.iproyal.com/v1/reseller/orders/" + orderId + "/extend";

        String requestBody = """
            {
                "product_plan_id": 678,
                "card_id": 1,
                "proxies": []
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d/extend", orderID)

	data := map[string]interface{}{
		"product_plan_id": 678,
		"card_id": 1,
		"proxies": []string{}
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}/extend";

        var data = new
        {
            product_plan_id = 678,
            card_id = 1,
            proxies = Array.Empty<string>()
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": [],
        "extended_proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Toggle Order Auto Extend

<mark style="color:blue;">`POST`</mark>  `/orders/toggle-auto-extend`

**Body parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Available options</th></tr></thead><tbody><tr><td>order_id</td><td>Integer</td><td>Order id</td><td></td></tr><tr><td>is_enabled</td><td>Boolean</td><td>Should the auto extend be enabled or disabled</td><td></td></tr><tr><td>product_plan_id</td><td>Integer</td><td>The product plan ID for the order. This is not required, and will default to the current product id of the order if empty</td><td></td></tr><tr><td>payment_type</td><td>String</td><td>Payment type for the extend. Not required if <code>is_enabled</code> is false</td><td><p></p><pre><code>card
balance
</code></pre></td></tr><tr><td>card_id</td><td>Integer</td><td>The id of the card used to pay for the extend. Not required if <code>payment_type</code> is <code>balance</code></td><td></td></tr></tbody></table>

**Example request:**

{% tabs fullWidth="false" %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "order_id": 123,
           "product_plan_id": 3,
           "is_enabled": true,
           "payment_type": "card",
           "card_id": 1
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

$data = [
    'order_id' => 123,
    'product_plan_id' => 3,
    'is_enabled' => true,
    'payment_type' => 'card',
    'card_id' => 1
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend'

data = {
	'order_id': 123,
	'product_plan_id': 3,
	'is_enabled': True,
	'payment_type': 'card',
	'card_id': 1
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const data = JSON.stringify({
	order_id: 123,
	product_plan_id: 3,
	is_enabled: true,
	payment_type: 'card',
	card_id: 1
});

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/orders/toggle-auto-extend',
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

        String requestBody = """
            {
	            "order_id": 123,
	            "product_plan_id": 3,
		    "is_enabled": true,
		    "payment_type": "card",
		    "card_id": 1
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend"
)

func main() {
	data := map[string]interface{}{
		"order_id":        123,
		"product_plan_id": 3,
		"is_enabled":      true,
		"payment_type":    "card",
		"card_id":         1,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}

```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

        var data = new
        {
            order_id = 123,
            product_plan_id = 3,
            is_enabled = true,
            payment_type = "card",
            card_id = 1
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "order_id": 202,
    "is_enabled": true,
    "product_plan_id": 3,
    "payment_type": "balance",
    "card_id": null
}
```


# Proxies

## Get Proxy Availability

<mark style="color:green;">`GET`</mark>  `/access/availability/dc`

Returns a list of countries with available proxies count.

{% hint style="warning" %}
To use this feature, the admin must enable it. This feature requires a minimum total spend of  $10000.
{% endhint %}

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/access/availability/dc" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/access/availability/dc";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/access/availability/dc'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/access/availability/dc',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/access/availability/dc";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/access/availability/dc"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/access/availability/dc";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "country_code": "DE",
            "country_name": "Germany",
            "available_ips": 2887
        },
        {
            "country_code": "GB",
            "country_name": "United Kingdom",
            "available_ips": 2351
        },
        {
            "country_code": "US",
            "country_name": "United States",
            "available_ips": 1112
        },
        {
            "country_code": "NL",
            "country_name": "Netherlands",
            "available_ips": 1293
        },
        {
            "country_code": "IT",
            "country_name": "Italy",
            "available_ips": 1812
        },
        ...
    ]
}
```

##

## Change Credentials

<mark style="color:blue;">`POST`</mark>  `/orders/proxies/change-credentials`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>order_id</td><td>Integer</td><td>Order id</td></tr><tr><td>proxies</td><td>Array</td><td>List of proxies</td></tr><tr><td>username</td><td>String</td><td>Proxy connection username</td></tr><tr><td>password</td><td>String</td><td>Proxy connection password</td></tr><tr><td>random_password</td><td>Boolean</td><td>Should we assign a random password</td></tr><tr><td>is_reset</td><td>Boolean</td><td>Should we assign a random username and password</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "order_id": 12345,
           "username": "new_username",
           "password": "new_password",
           "random_password": false,
           "is_reset": true,
           "proxies": ["proxy1", "proxy2"]
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$proxies = ['proxy1', 'proxy2'];
$username = 'new_username';
$password = 'new_password';
$random_password = false;
$is_reset = true;

$url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode([
        'proxies' => $proxies,
        'order_id' => $order_id,
        'username' => $username,
        'password' => $password,
        'random_password' => $random_password,
        'is_reset' => $is_reset,
    ])
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345
proxies = ['proxy1', 'proxy2']
username = 'new_username'
password = 'new_username'
random_password = False
is_reset = True

url = 'https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

payload = {
    'order_id': order_id,
    'proxies': proxies,
    'username': username,
    'password': password,
    'random_password': random_password,
    'is_reset': is_reset
}

response = requests.post(url, json=payload, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;
const proxies = ['proxy1', 'proxy2'];
const username = 'new_username';
const password = 'new_password';
const random_password = false;
const is_reset = true;

const data = JSON.stringify({
    order_id: order_id,
    proxies: proxies,
    username: username,
    password: password,
    random_password: random_password,
    is_reset: is_reset
});

const options = {
    hostname: 'apid.iproyal.com',
    path: '/v1/reseller/orders/proxies/change-credentials',
    method: 'POST',
    headers: {
        'X-Access-Token': api_token,
        'Content-Type': 'application/json',
    }
};

const req = https.request(options, (res) => {
    let responseData = '';

    res.on('data', (chunk) => {
        responseData += chunk;
    });

    res.on('end', () => {
        console.log(responseData);
    });
});

req.on('error', (error) => {
    console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials";

        String requestBody = """
            {
                "order_id": 12345,
                "username": "new_username",
                "password": "new_password",
                "random_password": false,
                "is_reset": true,
                "proxies": ["proxy1", "proxy2"]
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
)

func main() {
	proxies := []string{"proxy1", "proxy2"}
	orderID := 12345
	username := "new_username"
	password := "new_password"
	randomPassword := false
	isReset := true

	requestBody := map[string]interface{}{
		"order_id":        orderID,
		"username":        username,
		"password":        password,
		"random_password": randomPassword,
		"is_reset":        isReset,
		"proxies":         proxies,
	}

	jsonData, err := json.Marshal(requestBody)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	url := "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials"
	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        
        var requestBody = new
        {
            order_id = 12345,
            username = "new_username",
            password = "new_password",
            random_password = false,
            is_reset = true,
            proxies = new string[] { "proxy1", "proxy2" }
        };

        string url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);
            
            var jsonData = JsonSerializer.Serialize(requestBody);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# Sneaker DC

At IProyal, we offer a wide selection of sneaker DC proxies across multiple countries, so our clients have access to a variety of options. We also update our proxy network regularly to ensure our clients can always rely on new proxies for all their tasks.

### Key Advantages of IPRoyal Sneaker DC Proxies <a href="#key-advantages-of-iproyal-sneaker-dc-proxies" id="key-advantages-of-iproyal-sneaker-dc-proxies"></a>

* **Highly competitive pricing**

We offer discounts on the number of purchased proxies (5% off for 100-250 proxies and 10% off for over 250), along with additional discounts for longer periods (5% off with the 60-day plan and 10% off with the 90-day plan) advanced features, high reliability, and [excellent customer satisfaction](https://www.trustpilot.com/review/iproyal.com).

* **Excellent location coverage**

Our proxies are available in many countries on four continents. We’re also constantly adding new locations. If you need a location we don’t offer, contact our support team and we’ll consider adding it.

* **HTTP & SOCKS5 compatible**

All usage cases are covered - access any HTTP/HTTPS website anonymously or use SOCKS5 for other protocols.

* **24/7 support**

With an average response time of just 58 seconds, our skilled team of experts is available around the clock and ready to help you set up and make the most of your proxies.

* **Versatile plans**

Being able to choose the exact number of proxies makes our services more accessible to a broader range of users who don’t have to commit to large packages.

### Technical Features of IProyal Sneaker DC Proxies <a href="#technical-features-of-iproyal-sneaker-dc-proxies" id="technical-features-of-iproyal-sneaker-dc-proxies"></a>

* **99.9% uptime**

Consistent uptime and reliable connections around the clock enable you to access the resources you need whenever you need them.

* **Dedicated IPs**

Each sneaker DC proxy is reserved just for you to offer ultimate online privacy and full control over your online activities.

* **Unlimited traffic & sessions**

Maximize your potential with zero traffic and session restrictions for complete online freedom.

* **High compatibility**

Our sneaker DC proxies are compatible with most retail sites and bots out there, offering a hassle-free user experience.


# Dashboard

In this part of the guide, we offer clear and thorough instructions for mastering the dashboard's functionalities. This guide is designed to be user-friendly, ensuring that both beginners and seasoned users can efficiently maximize the benefits of our services using the dashboard.


# Making an Order

Welcome to the step-by-step guide for placing an order for proxies on our website. In this section, we will provide you with detailed screenshots and clear explanations to ensure a seamless and straightforward ordering process. Our aim is to make your experience as intuitive and efficient as possible. Let's walk through the process together, showing you exactly how to order your first Sneaker DC proxies!

***

To begin your purchase of Sneaker DC proxies, navigate to the 'Sneaker DC' section (<mark style="color:orange;">1</mark>) on the sidebar menu. This action will direct you to the Sneaker DC proxies dashboard.

Once you're on the dashboard, click the '+ Create a new order' button (<mark style="color:orange;">2</mark>). This will initiate the process for you to start creating your proxy order with your desired specifications.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FzhTdw6s1PNnWZwdQ7mC4%2Fimage.png?alt=media&amp;token=38ef9eb7-f995-497d-b313-3eed0a0a9509" alt=""><figcaption></figcaption></figure>

Firstly, we recommend you examine the discount table (<mark style="color:orange;">1</mark>) with detailed information about pricing and bundle discounts that could provide additional value to your purchase. It's worth taking a moment to review discounts for larger volume purchases.

Next, you will need to choose a plan (<mark style="color:orange;">2</mark>) that specifies the duration, in days, for which you require your proxies to be active.

Following the selection of your plan, you will find an input field labeled 'Number of proxies.' (<mark style="color:orange;">3</mark>) Simply enter the quantity of proxies you wish to order in this straightforward step.

The next step involves choosing the location for your proxies (<mark style="color:orange;">4</mark>).

The final input is intended to gather additional details regarding the intended use of the proxies. This can assist us in providing you with IP ranges that are more suitable for your specific needs (<mark style="color:orange;">5</mark>).

Lastly, there is a summary panel that displays the total price of your order. It also includes a button that you must click to proceed with the purchase. (<mark style="color:orange;">6</mark>)

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FfFTKWLSd54jY0KglgOGU%2Fimage.png?alt=media&amp;token=4ec707ec-1ca7-448e-be7e-2b28041ccb5b" alt=""><figcaption></figcaption></figure>

You're almost there! The final step is to complete your payment for the order.&#x20;

As displayed on the 'Complete order' page, you have multiple payment options to choose from for your convenience. Whether you prefer to use a credit card, cryptocurrency, PayPal, or Google Pay, simply select your preferred payment method and fill in the required details (<mark style="color:orange;">1</mark>).&#x20;

Once you have entered your payment information, review your order summary to ensure everything is correct. If you have a coupon code, enter it and click "Apply" (<mark style="color:orange;">2</mark>).

After all of this is done, click the 'Complete order' button (<mark style="color:orange;">3</mark>) to finalize your purchase.

Rest assured, all transactions are secure, and you have the option to save your payment information for future purchases.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FBc1owJOmvzubdg0vfo2W%2Fimage.png?alt=media&amp;token=c961c6b2-57f8-473d-b980-c8fd7515dd6b" alt=""><figcaption></figcaption></figure>

Congratulations! Your order has been successfully processed. You will see a confirmation message.&#x20;

{% hint style="info" %}
This page also features a variety of options to customize your order, such as automatic extensions, credentials management, and more. These options will be detailed in the 'Order Configuration' subsection.<br>

[Order Configuration](/proxies/datacenter/dashboard/order-configuration)
{% endhint %}

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F2V2QnbM5ApNM3ZbvTlMM%2Fimage.png?alt=media&amp;token=4e045ef1-5235-4fda-a5ff-6cf4df34e801" alt=""><figcaption></figcaption></figure>


# Orders

In the 'Sneaker DC proxies' dashboard, the 'Orders' panel provides a comprehensive view of all your orders, encompassing active, expired, and unpaid ones. This panel is equipped with advanced filtering options, allowing you to sort and view orders based on a variety of criteria beyond just their status. These filters facilitate efficient management and quick access to specific orders. Each order entry includes convenient features to view its details, download an invoice, or extend its duration.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FbpV5yK0R2eINqBtZMEfM%2Fimage.png?alt=media&amp;token=3c60685a-ff9e-495c-b8c2-1b730064bbe8" alt=""><figcaption></figcaption></figure>


# Order Configuration

To begin configuring your order, you first need to access its details page.

First, navigate to the 'Sneaker DC' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click on 'Details' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FpySnSmJeRYumJvZPZUDR%2Fimage.png?alt=media&amp;token=03d0286a-b0a2-4803-8640-9cc9348ffcfd" alt=""><figcaption></figcaption></figure>

The 'Order Details' section offers the ability to configure your order. Upon entering this page, you will first encounter some basic information about the order.

{% hint style="info" %}
On the page, you will find a section labeled 'Auto Extend Order.' We will discuss this feature in more detail in the 'Extending an Order' section.

\
[Extending an Order](/proxies/isp/dashboard/extending-an-order)
{% endhint %}

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Fg6uhVGUIyFE7hRoVeqg2%2Fimage.png?alt=media&amp;token=e9eae0fa-c850-4e1d-b997-632cfb9f6df8" alt=""><figcaption></figcaption></figure>

Next, you will come across a panel for adding a note (<mark style="color:orange;">1</mark>). This feature allows you to write something for future reference. Importantly, you will be able to search for the order using the content of your note.

Following this, you will encounter a panel designed for managing proxy credentials (<mark style="color:orange;">2</mark>). This feature enables you to change the username and password for either all proxies in the order or for individual proxies.

Lastly, you'll find the 'Formatted Proxy List' section further down (<mark style="color:orange;">3</mark>). This displays your proxies in a user-friendly format, providing all the essential details for each proxy connection. You can 'Copy' the list to your clipboard or 'Download List' for offline access. Additionally, you can choose the format and specify how many proxies to display or export. This efficient setup gives you quick access to your proxy details for immediate use.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FIgXbSny0S5QJbfSTjQxv%2Fimage.png?alt=media&amp;token=6dc65f42-4800-4a41-a274-80c1d745d41f" alt=""><figcaption></figcaption></figure>


# Extending an Order

There is an option to extend your order, a useful feature as it ensures you keep the IPs you've been provided. There are two methods for extending:

* A manual extension where you can go to the orders dashboard and simply click 'Extend';
* An automatic extension. Enabling this will let you virtually forget about manual extensions, as it automatically renews the order each time it nears expiration.

When extending your order, you also have the option to change your plan. For instance, if you initially had a 90-day plan but only need the proxies for one more day or an additional month, you can adjust the duration accordingly during the extension process.

### Manual Extension

Navigate to the 'Sneaker DC' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click on 'Extend' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Fs1sc48Q2vAxGZcxF0MeS%2Fimage.png?alt=media&amp;token=0b74da24-12f8-4b73-affd-a3b2a800db7a" alt=""><figcaption></figcaption></figure>

In this section, you have the flexibility to select a new plan or continue with the current one. Additionally, you can view the 'Expire Date' to determine when the plan is set to expire.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FXM0cGu5AlicsMzz5lygt%2Fimage.png?alt=media&amp;token=5ceed7d5-1899-44fe-8ebb-4905dc9db877" alt=""><figcaption></figcaption></figure>

Following this, you will be directed to a familiar page where you can proceed with the extension process and complete the payment for the extension.

### Automatic Extension

To enable automatic extensions, please navigate to the 'Order Configuration' page.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FAhDnPGzw4XTmYBcYyRfD%2Fimage.png?alt=media&amp;token=e33ffff8-66b8-4e4e-8eb2-047d56999cf0" alt=""><figcaption></figcaption></figure>

On this page, you'll find a panel that allows you to change the plan if needed and select your preferred payment method. Once you are satisfied with your choices, simply click 'Save' to enable automatic extensions.


# Using Proxy Strings

In this section, we'll show practical examples of using the proxy string we've created. We'll focus on setting up HTTP/HTTPS and SOCKS5 connections, illustrated through examples in various programming languages.

Our Sneaker DC proxies are compatible with both UDP and TCP connections.

{% hint style="warning" %}
Keep in mind that the ports will differ depending on the protocol **(HTTP/SOCKS5)**. To choose between HTTP or SOCKS5 proxies, please refer to the 'Formatted Proxy List' panel within the 'Order Configuration' section.\
\
[Order Configuration](/proxies/isp/dashboard/order-configuration)
{% endhint %}

### HTTP/HTTPS

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v -x 127.0.0.150:12323:1a76fc101622:b585565c4a -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://ipv4.icanhazip.com';
$proxy = '127.0.0.150:12323';
$proxyAuth = '1a76fc101622:b585565c4a';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
```

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');

const url = 'https://ipv4.icanhazip.com';
const proxyOptions = {
  host: '127.0.0.150',
  port: 12323,
  auth: {
    username: '1a76fc101622',
    password: 'b585565c4a'
  }
};

axios.get(url, { proxy: proxyOptions })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
proxy = '127.0.0.150:12323'
proxy_auth = '1a76fc101622:b585565c4a'
proxies = {
    'http': f'http://{proxy_auth}@{proxy}',
    'https': f'http://{proxy_auth}@{proxy}'
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}

### SOCKS5

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v --socks5 127.0.0.150:12324 --proxy-user 1a76fc101622:b585565c4a -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

<pre class="language-php"><code class="lang-php"><strong>&#x3C;?php
</strong>
$url = 'https://ipv4.icanhazip.com';
$proxy = '127.0.0.150:12324';
$proxyAuth = '1a76fc101622:b585565c4a';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
</code></pre>

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');
const SocksProxyAgent = require('socks-proxy-agent');

const url = 'https://ipv4.icanhazip.com';
const socksProxy = 'socks5://1a76fc101622:b585565c4a@127.0.0.150:12324';
const agent = new SocksProxyAgent(socksProxy);

axios.get(url, { httpAgent: agent, httpsAgent: agent })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
socks5_proxy = 'socks5://1a76fc101622:b585565c4a@127.0.0.150:12324'
proxies = {
    'http': socks5_proxy,
    'https': socks5_proxy
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}


# API

{% hint style="warning" %}
Old deprecated API documentation can be found [here](https://documenter.getpostman.com/view/10917935/UV5WFK8M).
{% endhint %}

{% hint style="info" %}
To activate API, you'll need to verify your identity first.
{% endhint %}

### Base URL

**`https://apid.iproyal.com/v1/reseller`**

### Authorization

To authorize your API calls, we validate the **`X-Access-Token`** header. You can find and reset this token on the dashboard's **Settings** page in the 'API' section.


# User

## Get Balance

<mark style="color:green;">`GET`</mark>  `/balance`

Returns the user's balance.

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/balance" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/balance";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/balance'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/balance',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/balance";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/balance"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/balance";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JObject.Parse(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
884.05
```


# Products

## Get Products

<mark style="color:green;">`GET`</mark>  `/products`

Returns a product list containing **plans**, **locations**, **questions** and **quantity discounts.**

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/products" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/products',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/products'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/products',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/products";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/products"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/products";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);
            client.DefaultRequestHeaders.Add("Content-Type", "application/json");

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JObject.Parse(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "id": 9,
            "name": "Static Residential",
            "plans": [
                {
                    "id": 4,
                    "name": "30 Days",
                    "price": 2,
                    "min_quantity": 5,
                    "max_quantity": 100000
                },
                ...
            ],
            "locations": [
                {
                    "id": 51,
                    "name": "Australia",
                    "out_of_stock": false,
                    "available_proxies_count": 1142
                },
                ...
            ],
            "questions": [
                {
                    "id": 5,
                    "text": "On which website do you plan to use them?",
                    "is_required": false
                }
            ],
            "quantity_discounts": [
                {
                    "quantity_from": 99,
                    "discount_percent": 5
                },
                ...
            ]
        },
        ...
    ]
}
```


# Orders

{% hint style="info" %}
Options like **product\_id**, **location\_id**, and more can be retrieved using the **Products** endpoint.

[Products](/proxies/isp/api/products)
{% endhint %}

## Get Orders

<mark style="color:green;">`GET`</mark> `/orders`

**Query Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Available options</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td><td></td></tr><tr><td>page</td><td>Integer</td><td>Number of page</td><td></td></tr><tr><td>per_page</td><td>Integer</td><td>Number of orders to get per page</td><td></td></tr><tr><td>location_id</td><td>Integer</td><td>Location id</td><td></td></tr><tr><td>status</td><td>String</td><td>Order status</td><td><p></p><pre><code>unpaid
in-progress
confirmed
refunded
expired
</code></pre></td></tr><tr><td>note_search</td><td>String</td><td>Phrases in order's note field to search by</td><td></td></tr><tr><td>order_ids</td><td>Array</td><td>Order ids to get</td><td></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders?product_id=123&page=1&per_page=10&location_id=456&status=in-progress&note_search=example%20note&order_ids=789,1011" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'page' => 1,
    'per_page' => 10,
    'location_id' => 456,
    'status' => 'in-progress',
    'note_search' => 'example note',
    'order_ids' => [789, 1011]
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'page': 1,
    'per_page': 10,
    'location_id': 456,
    'status': 'in-progress',
    'note_search': 'example note',
    'order_ids': '789,1011'
}

url = 'https://apid.iproyal.com/v1/reseller/orders'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  page: 1,
  per_page: 10,
  location_id: 456,
  status: 'in-progress',
  note_search: 'example note',
  order_ids: [789, 1011].join(',')
}).toString();

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders?${params}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Map;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/orders";

        Map<String, String> params = Map.of(
            "product_id", "123",
            "page", "1",
            "per_page", "10",
            "location_id", "456",
            "status", "in-progress",
            "note_search", "example note",
            "order_ids", "789,1011"
        );

        StringBuilder queryParams = new StringBuilder();
        try {
            for (Map.Entry<String, String> entry : params.entrySet()) {
                if (queryParams.length() > 0) {
                    queryParams.append("&");
                }
                queryParams.append(URLEncoder.encode(entry.getKey(), "UTF-8"))
                           .append("=")
                           .append(URLEncoder.encode(entry.getValue(), "UTF-8"));
            }

            URL url = new URL(urlString + "?" + queryParams.toString());
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"net/url"
	"io"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	params := url.Values{}
	params.Add("product_id", "123")
	params.Add("page", "1")
	params.Add("per_page", "10")
	params.Add("location_id", "456")
	params.Add("status", "in-progress")
	params.Add("note_search", "example note")
	params.Add("order_ids", "789,1011")

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "page", "1" },
            { "per_page", "10" },
            { "location_id", "456" },
            { "status", "in-progress" },
            { "note_search", "example note" },
            { "order_ids", "789,1011" }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var urlWithParams = new UriBuilder(url) { Query = await new FormUrlEncodedContent(queryParams).ReadAsStringAsync() }.ToString();

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "id": 420,
            "note": null,
            "product_name": "Static Residential",
            "plan_name": "30 Days",
            "expire_date": "2024-04-20 10:25:12",
            "status": "confirmed",
            "location": "United States",
            "quantity": 5,
            "questions_answers": [
                {
                    "question": "Extra requirements (if you have any):",
                    "answer": "I need 128.158.97"
                }
            ],
            "proxy_data": {
                "ports": {
                    "socks5": 12324,
                    "http|https": 12323
                },
                "proxies": []
            },
            "auto_extend_settings": null,
            "extended_history": []
        },
        ...
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 2,
        "path": "https://apid.iproyal.com/v1/reseller/orders",
        "per_page": 10,
        "to": 10,
        "total": 14
    }
}
```

## Get Order

<mark style="color:green;">`GET`</mark>  `/orders/{order_id}`

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/12345" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345

url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        int orderId = 12345;
        String urlString = String.format("https://apid.iproyal.com/v1/reseller/orders/%d", orderId);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d", orderID)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Calculate Pricing

<mark style="color:green;">`GET`</mark>  `/orders/calculate-pricing`

**Query Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td></tr><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td></tr><tr><td>product_location_id</td><td>Integer</td><td>Product location id</td></tr><tr><td>quantity</td><td>Integer</td><td>Proxy quantity</td></tr><tr><td>coupon_code</td><td>String</td><td>Coupon code</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'product_location_id' => 789,
    'quantity' => 10,
    'coupon_code' => 'DISCOUNT2024'
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'product_plan_id': 456,
    'product_location_id': 789,
    'quantity': 10,
    'coupon_code': 'DISCOUNT2024'
}

url = 'https://apid.iproyal.com/v1/reseller/orders/calculate-pricing'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  product_plan_id: 456,
  product_location_id: 789,
  quantity: 10,
  coupon_code: 'DISCOUNT2024'
}).toString();

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/calculate-pricing?${params}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing" +
                "?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .GET()
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing"
)

func main() {
	params := url.Values{}
	params.Add("product_id", fmt.Sprintf("%d", 123))
	params.Add("product_plan_id", fmt.Sprintf("%d", 456))
	params.Add("product_location_id", fmt.Sprintf("%d", 789))
	params.Add("quantity", fmt.Sprintf("%d", 10))
	params.Add("coupon_code", "DISCOUNT2024")

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "product_plan_id", "456" },
            { "product_location_id", "789" },
            { "quantity", "10" },
            { "coupon_code", "DISCOUNT2024" }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var urlWithParams = new UriBuilder(url) { Query = await new FormUrlEncodedContent(queryParams).ReadAsStringAsync() }.ToString();

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "pre_discount_price": 30,
    "price_with_vat": 30,
    "vat": null,
    "price": 30,
    "pre_discount_price_per_item": 3,
    "price_per_item": 3,
    "plan_discount_percent": 0,
    "location_discount_percent": 0,
    "coupon_discount_percent": 0,
    "quantity_discount_percent": 0,
    "total_discount_percent": 0,
    "quantity_required_for_next_discount": {
        "quantity": 90,
        "discount": 5
    },
    "message": null
}
```

## Create Order

<mark style="color:blue;">`POST`</mark>  `/orders`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>product_id</td><td>Integer</td><td>Product id</td></tr><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td></tr><tr><td>product_location_id</td><td>Integer</td><td>Product location id</td></tr><tr><td>quantity</td><td>Integer</td><td>Proxy quantity</td></tr><tr><td>coupon_code</td><td>String</td><td>Coupon code</td></tr><tr><td>auto_extend</td><td>Boolean</td><td>Should the order be extended automatically</td></tr><tr><td>product_question_answers</td><td>Array</td><td><p>Answers to questions</p><pre><code>{ question_id: answer, ... }
</code></pre></td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_id": 123,
           "product_plan_id": 456,
           "product_location_id": 789,
           "quantity": 10,
           "coupon_code": "DISCOUNT2024",
           "auto_extend": true,
           "product_question_answers": {
               "question_id_1": "answer_1",
               "question_id_2": "answer_2"
           }
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/orders";

$data = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'product_location_id' => 789,
    'quantity' => 10,
    'coupon_code' => 'DISCOUNT2024',
    'auto_extend' => true,
    'product_question_answers' => [
        'question_id_1' => 'answer_1',
        'question_id_2' => 'answer_2'
    ]
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/orders'

data = {
    'product_id': 123,
    'product_plan_id': 456,
    'product_location_id': 789,
    'quantity': 10,
    'coupon_code': 'DISCOUNT2024',
    'auto_extend': True,
    'product_question_answers': {
        'question_id_1': 'answer_1',
        'question_id_2': 'answer_2'
    }
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const data = JSON.stringify({
  product_id: 123,
  product_plan_id: 456,
  product_location_id: 789,
  quantity: 10,
  coupon_code: 'DISCOUNT2024',
  auto_extend: true,
  product_question_answers: {
    question_id_1: 'answer_1',
    question_id_2: 'answer_2'
  }
});

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/orders',
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders";

        String requestBody = """
            {
                "product_id": 123,
                "product_plan_id": 456,
                "product_location_id": 789,
                "quantity": 10,
                "coupon_code": "DISCOUNT2024",
                "auto_extend": true,
                "product_question_answers": {
                    "question_id_1": "answer_1",
                    "question_id_2": "answer_2"
                }
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	data := map[string]interface{}{
		"product_id":              123,
		"product_plan_id":         456,
		"product_location_id":     789,
		"quantity":                10,
		"coupon_code":             "DISCOUNT2024",
		"auto_extend":             true,
		"product_question_answers": map[string]string{
			"question_id_1": "answer_1",
			"question_id_2": "answer_2",
		},
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var data = new
        {
            product_id = 123,
            product_plan_id = 456,
            product_location_id = 789,
            quantity = 10,
            coupon_code = "DISCOUNT2024",
            auto_extend = true,
            product_question_answers = new
            {
                question_id_1 = "answer_1",
                question_id_2 = "answer_2"
            }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## Extend Order

<mark style="color:blue;">`POST`</mark>  `/orders/{order_id}/extend`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>product_plan_id</td><td>Integer</td><td>Product plan id</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/12345/extend" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_plan_id": 678
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$product_plan_id = 678;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id/extend";

$data = [
    'product_plan_id' => $product_plan_id
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345
url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}/extend'

data = {
    'product_plan_id': 678
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;
const data = JSON.stringify({
  product_plan_id: 678
});

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}/extend`,
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>"; 
        String orderId = "12345";
        String url = "https://apid.iproyal.com/v1/reseller/orders/" + orderId + "/extend";

        String requestBody = """
            {
                "product_plan_id": 678
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d/extend", orderID)

	data := map[string]interface{}{
		"product_plan_id": 678,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}/extend";

        var data = new
        {
            product_plan_id = 678
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**&#x20;

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```


# Proxies

## Get Proxy Availability

<mark style="color:green;">`GET`</mark>  `/access/availability/sneaker-dc`

Returns a list of countries with available proxies count.

{% hint style="warning" %}
To use this feature, the admin must enable it. This feature requires a minimum total spend of $10000.
{% endhint %}

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/access/availability/sneaker-dc" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/access/availability/sneaker-dc";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: 'application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/access/availability/sneaker-dc'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/access/availability/sneaker-dc',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/access/availability/sneaker-dc";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/access/availability/sneaker-dc"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/access/availability/sneaker-dc";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "data": [
        {
            "country_code": "DE",
            "country_name": "Germany",
            "available_ips": 2887
        },
        {
            "country_code": "GB",
            "country_name": "United Kingdom",
            "available_ips": 2351
        },
        {
            "country_code": "US",
            "country_name": "United States",
            "available_ips": 1112
        },
        {
            "country_code": "NL",
            "country_name": "Netherlands",
            "available_ips": 1293
        },
        {
            "country_code": "IT",
            "country_name": "Italy",
            "available_ips": 1812
        },
        ...
    ]
}
```

##

## Change Credentials

<mark style="color:green;">`GET`</mark>  `/orders/proxies/change-credentials`

**Body Parameters**

<table><thead><tr><th width="257">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>order_id</td><td>Integer</td><td>Order id</td></tr><tr><td>proxies</td><td>Array</td><td>List of proxies</td></tr><tr><td>username</td><td>String</td><td>Proxy connection username</td></tr><tr><td>password</td><td>String</td><td>Proxy connection password</td></tr><tr><td>random_password</td><td>Boolean</td><td>Should we assign a random password</td></tr><tr><td>is_reset</td><td>Boolean</td><td>Should we assign a random username and password</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?order_id=12345&username=new_username&password=new_password&random_password=false&is_reset=true" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{"proxies": ["proxy1", "proxy2"]}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$proxies = ['proxy1', 'proxy2'];
$username = 'new_username';
$password = 'new_password';
$random_password = false;
$is_reset = true;

$url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?order_id=$order_id&username=$username&password=$password&random_password=$random_password&is_reset=$is_reset";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode(['proxies' => $proxies])
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345  
proxies = ['proxy1', 'proxy2']  
username = 'new_username'
password = 'new_password'
random_password = False
is_reset = True

url = f'https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?order_id={order_id}&username={username}&password={password}&random_password={random_password}&is_reset={is_reset}'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, json={'proxies': proxies}, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345; 
const proxies = ['proxy1', 'proxy2']; 
const username = 'new_username';
const password = 'new_password';
const random_password = false;
const is_reset = true;

const data = JSON.stringify({
  proxies: proxies
});

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/proxies/change-credentials?order_id=${order_id}&username=${username}&password=${password}&random_password=${random_password}&is_reset=${is_reset}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials" +
                "?order_id=12345&username=new_username&password=new_password&random_password=false&is_reset=true";
        
        String requestBody = """
            {
                "proxies": ["proxy1", "proxy2"]
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	proxies := []string{"proxy1", "proxy2"}
	username := "new_username"
	password := "new_password"
	randomPassword := false
	isReset := true

	params := url.Values{}
	params.Add("order_id", fmt.Sprintf("%d", orderID))
	params.Add("username", username)
	params.Add("password", password)
	params.Add("random_password", fmt.Sprintf("%t", randomPassword))
	params.Add("is_reset", fmt.Sprintf("%t", isReset))

	fullURL := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?%s", params.Encode())

	jsonData, err := json.Marshal(map[string]interface{}{
		"proxies": proxies,
	})
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodGet, fullURL, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string username = "new_username";
        string password = "new_password";
        bool randomPassword = false;
        bool isReset = true;
        string[] proxies = { "proxy1", "proxy2" };

        string url = $"https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?order_id={orderId}&username={username}&password={password}&random_password={randomPassword}&is_reset={isReset}";

        var data = new
        {
            proxies = proxies
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# Mobile

IPRoyal offers two types of [Mobile Proxies](https://iproyal.com/mobile-proxies/): **Dedicated Mobile Proxies** and **Rotating Mobile Proxies**. Both give you access to real mobile IPs across multiple countries. You can check the list of available countries and locations [on our website](https://iproyal.com/mobile-proxies/). We update our mobile proxy server network regularly to ensure a constant supply of fresh and reliable IPs for all sorts of tasks.

#### Dedicated vs. Rotating Mobile Proxies&#x20;

**Dedicated Mobile Proxies** are reserved IPs, billed per proxy. They are best for tasks that require a consistent IP (such as long-term social media management or continuous data collection) and give you full control over location and rotation timing.&#x20;

**Rotating Mobile Proxies** are billed per GB, with IPs rotating automatically on each request. They are best for variable or campaign-based workloads where you only want to pay for what you use.&#x20;

### Key Advantages of IPRoyal Mobile Proxies <a href="#key-advantages-of-iproyal-mobile-proxies" id="key-advantages-of-iproyal-mobile-proxies"></a>

* **Highly competitive pricing**

Dedicated Mobile Proxies include discounts for longer periods: 5% off the 60-day plan and 10% off the 90-day plan. Rotating Mobile Proxies include automatic volume discounts based on the amount of data purchased.

* **Versatile plans**

Dedicated Mobile Proxies are available in four plans from 1 to 90 days. Rotating Mobile Proxies operate on 30-day subscription cycles, billed per GB with automatic volume discounts applied at checkout.

* **Real mobile IPs**

All our mobile proxies come from residential mobile network pools - you’re renting a physical mobile device with a 3G/4G/5G SIM card.

* **24/7 support**

With an average response time of just 58 seconds, our skilled team of experts is available around the clock and ready to help you set up and make the most of your proxies.

### Technical Features of IPRoyal Mobile Proxies <a href="#technical-features-of-iproyal-mobile-proxies" id="technical-features-of-iproyal-mobile-proxies"></a>

* **Instant IP rotation**

Dedicated Mobile Proxies support manual or automatic rotation every 3-6 minutes, depending on proxy location (1-day plan: manual only; 30/60/90-day plans: manual or automatic). Rotating Mobile Proxies rotate automatically on every request with no interval restrictions.

* **Access to the entire IP pool**

By renting a mobile proxy, you can switch between all available IPs in your chosen location for full control over your online activities.

* **Unlimited traffic & sessions**

Dedicated Mobile Proxies include unlimited traffic and sessions. Rotating Mobile Proxies are billed per GB consumed with no session restrictions.

* **High compatibility**

Manage social media accounts, gather data, perform SEO research, automate processes, and more - you can use our mobile proxies for any site.


# Dashboard

In this part of the guide, we offer clear and thorough instructions for mastering the dashboard's functionalities. This guide is designed to be user-friendly, ensuring that both beginners and seasoned users can efficiently maximize the benefits of our services using the dashboard.


# Making an Order

Welcome to the step-by-step guide for placing an order for proxies on our website. In this section, we will provide you with detailed screenshots and clear explanations to ensure a seamless and straightforward ordering process. Our aim is to make your experience as intuitive and efficient as possible. Let's walk through the process together, showing you exactly how to order your first Mobile proxies!

***

To begin your purchase of Mobile proxies, navigate to the 'Mobile' section (<mark style="color:orange;">1</mark>) on the sidebar menu. This action will direct you to the Mobile proxies dashboard.

Once you're on the dashboard, click the '+ Create a new order' button (<mark style="color:orange;">2</mark>). This will initiate the process for you to start creating your proxy order with your desired specifications.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FWPmbrYCGiJFL3rHaK4dN%2Fimage.png?alt=media&amp;token=0becc0da-639d-40fd-8d9a-a2449b411a94" alt=""><figcaption></figcaption></figure>

Firstly, you will need to choose a plan (<mark style="color:orange;">1</mark>) that specifies the duration, in days, for which you require your proxies to be active.

The next step involves choosing the location for your proxies (<mark style="color:orange;">2</mark>).

Lastly, there is a summary panel that displays the total price of your order. It also includes a button that you must click to proceed with the purchase. (<mark style="color:orange;">6</mark>)

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FSw96trQ59lb9nDEk4VSN%2Fimage.png?alt=media&amp;token=9ee343bd-0661-4373-830c-3493ebe7a1cf" alt=""><figcaption></figcaption></figure>

You're almost there! The final step is to complete your payment for the order.&#x20;

As displayed on the 'Complete order' page, you have multiple payment options to choose from for your convenience. Whether you prefer to use a credit card, cryptocurrency, PayPal, or Google Pay, simply select your preferred payment method and fill in the required details (<mark style="color:orange;">1</mark>).&#x20;

Once you have entered your payment information, review your order summary to ensure everything is correct. If you have a coupon code, enter it and click "Apply" (<mark style="color:orange;">2</mark>).

After all of this is done, click the 'Complete order' button (<mark style="color:orange;">3</mark>) to finalize your purchase.

Rest assured, all transactions are secure, and you have the option to save your payment information for future purchases.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2Fjm8WIWub5HB4rykJHf0q%2Fimage.png?alt=media&amp;token=d5185f2f-e640-4b5a-a748-d0c8e468419a" alt=""><figcaption></figcaption></figure>

Congratulations! Your order has been successfully processed. You will see a confirmation message and a panel for adding a note. This feature allows you to write something for future reference. Importantly, you will be able to search for the order using the content of your note.

{% hint style="info" %}
You will be able to change the note anytime from the order configuration page.
{% endhint %}

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FEp7axIPs6u0J5DFPZdG0%2Fimage.png?alt=media&amp;token=315bc6eb-2ace-417f-8c8f-2d042494212c" alt=""><figcaption></figcaption></figure>


# Orders

In the 'Mobile Proxies' dashboard, the 'Orders' panel provides a comprehensive view of all your orders, encompassing active, expired, and unpaid ones. This panel is equipped with advanced filtering options, allowing you to sort and view orders based on a variety of criteria beyond just their status. These filters facilitate efficient management and quick access to specific orders. Each order entry includes convenient features to view its details, download an invoice, or extend its duration.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FUwWH0CFdbXAWiC0z5GF8%2FK1.png?alt=media&amp;token=852fc7eb-6c06-4cfe-983a-aef81ccb4ab7" alt=""><figcaption></figcaption></figure>


# Order Configuration

To begin configuring your order, you first need to access its details page.

First, navigate to the 'Mobile' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click on 'Details' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F3r6xpg7OiQP2qLTO9a6K%2FL1.png?alt=media&amp;token=aeea3a16-4592-4c72-91eb-72a5de44f546" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
In the page you will find a section labeled 'Subscription'. We will discuss this feature in more detail in the 'Extending an Order' section.<br>

[Extending an Order](/proxies/mobile/dashboard/extending-an-order)
{% endhint %}

Upon entering this page, you will first encounter the 'Proxy details' and 'Order details' toggle (<mark style="color:orange;">1</mark>). The 'Proxy details' page covers the proxy configuration options, while the 'Order details' page offers an order overview and subscription management options.

Next, you will see the 'Proxy Access' panel (<mark style="color:orange;">2</mark>), where all your connection details are conveniently located. From here, you can copy them or download them.

You can also rotate your IP address via the 'Rotate IP' button (<mark style="color:orange;">3</mark>), Rotation link (<mark style="color:orange;">4</mark>), and automatically after a set period (<mark style="color:orange;">5</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FnQnlBGDO1ecHoejgrBPd%2FL2.png?alt=media&amp;token=126a6bde-7531-4591-af61-60b1cb0f475b" alt=""><figcaption></figcaption></figure>

By switching to the 'Order details' panel (<mark style="color:orange;">1</mark>), you will get the basic information about your order (<mark style="color:orange;">2</mark>) and the status of your subscription (<mark style="color:orange;">3</mark>).

Next, you will come across a panel for adding a note (<mark style="color:orange;">4</mark>). This feature allows you to write something for future reference. Importantly, you will be able to search for the order using the content of your note.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FGt8BePwJBMEIGnX7l3bp%2FL3.png?alt=media&amp;token=edc7528d-5d0c-44bd-a6be-70b83fdbe125" alt=""><figcaption></figcaption></figure>


# Extending an Order

There is an option to extend your order, a useful feature as it ensures you keep the IPs you've been provided. There are two methods for extending:

* A manual extension where you can go to the orders dashboard and simply click 'Extend';
* A subscription. Enabling this will let you virtually forget about manual extensions, as it automatically renews the order each time it nears expiration.

When extending your order, you also have the option to change your plan. For instance, if you initially had a 90-day plan but only need the proxies for one more day or an additional month, you can adjust the duration accordingly during the extension process. The same option is available with a subscription.

{% hint style="info" %}
Note: You can only extend orders that are still active. Once order status becomes Expired, it cannot be extended or renewed.
{% endhint %}

### Manual Extension

Navigate to the 'Mobile' section (<mark style="color:orange;">1</mark>) via the sidebar menu.&#x20;

Once you locate your order, click on 'Extend' (<mark style="color:orange;">2</mark>) to proceed.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F7U9eusQI7Nn3PqU0Xka0%2FM1.png?alt=media&amp;token=6e4f23b0-0253-423c-bc3d-c99136b73c88" alt=""><figcaption></figcaption></figure>

In this section, you have the flexibility to select a new plan or continue with the current one (<mark style="color:orange;">1</mark>). Additionally, you can view the 'Expire Date' to determine when the plan is set to expire (<mark style="color:orange;">2</mark>).

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FEW5rJ4IZ46IvOMitRZsv%2FM2.png?alt=media&amp;token=c2fc6459-cb23-4fe9-a38a-45a3f04506b3" alt=""><figcaption></figcaption></figure>

Following this, you will be directed to a familiar page where you can proceed with the extension process and complete the payment for the extension.

### Subscription

To enable subscriptions, please navigate to the 'Order details' (<mark style="color:orange;">1</mark>) section on the 'Order Configuration” page.

On this page, you will find a panel that allows you to enable a subscription (<mark style="color:orange;">2</mark>) for this order. You can modify the plan (<mark style="color:orange;">3</mark>) here. Once you’re satisfied with your choices, select your preferred payment method (<mark style="color:orange;">4</mark>) and click 'Save' (<mark style="color:orange;">5</mark>) to enable a subscription.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F6Lp4kORH1NkiiwoihFZ0%2FM3.png?alt=media&amp;token=567a2250-bdaf-4586-8d52-4e139b50d71e" alt=""><figcaption></figcaption></figure>


# Using Proxy Strings

In this section, we'll show practical examples of using the proxy string we've created. We'll focus on setting up HTTP/HTTPS and SOCKS5 connections, illustrated through examples in various programming languages.

{% hint style="warning" %}
Keep in mind that the ports will differ depending on the protocol **(HTTP/SOCKS5)**. To choose between HTTP or SOCKS5 proxies, please refer to the 'Proxy access' panel within the 'Order Configuration' section.\
\
[Order Configuration](/proxies/isp/dashboard/order-configuration)
{% endhint %}

### HTTP/HTTPS

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v -x http://gb.4g.iproyal.com:7001 --proxy-user IqcDPwX:Cz6hB219pDaCgEG -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://ipv4.icanhazip.com';
$proxy = 'gb.4g.iproyal.com:7001';
$proxyAuth = 'IqcDPwX:Cz6hB219pDaCgEG';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
```

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');

const url = 'https://ipv4.icanhazip.com';
const proxyOptions = {
  host: 'gb.4g.iproyal.com',
  port: 7001,
  auth: {
    username: 'IqcDPwX',
    password: 'Cz6hB219pDaCgEG'
  }
};

axios.get(url, { proxy: proxyOptions })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
proxy = 'gb.4g.iproyal.com:7001'
proxy_auth = 'IqcDPwX:Cz6hB219pDaCgEG'
proxies = {
    'http': f'http://{proxy_auth}@{proxy}',
    'https': f'http://{proxy_auth}@{proxy}'
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}

### SOCKS5

{% tabs %}
{% tab title="cURL" %}

```bash
curl -v --socks5 gb.4g.iproyal.com:3008 --proxy-user IqcDPwX:Cz6hB219pDaCgEG -L https://ipv4.icanhazip.com
```

{% endtab %}

{% tab title="PHP" %}

<pre class="language-php"><code class="lang-php"><strong>&#x3C;?php
</strong>
$url = 'https://ipv4.icanhazip.com';
$proxy = 'gb.4g.iproyal.com:3008';
$proxyAuth = 'IqcDPwX:Cz6hB219pDaCgEG';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
</code></pre>

{% endtab %}

{% tab title="JS" %}

```javascript
const axios = require('axios');
const SocksProxyAgent = require('socks-proxy-agent');

const url = 'https://ipv4.icanhazip.com';
const socksProxy = 'socks5://IqcDPwX:Cz6hB219pDaCgEG@gb.4g.iproyal.com:3008';
const agent = new SocksProxyAgent(socksProxy);

axios.get(url, { httpAgent: agent, httpsAgent: agent })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
socks5_proxy = 'socks5://IqcDPwX:Cz6hB219pDaCgEG@gb.4g.iproyal.com:3008'
proxies = {
    'http': socks5_proxy,
    'https': socks5_proxy
}

response = requests.get(url, proxies=proxies)
print(response.text)
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
We suggest opting for the HTTP protocol instead of SOCKS5 when compatible with your software, due to the particularities of our hardware. While both protocols are supported and perform efficiently, issues encountered with HTTP are typically resolved more swiftly.
{% endhint %}


# Troubleshooting

Here are the most common errors faced by our clients.

### M**obile proxy doesn’t react to IP rotation request instantly.**

Due to the specifics of our hardware and varying cell tower traffic in the US, there may be times when a carrier does not immediately assign a new IP address upon request. In some cases, this process could take up to 30 minutes, and the duration can vary depending on the time of day. Control over the IP pool lies with the ISP, so the frequency of new IP allocation is determined by their policies. For those seeking immediate rotation of US proxies, we advise acquiring additional ports. This allows you to switch proxies within your system whenever a new IP is desired. After switching, you can then request a new IP for the proxy that was previously replaced. If the rotation process encounters a complete stall, our systems are designed to automatically detect and resolve the issue, ensuring you won’t need to take any action.

### Sometimes mobile proxy rotates by itself.

Proxies that are under ISP’s have their own Rotation per day as constituted by CGNAT Process. The IP you are getting in every rotation you made on the proxy are coming from the ISP itself. For the IP changing more frequently than expected it is due to ISP’s own rotation which we don’t have a control for its own rotation interval.

### Mobile proxy is unstable or down.

If you encounter a non-functional proxy, there’s no need for immediate action on your part. Our system is equipped to identify such issues, and our support team is automatically engaged to work on a resolution. However, there may be instances where the system does not detect unstable proxies. In such cases, we advise you to report it to our support team.

### In rare cases, IP appears from State.

It’s completely normal for mobile proxy IPs to be located around the location proxy is operating in. Even cases when ISP give IP from other side of a country is acceptable and no web service will raise any red flag for that. Regular users using mobile phones in the city experience same IP location placements. We do not have control over IPs of proxy, they come straight from ISP.

### Abusing, using too much traffic or connections.

Our “unlimited” mobile proxy service is designed to cater to a wide range of needs with flexibility and reliability. However, the term “unlimited” comes with the responsibility of fair usage to ensure all our clients enjoy a consistent and quality experience. Excessive data usage (30GB or more per day per proxy) poses a risk of our SIM cards being temporarily restricted or permanently banned by our carriers due to their fair usage policies. To mitigate this risk and maintain the high-quality service expected by all our clients, we kindly ask you to consider lowering your data usage or splitting your traffic across multiple proxies. This approach not only adheres to fair usage guidelines but also helps in ensuring your activities can continue without interruption.


# API

### Base URL

**`https://apid.iproyal.com/v1/reseller`**

### Authorization

To authorize your API calls, we validate the **`X-Access-Token`** header. You can find and reset this token on the dashboard's **Settings** page in the 'API' section.


# User

## Get Balance

<mark style="color:green;">`GET`</mark>  `/balance`

Returns the user's balance.

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://apid.iproyal.com/v1/reseller/balance" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/balance";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/balance'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/balance',
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/balance";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/balance"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/balance";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JObject.Parse(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
884.05
```


# Proxies

## Rotate IP

<mark style="color:blue;">`POST`</mark>  `/orders/4g/rotate-ip/{key}`

**Query Parameters**

<table><thead><tr><th width="159">Name</th><th width="145">Type</th><th>Description</th></tr></thead><tbody><tr><td>key</td><td>String</td><td>Key to rotate IP</td></tr></tbody></table>

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/4g/rotate-ip/<your_key>" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$key = '<your_key>';

$url = "https://apid.iproyal.com/v1/reseller/orders/4g/rotate-ip/$key";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
key = '<your_key>'
url = f'https://apid.iproyal.com/v1/reseller/orders/4g/rotate-ip/{key}'

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const key = '<your_key>';

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/4g/rotate-ip/${key}`,
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String key = "<your_key>";
        String urlString = String.format("https://apid.iproyal.com/v1/reseller/orders/4g/rotate-ip/%s", key);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setDoOutput(true);

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("Post request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	key      = "<your_key>"
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/4g/rotate-ip/%s", key)

	req, err := http.NewRequest(http.MethodPost, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string key = "<your_key>";
        string url = $"https://apid.iproyal.com/v1/reseller/orders/4g/rotate-ip/{key}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.PostAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}


# User Management

The user management feature makes team collaboration easier than ever. As an IPRoyal <mark style="color:orange;">account owner</mark>, you have the ability to create <mark style="color:orange;">sub-accounts</mark>, granting your team members access to the IPRoyal dashboard. This approach improves security, control, and efficiency, making it simple to delegate tasks while still having full oversight of all activities on your account.

Sub-account users can:

* Configure and use proxies
* Use a unique API token
* Deposit funds to your account
* Place new orders
* Manage subscriptions
* Extend existing orders
* Create and manage Residential Proxies sub-users
* View invoices
* Leave suggestions
* Customize and delete their account<br>

Sub-account users can not:

* Add new team members
* Access your Referral Program page

### Adding a new sub-account

To invite a new user to your account, click on your email (<mark style="color:orange;">1</mark>) in the dashboard and select User management (<mark style="color:orange;">2</mark>) from the drop-down menu.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FpdfB2S5jGSkeMv80KwfZ%2FIMG1e.png?alt=media&amp;token=fc5ba2d6-aceb-4279-8d1f-4d425259b845" alt=""><figcaption></figcaption></figure>

Click the 'Invite new user' (<mark style="color:orange;">1</mark>) button to add a new <mark style="color:orange;">managed user</mark> to your account.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FhclrSEoh7WqGV6HHJsym%2FIMG2e.png?alt=media&amp;token=950f7541-1616-4f02-9f0c-a9d1bca041c8" alt=""><figcaption></figcaption></figure>

Enter their first (<mark style="color:orange;">1</mark>) and last (<mark style="color:orange;">2</mark>) name, email address (<mark style="color:orange;">3</mark>) and click the Send (<mark style="color:orange;">4</mark>) button.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FiXHEljtQ2uRnTnKViRfH%2FIMG3e.png?alt=media&amp;token=4f72aa77-49f7-4f45-8650-2588769f3afd" alt=""><figcaption></figcaption></figure>

Once the process is complete, they can log in to your IPRoyal account using their own credentials. You will see their status (<mark style="color:orange;">1</mark>), last login date (<mark style="color:orange;">2</mark>), and the option to remove (<mark style="color:orange;">3</mark>) their <mark style="color:orange;">sub-account</mark>.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FQY16ErQ7gOwhDuIE1uK7%2FIMG4e.png?alt=media&amp;token=cd83cf59-6ed0-458f-ad24-fb7c175e41f7" alt=""><figcaption></figcaption></figure>

### Activating a sub-account

Once an IPRoyal account owner invites you to join their account, you will receive an email. Click the Complete Your Registration (<mark style="color:orange;">1</mark>) button.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FrqEMDBy06IAHmI7X0azM%2FIMG5e.png?alt=media&amp;token=224cd855-87c7-48b4-86aa-3fa7c4a10063" alt=""><figcaption></figcaption></figure>

Create (<mark style="color:orange;">1</mark>) and confirm (<mark style="color:orange;">2</mark>) your password, then click the Save (<mark style="color:orange;">3</mark>) button.

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2F8sOkerXW0lzOarXTfu0C%2FIMG6e.png?alt=media&amp;token=5a9489f5-c942-42b7-b1c2-e596f5fea3d0" alt=""><figcaption></figcaption></figure>

Once you’re done, you’ll be able to log in to IPRoyal using your email address and password.<br>

<figure><img src="https://22873178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Y3jlvZjKrqTSLg2hBbJ%2Fuploads%2FPWzfwVRTws3dPCWS3GrI%2FIMG7e.png?alt=media&amp;token=48d40e68-0ece-4003-9e4d-bb6874f72071" alt=""><figcaption></figcaption></figure>

<br>


# Web Unblocker

A [Web Unblocker](https://iproyal.com/web-unblocker/) is an advanced, AI-powered solution built to reliably access and extract public web data – even from sites protected by geo-restrictions, CAPTCHAs, Cloudflare protections, and other anti-bot systems. Unlike [standard proxies](https://iproyal.com/proxies/), a Web Unblocker automates the entire unblocking process, from smart IP selection to automatic retries, eliminating common scraping obstacles.


# Making A Request

The Web Unblocker functions as an HTTP proxy and performs a Man-in-the-Middle (MITM) operation on traffic. This allows it to intercept and modify requests in order to bypass anti-scraping protections.

Due to the MITM mechanism and the required SSL handling, it is not recommended to use the unblocker in browsers or with tools like Playwright.

By the nature of the tool, we currently support only **GET** requests.

**Example requests:**

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```
curl -k -v -x http://unblocker.iproyal.com:12323 --proxy-user username:password -L https://ipv4.icanhazip.com
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}

```php
<?php

declare(strict_types=1);

$url = 'https://ipv4.icanhazip.com';
$proxy = 'http://unblocker.iproyal.com:12323';
$proxyAuth = 'username:password';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://ipv4.icanhazip.com'
proxy = 'unblocker.iproyal.com:12323'
proxy_auth = 'username:password'
proxies = {
   'http': f'http://{proxy_auth}@{proxy}',
   'https': f'http://{proxy_auth}@{proxy}'
}

response = requests.get(
   url,
   proxies=proxies,
   verify=False,
   allow_redirects=True,
   timeout=30,
)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```
const { fetch, ProxyAgent } = require('undici');

const url = 'https://ipv4.icanhazip.com';
const client = new ProxyAgent(
  'http://username:password@unblocker.iproyal.com:12323'
);

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

(async () => {
  try {
    const response = await fetch(url, {
      redirect: 'follow',
      dispatcher: client,
      headers: {
        'user-agent': 'undici-proxy-test'
      }
    });
    const text = await response.text();
    if (!response.ok) {
      console.error(`HTTP ${response.status} ${response.statusText}`);
    }
    console.log(text.trim());
  } catch (error) {
    console.error('Fetch failed:', error);
  }
})();
```

{% endtab %}

{% tab title="Java" %}

```java
import javax.net.ssl.*;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class Main {
    private static final String PROXY_HOST = "unblocker.iproyal.com";
    private static final int    PROXY_PORT = 12323;
    private static final String USERNAME   = "username";
    private static final String PASSWORD   = "password";

    private static final String TARGET_HOST = "ipv4.icanhazip.com";
    private static final int    TARGET_PORT = 443;

    private static final boolean INSECURE_TRUST_ALL = true;

    public static void main(String[] args) {
        try {
            System.out.println(fetchIpThroughProxy());
        } catch (Exception e) {
            System.err.println("ERROR: " + e.getClass().getSimpleName() + ": " + e.getMessage());
        }
    }

    private static String fetchIpThroughProxy() throws Exception {
        final String basic = Base64.getEncoder()
                .encodeToString((USERNAME + ":" + PASSWORD).getBytes(StandardCharsets.ISO_8859_1));

        try (Socket proxy = new Socket()) {
            proxy.connect(new InetSocketAddress(PROXY_HOST, PROXY_PORT), 15_000);
            proxy.setSoTimeout(15_000);

            try (var out = new BufferedWriter(new OutputStreamWriter(proxy.getOutputStream(), StandardCharsets.ISO_8859_1));
                 var in  = new BufferedInputStream(proxy.getInputStream())) {

                out.write("CONNECT " + TARGET_HOST + ":" + TARGET_PORT + " HTTP/1.1\r\n");
                out.write("Host: " + TARGET_HOST + ":" + TARGET_PORT + "\r\n");
                out.write("Proxy-Authorization: Basic " + basic + "\r\n");
                out.write("Proxy-Connection: Keep-Alive\r\n\r\n");
                out.flush();

                final String status = readLine(in);
                if (status == null || !status.startsWith("HTTP/1.1 200")) {
                    throw new IOException("CONNECT failed: " + status);
                }
                drainHeaders(in);

                SSLSocket ssl = (SSLSocket) sslFactory().createSocket(proxy, TARGET_HOST, TARGET_PORT, true);
                SSLParameters params = ssl.getSSLParameters();
                params.setServerNames(java.util.List.of(new SNIHostName(TARGET_HOST)));
                ssl.setSSLParameters(params);
                ssl.startHandshake();

                try (var httpsOut = new BufferedWriter(new OutputStreamWriter(ssl.getOutputStream(), StandardCharsets.ISO_8859_1));
                     var httpsIn  = new BufferedInputStream(ssl.getInputStream())) {

                    httpsOut.write("GET / HTTP/1.1\r\n");
                    httpsOut.write("Host: " + TARGET_HOST + "\r\n");
                    httpsOut.write("User-Agent: JavaRawProxy\r\n");
                    httpsOut.write("Connection: close\r\n\r\n");
                    httpsOut.flush();

                    drainHeaders(httpsIn);
                    return readBody(httpsIn).trim();
                }
            }
        }
    }

    private static SSLSocketFactory sslFactory() throws Exception {
        if (!INSECURE_TRUST_ALL) return (SSLSocketFactory) SSLSocketFactory.getDefault();
        TrustManager[] trustAll = new TrustManager[]{ new X509TrustManager() {
            public void checkClientTrusted(java.security.cert.X509Certificate[] c, String a) {}
            public void checkServerTrusted(java.security.cert.X509Certificate[] c, String a) {}
            public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[0]; }
        }};
        SSLContext ctx = SSLContext.getInstance("TLS");
        ctx.init(null, trustAll, new java.security.SecureRandom());
        return ctx.getSocketFactory();
    }

    private static void drainHeaders(InputStream in) throws IOException {
        String line;
        while ((line = readLine(in)) != null && !line.isEmpty()) {}
    }

    private static String readBody(InputStream in) throws IOException {
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        byte[] tmp = new byte[4096];
        int n;
        while ((n = in.read(tmp)) != -1) buf.write(tmp, 0, n);
        return buf.toString(StandardCharsets.ISO_8859_1);
    }

    private static String readLine(InputStream in) throws IOException {
        StringBuilder sb = new StringBuilder();
        int prev = -1, cur;
        while ((cur = in.read()) != -1) {
            if (prev == '\r' && cur == '\n') { sb.setLength(sb.length() - 1); break; }
            sb.append((char) cur); prev = cur;
        }
        return (sb.length() == 0 && cur == -1) ? null : sb.toString();
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "crypto/tls"
    "encoding/base64"
    "fmt"
    "io"
    "net/http"
    "net/url"
    "time"
)

func main() {
    proxyUser := "username"
    proxyPass := "password"
    proxyStr := "http://unblocker.iproyal.com:12323"

    target := "https://ipv4.icanhazip.com"

    proxyURL, err := url.Parse(proxyStr)
    if err != nil {
        panic(err)
    }
    proxyURL.User = url.UserPassword(proxyUser, proxyPass)

    basic := "Basic " + base64.StdEncoding.EncodeToString([]byte(proxyUser+":"+proxyPass))

    tr := &http.Transport{
        Proxy: http.ProxyURL(proxyURL),

        TLSClientConfig: &tls.Config{InsecureSkipVerify: true},

        ProxyConnectHeader: http.Header{
            "Proxy-Authorization": []string{basic},
        },
    }

    client := &http.Client{
        Transport: tr,
        Timeout:   30 * time.Second,
    }

    resp, err := client.Get(target)
    if err != nil {
        fmt.Println("Request error:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Printf("HTTP %d\n%s\n", resp.StatusCode, string(body))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Net;
using System.Net.Sockets;
using System.Net.Security;
using System.Text;

class Program
{
    static async Task Main()
    {
        var url = new Uri("https://ipv4.icanhazip.com");
        var proxy = new Uri("http://unblocker.iproyal.com:12323");
        const string proxyUser = "username";
        const string proxyPass = "password";

        using var client = CreateHttpClient(proxy, proxyUser, proxyPass);
        var ip = (await client.GetStringAsync(url)).Trim();
        Console.WriteLine(ip);
    }

    private static HttpClient CreateHttpClient(Uri proxyUri, string user, string pass)
    {
        var handler = new SocketsHttpHandler
        {
            AllowAutoRedirect = true,
            AutomaticDecompression = DecompressionMethods.All,
            SslOptions = new SslClientAuthenticationOptions
            {
                RemoteCertificateValidationCallback = static (_, _, _, _) => true
            },
            ConnectCallback = async (ctx, ct) =>
            {
                var tcp = new TcpClient();
                await tcp.ConnectAsync(proxyUri.Host, proxyUri.Port);
                var stream = tcp.GetStream();

                var auth = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{user}:{pass}"));
                string host = ctx.DnsEndPoint.Host;
                int port = ctx.DnsEndPoint.Port;

                var request =
                    $"CONNECT {host}:{port} HTTP/1.1\r\n" +
                    $"Host: {host}:{port}\r\n" +
                    $"Proxy-Authorization: Basic {auth}\r\n" +
                    "\r\n";

                var bytes = Encoding.ASCII.GetBytes(request);
                await stream.WriteAsync(bytes, 0, bytes.Length, ct);
                await stream.FlushAsync(ct);

                using var reader = new StreamReader(stream, Encoding.ASCII, detectEncodingFromByteOrderMarks: false, bufferSize: 4096, leaveOpen: true);
                var status = await reader.ReadLineAsync();
                if (status is null || !status.Contains(" 200 "))
                    throw new IOException($"Proxy CONNECT failed: {status}");
                
                while (!string.IsNullOrEmpty(await reader.ReadLineAsync())) { }
                return stream;
            }
        };

        var client = new HttpClient(handler)
        {
            Timeout = TimeSpan.FromSeconds(30)
        };
        client.DefaultRequestVersion = HttpVersion.Version11;
        return client;
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
To use the Web Unblocker, you **must disable HTTPS certificate verification.**
{% endhint %}

#### Response Codes

Error codes, often HTTP status codes, indicate problems encountered while accessing a website.

Common errors include 404 (Not Found), 403 (Forbidden), 502 (Bad Gateway), and 503 (Service Unavailable). These codes help identify whether the issue is with the client (4xx), the server (5xx), or a redirection (3xx).&#x20;

| **Response Code** | **Explanation**                                                                          |
| ----------------- | ---------------------------------------------------------------------------------------- |
| 200               | Request was successful.                                                                  |
| 301/302           | The page redirected.                                                                     |
| 403               | The request was blocked.                                                                 |
| 404               | The URL doesn’t exist.                                                                   |
| 429               | Rate limit is reached. We currently allow up to 200 active connections at the same time. |
| 500               | The target server had a problem.                                                         |
| 502               | A gateway or proxy server failed to get a valid response.                                |
| 503               | The server is overloaded or down.                                                        |
| 504               | The server took too long to respond.                                                     |


# Features

**IP Rotation and Skipping**

Web Unblocker automatically chooses the most effective IP address for each request and skips problematic ones to avoid bans.

**Automatic Retries**

Web Unblocker retries failed requests with new IPs automatically. Please note we currently allow up to 200 active connections at the same time, so if a site takes longer to unblock, the effective request rate may decrease accordingly.

[**Geo-Location Targeting**](/tools/web-unblocker/geo-location-targeting)

Geo-location can be set manually at country, city and state level.

[**JavaScript Rendering** ](/tools/web-unblocker/javascript-rendering)

Web Unblocker offers on-demand JavaScript rendering using a special flag.&#x20;

[**Custom Headers**](/tools/web-unblocker/custom-headers)

Web Unblocker supports the use of custom HTTP headers, allowing you to tailor requests for specific use cases.


# JavaScript Rendering

By default, the Web Unblocker attempts to load websites using a simple HTTP request. It checks the HTTP response code, and if the response is successful (e.g., status code `200`), the body is returned to the client.

However, some websites return a `200 OK` status while still serving a placeholder or error message indicating that **JavaScript is disabled**. In such cases, no actual page content is rendered or visible.

To handle this, the web unblocker offers **on-demand JavaScript rendering** using a special `render` flag. This instructs the unblocker to fully render the page in a headless browser before returning the response, allowing access to JavaScript-dependent content.

#### **How to Use the `render` Flag**

You can enable rendering by appending `_render-1` to the password in your proxy credentials. For example:

```
curl -x http://username:password_render-1@unblocker.iproyal.com:12323 https://example.com -k -v
```

**Use Cases**

* Accessing sites that require JavaScript to display content
* Bypassing anti-bot pages that rely on JavaScript
* Scraping modern web apps with dynamic front-ends

**Notes**

* Rendering may increase response times due to the overhead of launching a headless browser.
* Use rendering only when needed, as most sites can still be accessed with basic HTTP requests.


# Custom Headers

Web Unblocker supports the use of custom HTTP headers, allowing you to tailor requests for specific use cases.&#x20;

### **Allowed Headers (Forwarded As-Is)**

These headers are allowed and passed through the unblocker unchanged:

* Cookie
* User-Agent
* Accept-Language
* Accept-Encoding
* Custom headers (e.g., X-My-Header)
* Other headers not [listed as blocked](#blocked-hop-by-hop-headers)

Example usage:

```
curl -x <http://unblocker.example> \\
     --proxy-user user:pass \\
     -H 'Cookie: user=hello; theme=dark' \\
     -H 'X-My-Header: custom-value' \\
     <https://httpbin.org/headers>
```

### **User-Agent Rules**

If your client:

* Uses `User-Agent: curl/... or User-Agent: wget/...`
* Or sends no `User-Agent` at all

Then the unblocker will replace it with a randomized browser User-Agent, such as:

```
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/134.0.0.0 Safari/537.3
```

### **Blocked (Hop-by-Hop) Headers**

The unblocker removes these headers:

* Connection
* Keep-Alive
* Proxy-Authenticate
* Proxy-Authorization
* Proxy-Connection
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* X-Render-JS

### **Ignored by Chromium Engine (if triggered)**

When Chromium is triggered by the unblocker, it additionaly ignores the following headers:

* Content-Length
* Host
* Cookie2
* Keep-Alive
* Set-Cookie
* Origin
* Referer
* Any `Sec-Fetch-*` header

Chromium will also override the Accept header with the following:

```
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,
        image/avif,image/webp,image/apng,*/*;q=0.8
```

So you may expect this even you explicitly pass “application/json”.

[See Chromium documentation](https://github.com/chromium/chromium/blob/main/services/network/public/cpp/header_util.cc) for more information.


# Geo-location Targeting

You can specify a country, city or a US state, from which to access your target website.

### Country Targeting

You can enable country-level targeting by appending `_country-` to the password in your proxy credentials.

Example usage for US:

```
curl -k -v -x http://unblocker.iproyal.com:12323 --proxy-user user:password_country-us -L https://ipv4.icanhazip.com
```

The value of this parameter is a two-letter country code ([ISO 3166-1 alpha-2 format](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).

You can set more than one country at once.

### City Targeting

For city-level targeting, append the `_city-` key to the password in your proxy credentials. Its value should be the name of the city.

{% hint style="info" %}
NOTE: It's essential to first specify the country using `_country-` key when targeting a specific city, as multiple countries may have cities with the same name.
{% endhint %}

Example:

```
curl -k -v -x http://unblocker.iproyal.com:12323 --proxy-user user:password_country-us_city-chicago -L https://ipv4.icanhazip.com
```

### State Targeting

This feature allows state-level **targeting only in US**. To target a specific state, append the `_state-` key to the password in your proxy credentials. Its value should be the name of the state.

Example:

```
curl -k -v -x http://unblocker.iproyal.com:12323 --proxy-user user:password_country-us_state-iowa -L https://ipv4.icanhazip.com
```

\ <br>


# API

### URL

**`https://resi-api.iproyal.com/v1/web-unblocker`**

### Authorization

Authentication is managed via the **`Authorization`** header. To ensure secure access, all requests must include this header, followed by your API token, prefixed with the word "Bearer" and a space. The format should be:&#x20;

**`Authorization`**`:`**`Bearer <your_api_token>`**

Your API token is available on the dashboard's **Settings** page in the 'API' section. Here, you can also reset your token if necessary. Keep it secure and update your applications with the new token if you reset it.


# User

## Get User information <a href="#get-entry-nodes" id="get-entry-nodes"></a>

<mark style="color:green;">`GET`</mark> `/me`

Get information about the available requests on the user hash.

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/web-unblocker/me \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/web-unblocker/me';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```javascript
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/web-unblocker/me'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/web-unblocker/me';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/web-unblocker/me";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	url    = "https://resi-api.iproyal.com/v1/web-unblocker/me"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/web-unblocker/me";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example response:**

```json
{
    "available_requests": 1000,
    "web_unblocker_user_hash": "01H7YCG0R9GYY1YCPS2S4QA6WB"
}
```


# Orders

## Get Orders

<mark style="color:green;">`GET`</mark> `/orders`

**Query Parameters**

| Name      | Type    | Description                      |
| --------- | ------- | -------------------------------- |
| page      | Integer | Number of page                   |
| per\_page | Integer | Number of orders to get per page |

#### Example request:

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET "https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10" \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	url    = "https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### Example response:

```json
{
  "data": [
    {
      "id": 4,
      "note": null,
      "product_name": "Web Unblocker",
      "status": "confirmed",
      "amount": 9,
      "quantity": 10000,
      "created_at": "2025-06-26 10:01:50"
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 20,
    "total": 1
  }
}
```

## Create Order

<mark style="color:blue;">`POST`</mark> `/orders`

**Body Parameters:**

| Name         | Type    | Description                                                                                                        |
| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------ |
| quantity     | Integer | Required. Requests quantity                                                                                        |
| coupon\_code | String  | A discount code to apply to the order, if available.                                                               |
| card\_id     | Integer | Optional. If supplied - card will be billed for this order, if not - we will try to deduct the amount from balance |

**Example request:**

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST https://resi-api.iproyal.com/v1/web-unblocker/orders \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{"quantity": 10000}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders';

$data = ['quantity' => 10000];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders'

data = {'quantity': 10000}

headers = {
    'Authorization': 'Bearer ' + api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';

const data = JSON.stringify({quantity: 10000});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: '/v1/web-unblocker/orders',
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + apiToken,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://resi-api.iproyal.com/v1/web-unblocker/orders";

        String requestBody = """
            {
                "quantity": 10000
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "log"
    "net/http"
)

const (
    apiToken = "<your_api_token>"
    url    = "https://resi-api.iproyal.com/v1/web-unblocker/orders"
)

func main() {
    data := map[string]interface{}{
        "quantity": 10000,
    }

    jsonData, err := json.Marshal(data)
    if err != nil {
        log.Fatal("Error marshaling JSON:", err)
    }

    req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
    if err != nil {
        log.Fatal("Error creating request:", err)
    }

    req.Header.Set("X-Access-Token", apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal("Error making request:", err)
    }
    defer resp.Body.Close()

    fmt.Println("Status Code:", resp.StatusCode)

    responseBody, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatal("Error reading response body:", err)
    }

    var jsonResponse map[string]interface{}
    err = json.Unmarshal(responseBody, &jsonResponse)
    if err != nil {
        log.Fatal("Error unmarshaling JSON:", err)
    }

    fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://resi-api.iproyal.com/v1/web-unblocker/orders";

        var data = new
        {
            quantity = 10000,
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Response:**

```json
{
  "id": 4,
  "note": null,
  "product_name": "Web Unblocker",
  "status": "confirmed",
  "amount": 9,
  "quantity": 10000,
  "created_at": "2025-06-26 10:01:50"
}
```

## Calculate Pricing

<mark style="color:green;">`GET`</mark> `/orders/calculate-pricing`

**Query Parameters:**

| Name          | Type    | Description                                   |
| ------------- | ------- | --------------------------------------------- |
| `quantity`    | Integer | Required. The amount of the product to order. |
| `coupon_code` | String  | Optional. Discount code for the order.        |

#### Example request:

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/web-unblocker/orders/calculate-pricing \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{"quantity": 10000}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';

$quantity = 10000;

$url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders/calculate-pricing';

$url_with_params = $url . '?quantity=' . $quantity;

$options = [
    CURLOPT_URL => $url_with_params,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_HTTPGET => true
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders/calculate-pricing'

data = {'quantity': 10000}

headers = {
    'Authorization': 'Bearer ' + api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';

const data = JSON.stringify({quantity: 10000});

const options = {
  hostname: 'resi-api.iproyal.com',
  path: '/v1/web-unblocker/orders/calculate-pricing',
  method: 'GET',
  headers: {
    'Authorization': 'Bearer ' + apiToken,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class TestJava {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_api_token>";
        int quantity = 10000;
        String baseUrl = "https://resi-api.iproyal.com/v1/web-unblocker/orders/calculate-pricing";
        
        String url = baseUrl + "?quantity=" + quantity;
        
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer " + accessToken)
                .GET()
                .build();
                
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "fmt"
    "io"
    "log"
    "net/http"
    "net/url"
    "strconv"
)

const (
    apiToken = "<your_api_token>"
    baseURL  = "https://resi-api.iproyal.com/v1/web-unblocker/orders/calculate-pricing"
)

func main() {
    quantity := 10000
    
    u, err := url.Parse(baseURL)
    if err != nil {
        log.Fatal("Error parsing URL:", err)
    }
    
    q := u.Query()
    q.Set("quantity", strconv.Itoa(quantity))
    u.RawQuery = q.Encode()
    
    req, err := http.NewRequest(http.MethodGet, u.String(), nil)
    if err != nil {
        log.Fatal("Error creating request:", err)
    }
    
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal("Error making request:", err)
    }
    defer resp.Body.Close()
    
    fmt.Println("Status Code:", resp.StatusCode)
    
    responseBody, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatal("Error reading response body:", err)
    }
    
    fmt.Println("Response Body:", string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string baseUrl = "https://resi-api.iproyal.com/v1/web-unblocker/orders/calculate-pricing";
        int quantity = 10000;
        
        string url = $"{baseUrl}?quantity={quantity}";
        
        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + apiToken);
            
            HttpResponseMessage response = await client.GetAsync(url);
            
            Console.WriteLine("Status Code: " + (int)response.StatusCode);
            
            string responseText = await response.Content.ReadAsStringAsync();
            
            try
            {
                var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
                Console.WriteLine("Response: " + jsonResponse);
            }
            catch (JsonException)
            {
                Console.WriteLine("Response: " + responseText);
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### Example response:

```json
{
  "total": 10
}
```


# Access

## Generate Proxy

<mark style="color:green;">`GET`</mark> `/access/generate-proxy`

#### Example request:

{% tabs %}
{% tab title="cURL" %}

```
curl -X GET https://resi-api.iproyal.com/v1/web-unblocker/access/generate-proxy \
     -H "Authorization: Bearer <your_api_token>"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/web-unblocker/access/generate-proxy';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
    "Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/web-unblocker/access/generate-proxy'

headers = {
    'Authorization': f'Bearer {api_token}'
}

response = requests.get(url, headers=headers)

print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/web-unblocker/orders?page=1&per_page=10';

const options = {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiToken}`
  }
};

const req = https.request(url, options, (res) => {
  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('end', () => {
    console.log(data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_api_token>";
        String urlString = "https://resi-api.iproyal.com/v1/web-unblocker/access/generate-proxy";

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + apiToken);

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println(content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"io"
	"log"
	"net/http"
	"fmt"
)

const (
	apiToken = "<your_api_token>"
	url    = "https://resi-api.iproyal.com/v1/web-unblocker/access/generate-proxy"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiToken)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	fmt.Println(string(responseBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_api_token>";
        string url = "https://resi-api.iproyal.com/v1/web-unblocker/access/generate-proxy";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");

            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseText);
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### Example response:

```json
{
  "proxy_string": "unblocker.iproyal.com:12323:enc321316127:h12BPqawfq1BBrk"
}
```


# 概述

欢迎来到IPRoyal文档。

这些文档提供了您开始使用我们的服务所需的一切。如果您想分享反馈，请通过<support@iproyal.com>或通过我们[网站](https://iproyal.cn/)上的聊天入口联系我们。

### 有用的链接&#x20;

我们的常见问题解答[（FAQ）页面](https://faq.iproyal.com/zh-CN/)提供了关于我们的服务、计费、账号设置等最常见问题的答案。

我们的[博客](https://iproyal.cn/blog/)提供与代理相关的新闻、产品更新、集成教程、网络抓取指南、代码示例和专家见解等内容。

我们还提供了几款免费的工具，使您的代理使用更方便。其中包括[浏览器扩展](https://dashboard.iproyal.com/proxy-managers)、基于Windows的[代理测试器](https://dashboard.iproyal.com/proxy-tester)，以及一个[IP查询](https://iproyal.cn/ip-lookup/)页面。


# 皇家住宅代理

IPRoyal目前在超过195个国家提供超过6400万个住宅代理。这个数字还在不断增长，所以我们的客户始终可以依靠新的代理来完成各种任务。

### IPRoyal代理的主要优势 <a href="#key-advantages-of-iproyal-residential-proxies" id="key-advantages-of-iproyal-residential-proxies"></a>

* **极具竞争力的定价**

我们提供业内最具性价比的产品，拥有高可靠性和[出色的客户满意度](https://www.trustpilot.com/review/iproyal.com)。

* **独家代理池**

我们拥有超过 195 个国家/地区的 6400 多万个住宅 IP 地址，保证高效的网页抓取、SEO 研究、数据聚合、社交媒体管理等服务。

* **精确的定位**

从世界任何地方（国家，州或城市）选择代理，一键即可设置，无需额外费用。

* **支持现收现付**

没有合约，没有浪费的带宽，也没有月度限制——您只需要为您需要的服务付费。

* **流量用不过期**

您所购买的住宅代理流量将永远是您的。它永远不会过期，所以你可以随时使用它。

* **24/7全时段支持**

平均响应时间仅为58秒，我们的资深专家团队全时段待命，随时准备帮助您设置并充分利用代理。

### IPRoyal代理的技术特点 <a href="#technical-features-of-iproyal-residential-proxies" id="technical-features-of-iproyal-residential-proxies"></a>

* **高级会话控制**

为每个请求获取一个新的IP，或者使用长达7天的粘性会话。

* **不限同时会话数量**

没有任何限制，您可以使用尽可能多的连接，并根据需要扩展您的操作。

* **双重认证**

用户名/密码和IP白名单可保证与爬虫（scraper）、机器人（bot）及其他工具的最高兼容性。

* **支持HTTP(S)和SOCKS5**

选择适合自己需求的协议，在任何应用场景下都能获得最佳效果。

* **支持API访问**

将我们的住宅代理集成到您的基础设施中，例如管理子用户等等。


# 仪表板

在本节中，我们将提供关于导航和使用仪表板功能的简明而全面的指导。本节包括多个分块内容，每块内容侧重于仪表板的不同方面，无论是设置、管理代理，还是理解指标和调整配置，无论您是新手还是经验丰富的用户，都可以通过仪表板找到简明易懂的指导来优化您对我们服务的使用。


# 下订单

欢迎阅读我们网站代理订购步骤指南。在本节中，我们将为您提供详细的屏幕截图和清晰的说明，以确保顺利、直接的订购流程。我们的目标是让您的体验尽可能直观、高效。让我们一起完成整个流程，向您展示如何购买您的第一份流量！

***

要开始购买住宅代理，请导航至侧边栏菜单上的“住宅代理”部分 (<mark style="color:orange;">1</mark>)。此操作将引导您前往住宅代理仪表板。

进入仪表板后，点击“+ 创建新订单”按钮 (<mark style="color:orange;">2</mark>)。这将启动流程，以便您开始使用所需的规格创建代理订单。

<figure><img src="https://1496375911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FocBfddKBo5nf8WdKl9vN%2Fuploads%2FZU7f9J6Di3B6FM9SStYs%2Fa1.webp?alt=media&amp;token=5c77dd5a-6c53-41c6-9a28-5439416e0bc5" alt=""><figcaption></figcaption></figure>

***

首先，我们建议您查看折扣表 (<mark style="color:orange;">1</mark>)，其中包含有关定价和捆绑折扣的详细信息，这些折扣可以为您的购买提供额外价值。值得花点时间查看更大批量购买的折扣。

接下来，您需要指定代理所需的流量。找到“流量数额”字段 (<mark style="color:orange;">2</mark>)，然后输入适合您需求的千兆字节（GB）数额。

设置金额后，选择您喜欢的付款方式 (<mark style="color:orange;">3</mark>)。您可以创建一个订阅，每月自动将购买的金额添加到您的帐户中，也可以选择按需付费。

继续点击面板中的“立即购买”按钮 (<mark style="color:orange;">4</mark>) 完成订单。这将带您进入付款和确认流程。

<figure><img src="https://1496375911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FocBfddKBo5nf8WdKl9vN%2Fuploads%2FZXDErdnDxZn3lc1r2YWn%2Fa2.webp?alt=media&amp;token=ecb4ac42-ad80-4f96-baea-842091110030" alt=""><figcaption></figcaption></figure>

***

到这里就快完成了哦！最后一步是完成订单付款。

如“完成订单”页面所示，您可以从多种付款方式中进行选择，以方便您。无论您喜欢使用信用卡、加密货币、PayPal 还是 Google Pay，只需选择您喜欢的付款方式并填写所需信息 (<mark style="color:orange;">1</mark>)。

输入付款信息后，请查看订单摘要以确保一切正确。如果您有优惠券代码，请输入并点击“应用”(<mark style="color:orange;">2</mark>)。

完成所有步骤后，点击“完成订单”按钮 (<mark style="color:orange;">3</mark>) 完成购买。

请放心，所有交易都是安全的，您可以选择保存您的付款信息以备将来购买。

<figure><img src="https://1496375911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FocBfddKBo5nf8WdKl9vN%2Fuploads%2FSro5ts7yl1JUKphXXAUV%2Fa3.webp?alt=media&amp;token=deb625a7-d33f-492c-8144-3f811f94d0cd" alt=""><figcaption></figcaption></figure>

***

恭喜！您的住宅代理订单已成功处理。您将看到一条确认消息。

此页面还将显示有关您订单的信息 (<mark style="color:orange;">1</mark>)。

您还可以使用“备注”面板向您的订单添加任何备注，以供将来参考 (<mark style="color:orange;">2</mark>)。

<figure><img src="https://1496375911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FocBfddKBo5nf8WdKl9vN%2Fuploads%2FhlK8Frum7fsRTIz6zOo9%2Fa4.webp?alt=media&amp;token=cf2f99b7-2848-4260-84e5-9c03d03b1711" alt=""><figcaption></figcaption></figure>


# 统计数据

在皇家住宅代理仪表板的“统计”模块中，您可以监控和分析您的代理使用情况。这个交互式图表，由图像中橙色虚线边框勾勒，提供了您的代理流量的可视化表示，您可以通过选择特定时间段进一步调整。这可以帮助您了解高峰使用时间或分析趋势。此外，您还可以选择按特定网站过滤数据，并选择度量单位（如 MB 或 GB）。

为了进行更详细的审查或保存记录，您可以通过点击“下载报告”按钮下载报告文件。此工具对于有效管理您的代理并确保您的使用符合您的需求和期望而言至关重要。

<figure><img src="https://1496375911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FocBfddKBo5nf8WdKl9vN%2Fuploads%2FGxpRWIFmiTUIsv3EfkAK%2FA1.png?alt=media&amp;token=24548f23-98bd-4095-a51f-07821789d09b" alt=""><figcaption></figcaption></figure>




---

[Next Page](https://docs.iproyal.com/llms-full.txt/1)

