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

# Create or update an IP geolocation database configuration

Authentication: required

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`

## 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"
    }
  }
)
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "acknowledged": false
}
```

