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

# Upload MMDB File

> Uploads a MaxMind GeoIP2 database (MMDB) file for geolocation functionality. The MMDB file is used to determine the geographic location of API clients based on their IP addresses.

## Endpoint

```
PUT /apiops/settings/geolocation/mmdb
```

## Authentication

Requires a Personal API Access Token with admin privileges.

### Header

```
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value               | Required |
| ------------- | ------------------- | -------- |
| Authorization | Bearer {token}      | Yes      |
| Content-Type  | multipart/form-data | Yes      |

### Path Parameters

None.

### Form Data

| Parameter | Type   | Required | Description                                                               |
| --------- | ------ | -------- | ------------------------------------------------------------------------- |
| file      | file   | Yes      | MMDB file (MaxMind GeoIP2 database file)                                  |
| fileName  | string | No       | File name (if not provided, uses original filename or "geolocation.mmdb") |

### Notes

* `file` must be a valid MMDB file
* `file` must not be empty
* `fileName` is optional (uses original filename if not provided)
* MMDB file format: MaxMind GeoIP2 database format (.mmdb)

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true,
  "deploymentResult": {
    "success": true,
    "message": "Deployment completed successfully",
    "environmentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployed successfully"
      }
    ]
  }
}
```

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "File can not be empty!"
}
```

### Error Response (401 Unauthorized)

```json theme={null}
{
  "error": "unauthorized_client",
  "error_description": "User does not have privilege to access admin settings!"
}
```

## cURL Example

### Example 1: Upload MMDB File

```bash theme={null}
curl -X PUT \
  "https://demo.apinizer.com/apiops/settings/geolocation/mmdb" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@GeoLite2-City.mmdb" \
  -F "fileName=GeoLite2-City.mmdb"
```

### Example 2: Upload MMDB File without File Name

```bash theme={null}
curl -X PUT \
  "https://demo.apinizer.com/apiops/settings/geolocation/mmdb" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@GeoLite2-City.mmdb"
```

## Notes and Warnings

* **Admin Only**:
  * This endpoint requires admin privileges
  * Only sysAdmin users can upload MMDB files
* **MMDB File Format**:
  * File must be in MaxMind GeoIP2 database format (.mmdb)
  * Common files: GeoLite2-City.mmdb, GeoLite2-Country.mmdb
* **File Size**:
  * Large MMDB files may take time to upload
  * Ensure sufficient storage space
* **Automatic Deployment**:
  * MMDB file is automatically deployed to all environments
  * Deployment results are returned in the response
* **File Replacement**:
  * Uploading a new file replaces the existing one
  * Previous file is overwritten

## Related Documentation

* [Enable Geolocation](/api-reference/geolocation/enable-geolocation) - Enable geolocation functionality
* [Disable Geolocation](/api-reference/geolocation/disable-geolocation) - Disable geolocation functionality
