Submit Corrections via API

This section provides detailed instructions on how to submit data corrections using our API. For submitting corrections via the web form, please visit the Data Corrections page.

How to Submit Corrections via API

To begin, you must sign up for an account to obtain an API key. If you have already signed up, you can use your existing API key.

With your API key, you can submit corrections to the following endpoint:

https://ipapi.is/app/api-corrections

Request Format

The request should be a POST request with the following JSON structure:

{
  "apiKey": "your_api_key",
  "type": "geofeed or general",
  "data": {
    // For geofeed type
    "geofeedUrl": "https://example.com/geofeed.csv",
    "geofeedData": ["prefix,country_code", ...],
    // For general type
    "general": {
      "dataPoint": "location.country",
      "corrections": [
        ["1.2.3.4", "Germany"],
        ["5.6.7.8", "France"]
      ]
    }
  }
}

Examples

Here are some examples of how to structure your correction requests:

Geofeed Example using geofeedUrl
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{
    "apiKey": "your_api_key",
    "type": "geofeed",
    "data": {
      "geofeedUrl": "https://example.com/geofeed.csv"
    }
  }' \
  https://ipapi.is/app/api-corrections
Geofeed Example using geofeedData
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{
    "apiKey": "your_api_key",
    "type": "geofeed",
    "data": {
      "geofeedData": [
        "185.68.156.0/22,DE,DE-BY,Herzogenaurach,91074",
        "5.182.88.0/22,DE,DE-BY,Herzogenaurach,91074",
        "45.66.28.0/22,DE,DE-BY,Herzogenaurach,91074",
        "45.84.24.0/22,DE,DE-BY,Herzogenaurach,91074",
        "213.170.216.0/22,DE,DE-BY,Herzogenaurach,91074"
      ]
    }
  }' \
  https://ipapi.is/app/api-corrections
General Example

This example demonstrates how to submit a general correction for the "location.city" data point. The corrections are provided as an array of arrays, where each sub-array contains an IP address or network prefix and the corresponding correction.

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{
    "apiKey": "your_api_key",
    "type": "general",
    "data": {
      "general": {
        "dataPoint": "location.city",
        "corrections": [
          ["192.168.1.1", "New York"],
          ["192.168.1.2", "Los Angeles"]
        ]
      }
    }
  }' \
  https://ipapi.is/app/api-corrections

So the above correction will be applied to the following IP addresses:

  • 192.168.1.1 - The corrected location will be New York
  • 192.168.1.2 - The corrected location will be Los Angeles
General Example - Correcting VPN IP addresses

This example demonstrates how to submit a general correction for the "is_vpn" data point. The corrections are provided as an array of arrays, where each sub-array contains an IP address or network prefix and the corresponding correction.

The following IP addresses will be corrected:

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{
    "apiKey": "your_api_key",
    "type": "general",
    "data": {
      "general": {
        "dataPoint": "vpn",
        "corrections": [
          ["45.132.224.101", {
            "is_vpn": true,
            "last_seen": 1736715005210,
            "type": "exit_node",
            "service": "ExpressVPN"
          }],
          ["185.233.133.8", {
            "is_vpn": true,
            "last_seen": 1737975537293,
            "type": "vpn_server",
            "service": "ExpressVPN"
          }]
        ]
      }
    }
  }' \
  https://ipapi.is/app/api-corrections

Response

A successful request will return a JSON response with a message indicating the correction was received:

{
  "message": "Correction received"
}

Error Handling

If there is an error, the response will include an error message. Common errors include:

  • Invalid or missing API key
  • Invalid correction type
  • Invalid data format