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

# Create or update an IP geolocation database configuration

Availability: 8.15+

## Paths

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

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

#### Path Parameters

- `id` (string Id)
  The database configuration identifier.

## Description



## Required authorization

* Cluster privileges: `manage`

## Query String Parameters

- `master_timeout` (string Duration · default: 30s)
  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 Duration · default: 30s)
  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 Name) — required
  The provider-assigned name of the IP geolocation database to download.
- `maxmind` ({} Maxmind) — optional
  - `account_id` (string Id) — required
- `ipinfo` (Ipinfo) — 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"
    }
  }
)
```

