Upload MMDB File
Overview
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
filemust be a valid MMDB filefilemust not be emptyfileNameis optional (uses original filename if not provided)- MMDB file format: MaxMind GeoIP2 database format (.mmdb)
Response
Success Response (200 OK)
{
"success": true,
"deploymentResult": {
"success": true,
"message": "Deployment completed successfully",
"environmentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployed successfully"
}
]
}
}
Error Response (400 Bad Request)
{
"error": "bad_request",
"error_description": "File can not be empty!"
}
Error Response (401 Unauthorized)
{
"error": "unauthorized_client",
"error_description": "User does not have privilege to access admin settings!"
}
cURL Example
Example 1: Upload MMDB File
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
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 - Enable geolocation functionality
- Disable Geolocation - Disable geolocation functionality