---
type: api
title: Create or update the inference region policy
description: The region policy restricts inference to a set of allowed geographic areas or cloud service provider regions.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-inference-put-region-policy
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-inference-put-region-policy
products:
  - Elasticsearch
---

# Create or update the inference region policy

Availability: 9.5+

## Paths

- `PUT` `/_inference/_region_policy`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#bearerauth)

## Description

The region policy restricts inference to a set of allowed geographic areas or cloud service provider regions.

## Required authorization

* Cluster privileges: `manage_inference`

## Query String Parameters

- `force` (boolean · default: false)
  If `true`, the region policy is applied even if it would deny access to inference endpoints that are currently in use by ingest pipeline or indices.

## Request Body

`application/json`

- `region_policy` ({} RegionPolicy) — required
  The region policy configuration.
  - `allowed_geos` ([] string) — optional
    The list of allowed geographic areas.
Mutually exclusive with `allowed_regions`.
  - `allowed_regions` ([] CspRegion) — optional
    The list of allowed cloud service provider regions.
Mutually exclusive with `allowed_geos`.
    - `csp` (string) — required
      The cloud service provider, for example `aws`, `gcp`, or `azure`.
    - `region` (string) — required
      The region of the cloud service provider, for example `us-east-1`.

## Response

`application/json`

- `region_policy` ({} RegionPolicy)
  - `allowed_geos` ([] string)
    The list of allowed geographic areas.
Mutually exclusive with `allowed_regions`.
  - `allowed_regions` ([] CspRegion)
    The list of allowed cloud service provider regions.
Mutually exclusive with `allowed_geos`.
    - `csp` (string)
      The cloud service provider, for example `aws`, `gcp`, or `azure`.
    - `region` (string)
      The region of the cloud service provider, for example `us-east-1`.
- `created_at` (DateTime)
  The date and time the region policy was created.
- `created_by` (string)
  The user who created the region policy.
- `updated_at` (DateTime)
  The date and time the region policy was last updated.
- `updated_by` (string)
  The user who last updated the region policy.
## Code Examples

#### Console

```console
PUT _inference/_region_policy
{
    "region_policy": {
        "allowed_regions": [
            { "csp": "aws", "region": "us-east-1" },
            { "csp": "aws", "region": "eu-west-1" }
        ]
    }
}
```

#### JavaScript

```javascript
const response = await client.inference.putRegionPolicy({
  region_policy: {
    allowed_regions: [
      {
        csp: "aws",
        region: "us-east-1",
      },
      {
        csp: "aws",
        region: "eu-west-1",
      },
    ],
  },
});
```

#### Python

```python
resp = client.inference.put_region_policy(
    region_policy={
        "allowed_regions": [
            {
                "csp": "aws",
                "region": "us-east-1"
            },
            {
                "csp": "aws",
                "region": "eu-west-1"
            }
        ]
    },
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_inference/_region_policy" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "region_policy": {
      "allowed_regions": [
        {
          "csp": "aws",
          "region": "us-east-1"
        },
        {
          "csp": "aws",
          "region": "eu-west-1"
        }
      ]
    }
  }'
```

#### Java

```java
client.inference().putRegionPolicy(p -> p
    .regionPolicy(r -> r
        .allowedRegions(List.of(CspRegion.of(c -> c
                .csp("aws")
                .region("us-east-1")
            ),CspRegion.of(c -> c
                .csp("aws")
                .region("eu-west-1")
            )))
    )
);
```

#### PHP

```php
$resp = $client->inference()->putRegionPolicy([
    "body" => [
        "region_policy" => [
            "allowed_regions" => array(
                [
                    "csp" => "aws",
                    "region" => "us-east-1",
                ],
                [
                    "csp" => "aws",
                    "region" => "eu-west-1",
                ],
            ),
        ],
    ],
]);
```

#### Ruby

```ruby
response = client.inference.put_region_policy(
  body: {
    "region_policy": {
      "allowed_regions": [
        {
          "csp": "aws",
          "region": "us-east-1"
        },
        {
          "csp": "aws",
          "region": "eu-west-1"
        }
      ]
    }
  }
)
```

## Response Examples

#### A region policy allowing specific cloud service provider regions

A successful response when creating a region policy that allows specific cloud service provider regions.

```json
{
  "region_policy": {
    "allowed_regions": [
      { "csp": "aws", "region": "us-east-1" },
      { "csp": "aws", "region": "eu-west-1" }
    ]
  },
  "created_at": "2026-07-13T12:00:00.000Z",
  "created_by": "inference_user"
}
```

