---
type: api
title: Create or update an IP geolocation database configuration
description: ## Required authorization
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-ingest-put-ip-location-database
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-ingest-put-ip-location-database
products:
  - Elasticsearch
---

# Create or update an IP geolocation database configuration

Availability: Generally available since 8.15

## Paths

- `PUT` `/_ingest/ip_location/database/{id}`

#### Path parameters

- `id` (string) — required
  The database configuration identifier.

## Required authorization

- Cluster privileges: `manage`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `master_timeout` (string · default: 30s) — optional
  The period to wait for a connection to the master node.
If no response is received before the timeout expires, the request fails and returns an error.
A value of `-1` indicates that the request should never time out.
- `timeout` (string · default: 30s) — optional
  The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata.
If no response is received before the timeout expires, the cluster metadata update still applies but the response indicates that it was not completely acknowledged.
A value of `-1` indicates that the request should never time out.

## Request body

`application/json`

- `name` (string) — required
  The provider-assigned name of the IP geolocation database to download.
- `maxmind` (object) — optional
  - `account_id` (string) — required
- `ipinfo` (object) — optional

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code examples

#### Console

```console
PUT _ingest/ip_location/database/my-database-1
{
  "name": "GeoIP2-Domain",
  "maxmind": {
    "account_id": "1234567"
  }
}
```

#### JavaScript

```javascript
const response = await client.ingest.putIpLocationDatabase({
  id: "my-database-1",
  configuration: {
    name: "GeoIP2-Domain",
    maxmind: {
      account_id: "1234567",
    },
  },
});
```

#### Python

```python
resp = client.ingest.put_ip_location_database(
    id="my-database-1",
    configuration={
        "name": "GeoIP2-Domain",
        "maxmind": {
            "account_id": "1234567"
        }
    },
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-1" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "GeoIP2-Domain",
    "maxmind": {
      "account_id": "1234567"
    }
  }'
```

#### Java

```java
client.ingest().putIpLocationDatabase(p -> p
    .id("my-database-1")
    .configuration(c -> c
        .maxmind(m -> m
            .accountId("1234567")
        )
        .name("GeoIP2-Domain")
    )
);
```

#### C#

```c#
var response = await client.Ingest
    .PutIpLocationDatabaseAsync(id: "my-database-1", d1 => d1
        .Configuration(d2 => d2
            .Name("GeoIP2-Domain")
            .Maxmind(d3 => d3
                .AccountId("1234567")
            )
        )
    );
```

#### PHP

```php
$resp = $client->ingest()->putIpLocationDatabase([
    "id" => "my-database-1",
    "body" => [
        "name" => "GeoIP2-Domain",
        "maxmind" => [
            "account_id" => "1234567",
        ],
    ],
]);
```

#### Ruby

```ruby
response = client.ingest.put_ip_location_database(
  id: "my-database-1",
  body: {
    "name": "GeoIP2-Domain",
    "maxmind": {
      "account_id": "1234567"
    }
  }
)
```

