> ## Documentation Index
> Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Region and IP Resolution

> Customize where your traffic physically connects to ngrok's network, to meet data residency needs.

Region & IP resolution lets you restrict (or "pin") which ngrok regions will handle traffic for a domain.

Configure your [domain](/gateway/domains) to resolve to the IP addresses of one (or several) of ngrok's globally distributed physical points of presence (PoPs).

This feature is designed for customers with data residency and compliance requirements who need to ensure traffic is processed only within specific geographic boundaries.

<Info>
  The same configuration will soon support [dedicated IP addresses](/gateway/dedicated-ips/) \[preview feature], in addition to Points of Presence.
</Info>

## How it works

1. Choose which ngrok points of presence your domain can use.
2. All requests to [endpoints](/gateway/endpoints) on that domain will *only* be routed through your chosen PoPs.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/ngrok/guides/img/docs/region-pinning-how-it-works-diagram.png" alt="Flowchart showing users in US, EU, and Asia all routing through a domain to the nearest allowed ngrok Point of Presence from a pinned set of regions" width={1371} height={1901} style={{height: "auto", width: "50%"}} />

## Configuring region resolution

To configure (or "pin") which regions will resolve your traffic: update your domain resource with your preferred set of target regions.
You can do this through the API or the dashboard, both of which are described below.

### Using the API

The `resolves_to` property tells your domain how to resolve requests.
You can specify a list of ngrok physical PoPs (like "Frankfurt" or "California"), [dedicated IPs](/gateway/dedicated-ips/), or both.

The following sections describe how to create, update, and un-pin a domain.

#### Create a pinned domain

You can create a new domain and customize region "pinning" (Region Resolution) in a single step.

Use the [`POST /reserved_domains` endpoint](/api-reference/reserveddomains/create) and include the optional `resolves_to` property.

```json theme={null}
curl --request POST \
 --url https://api.ngrok.com/reserved_domains \
 --header "Authorization: Bearer <token>" \
 --header "Content-Type: application/json" \
 --header "ngrok-version: 2" \
 --data '{
    "domain": "api.example.com",
    "description": "Pinned to US and Europe for compliance reasons",
    "certificate_management_policy": {
      "authority": "letsencrypt",
      "private_key_type": "ecdsa"
    },
    "resolves_to": [
      { "value": "us-cal-1"},  
      { "value": "eu"}
    ]
  }'
```

#### Update an existing domain

You can add Region Resolution settings to an existing domain. You can also modify the existing list, for example, by adding a third point of presence (example below). No DNS changes are required.

Use `PATCH` to [update the list of pinned regions](/api-reference/reserveddomains/update).

```json theme={null}
curl --request PATCH \
 --url https://api.ngrok.com/reserved_domains/{domain_id} \
 --header "Authorization: Bearer <token>" \
 --header "Content-Type: application/json" \
 --header "ngrok-version: 2" \
 --data '{
    "domain": "api.example.com",
    "description": "Pinned to US and Europe for compliance reasons",
    "certificate_management_policy": {
      "authority": "letsencrypt",
      "private_key_type": "ecdsa"
    },
    "resolves_to": [
      { "value": "us-cal-1"},  
      { "value": "eu"},
      { "value": "jp"}
    ]
  }'
```

#### Un-pin a domain

You can "un-pin" a domain. Removing Regional Resolution settings restores the domain to its *default* IP resolution behavior: [global load balancing](https://ngrok.com/docs/gateway/global-load-balancer) across *all* ngrok points of presence.

Use `PATCH` to [remove the list of pinned regions](/api-reference/reserveddomains/update), by setting the `resolves_to` property to an empty list.

```json theme={null}
# Revert to Global Routing
curl --request PATCH \
 --url https://api.ngrok.com/reserved_domains/{id}  \
 --header "Authorization: Bearer <token>" \
 --header "Content-Type: application/json" \
 --header "ngrok-version: 2" \
 --data '{
   "resolves_to": [] 
 }'  
```

#### API error handling

If a request contains invalid syntax or an invalid region code, the API request fails.
The request returns **HTTP 400 Bad Request** with a structured error body, as shown in the example below:

```json theme={null}
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
 "status_code": 400,
 "error_code": "invalid_region_target",
 "msg": "The region you specified, 'banana' is invalid. use one of the following acceptable values: us,us-cal-1,eu,au,ap,jp,sa,in",
 "details": {}
}
```

### Using the dashboard

You can also make these changes through the [ngrok dashboard](https://dashboard.ngrok.com/domains).

To configure your Region Resolution targets:

1. View [your existing domains in the dashboard](https://dashboard.ngrok.com/domains), or create a new one.
2. Click the domain you wish to modify.
3. Enter a comma-separated list of PoPs, region aliases that cover multiple PoPs, or both.

## Dedicated IPs (preview)

<Warning>
  This feature is in Early Access and under active development.
  Behavior, supported fields, and limits may change before General Availability (GA).
  This guide provides forward-looking context for evaluation and feedback.

  [Visit your dashboard](https://dashboard.ngrok.com/developer-preview) to sign up for Early Access, or to send your feedback via the "Let us know" link.
</Warning>

Dedicated IPs let you configure a domain to receive traffic on static IP addresses that are exclusively dedicated to your account (instead of ngrok's shared multi-tenant IPs).
When a domain uses dedicated IPs, you can create matching [endpoints](/gateway/endpoints/) on any inbound port.
Today, you are [restricted](/faq/#can-i-choose-a-different-port-to-receive-traffic-on-my-ngrok-domains) to ports 80 and 443.

### How to use dedicated IPs

Dedicated IPs and Regional Resolution ("region pinning") share the same `resolves_to` field on the domain.
See the [Dedicated IPs](/gateway/dedicated-ips/) documentation for configuration examples, use cases, and pricing:

* Region pinning: `resolves_to: [{ "value": "<region-shortcode>" }]`
* Dedicated IPs: `resolves_to: [{ "value": "<ip-address>" }]`

You can include both, as shown in the example below.

```json theme={null}
{
  "resolves_to": [
    { "value": "us-cal-1" },
    { "value": "8.8.8.8:1234" }
  ]
}

```

## Frequently asked questions

### Does this affect TCP endpoints?

Slightly different answer for each sub-feature:

* Region pinning: no, since this feature applies only to matching HTTP/HTTPS endpoints. TCP uses [reserved addresses](/api-reference/reservedaddrs), which already include a region.
* Dedicated IPs: yes, dedicated IPs are available for any [ngrok-supported protocol](/gateway/protocols), including HTTP/S, TCP, and TLS.

### What happens if the `resolves_to` field isn't added when creating a domain?

Nothing. That is, it uses the standard domain behavior: global load balancing, which automatically routes traffic to the best point of presence for that end-user.
This is the baseline behavior for domains, and is used by the vast majority of customers.

### Is it necessary to specify every region manually?

No, ngrok provides regional aliases as a shortcut to select all PoPs in a given geographic area.

Aliases are in Preview (see list below). Initial regions will include `european-union` and `united-states`, depending on [customer feedback (click "Let us know")](https://dashboard.ngrok.com/developer-preview).

## Points of presence reference

The `resolves_to` parameter uses the following PoP names:

| **Geographical region** | **Location**                   | **Code (to use in API)** |
| ----------------------- | ------------------------------ | ------------------------ |
| **United States**       | Ohio                           | `us`                     |
|                         | California                     | `us-cal-1`               |
| **Europe**              | Frankfurt                      | `eu`                     |
| **Asia/Pacific**        | Singapore                      | `ap`                     |
|                         | Sydney                         | `au`                     |
|                         | Mumbai                         | `in`                     |
|                         | Tokyo                          | `jp`                     |
| **South America**       | São Paulo                      | `sa`                     |
| **Regional Aliases**    | Global                         | `global`                 |
|                         | Europe *\[coming soon]*        | `european-union`         |
|                         | United States *\[coming soon]* | `united-states`          |

## Limits and pricing

<Warning>
  This feature is temporarily free to use on the Pay-as-you-Go plan.

  Billing & metering will be enabled soon, so if you use this feature, you may start seeing charges at any time. You can monitor your usage [in the ngrok dashboard](https://dashboard.ngrok.com/billing).

  We'll update these docs when this changes.
</Warning>

This feature is only available on the Pay-as-you-Go plan. [Learn more about ngrok plans](https://ngrok.com/pricing).

You can have up to 100 region-pinned domains. This is the same as our total domain limit, so most customers should be fine. Feel free to reach out via support if you need more. [Learn more about limits](https://ngrok.com/docs/pricing-limits)

Region pinning will cost **\$0.02 per active endpoint hour** (in addition to the standard endpoint rate), per endpoint on a "pinned" domain. An endpoint is considered active if it receives any traffic in a given hour. If your endpoints with pinning enabled don't receive any traffic, you won't incur charges for this feature. [Learn more about pricing](https://ngrok.com/pricing).

For more details, see the [Region & IP Resolution](/gateway/region-pinning) documentation.
