Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ip2geo.dev/llms.txt

Use this file to discover all available pages before exploring further.

Our API is a alternative way to access our convertion services directly through HTTP requests. Its recommended to use the SDK unless your environment does not support npm packages. We have simplified the API to make it easy to use with clear endpoints and consistent request/response structures.

Authentication

All API requests require the x-api-key header. You can use either key type:
  • Secret key (i2g_sk_…) — for server-side requests. Generated from the Secret Keys section in your dashboard.
  • Public key (i2g_pk_…) — for client-side (browser) requests. Generated from the Websites section. Must include a valid Origin header matching the registered domain.
# Server-side with secret key
curl --request GET \
    --url https://api.ip2geo.dev/convert?ip=8.8.8.8 \
    --header 'x-api-key: i2g_sk_your_secret_key'

# Client-side with public key (browser sends Origin automatically)
fetch('https://api.ip2geo.dev/convert?ip=8.8.8.8', {
    headers: { 'x-api-key': 'i2g_pk_your_public_key' }
})

When to Use the API Instead of the SDK?

  • Environment Limitations: If your environment doesn’t support npm (e.g., a non-JavaScript runtime).
  • Direct Control: If you need direct control over HTTP requests for specific use cases that the SDK doesn’t cover.
  • Lightweight Needs: If you want to avoid adding an additional dependency to your project.