# IP Demographics API

> IP Demographics combines IP geolocation with Census demographic data to provide demographic information for any IP address. Get location, income, education, and housing data based on the IP's geographic location. Demographics cover US ZIP codes; other locations return the location with demographics set to null.

**Endpoint:** `GET https://api.apiverve.com/v1/ipdemographics`  
**Category:** Data Lookup  
**Cost:** 10 credits per call  
**Canonical page:** https://apiverve.com/marketplace/ipdemographics

## Overview

IP Demographics first geolocates the IP address to a ZIP code using MaxMind GeoIP, then enriches with demographic data from the US Census American Community Survey. This provides demographic insights for personalization and analytics.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/ipdemographics?ip=173.172.81.20" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `ip` | string | Yes | IPv4 or IPv6 address. ip |

## Response fields

- `ip` — string · The IP address the demographics were resolved for
- `location` — object · Where the IP address resolves to
  - `location.zip` — string · ZIP code the IP address resolves to
  - `location.city` — string · City the IP address resolves to
  - `location.state` — string · State the IP address resolves to
  - `location.stateCode` — string · Two-letter state code
  - `location.country` — string · Country the IP address resolves to
  - `location.countryCode` — string · Two-letter country code
  - `location.latitude` — number · Latitude coordinate · (premium)
  - `location.longitude` — number · Longitude coordinate · (premium)
  - `location.timezone` — string · IANA timezone of the resolved location
- `demographics` — object · Census figures for the ZIP code the IP resolves to; null outside the US
  - `demographics.population` — number · Resident population of the ZIP code
  - `demographics.medianAge` — number · Median age of residents in the ZIP code
  - `demographics.medianHouseholdIncome` — number · Median annual household income in the ZIP code
  - `demographics.perCapitaIncome` — number · Per capita income
  - `demographics.medianHomeValue` — number · Median home value
  - `demographics.collegeEducatedPct` — number · College educated percentage
  - `demographics.unemploymentRate` — number · Percentage of the labour force unemployed
  - `demographics.homeOwnershipRate` — number · Home ownership rate · (premium)
- `acsYear` — number · Year of the American Community Survey release the figures come from
- `formatted` — object · Human-readable formatted currency values · (premium)
  - `formatted.medianHouseholdIncome` — string · Median household income formatted as currency · (premium)
  - `formatted.perCapitaIncome` — string · Per capita income formatted as currency · (premium)
  - `formatted.medianHomeValue` — string · Median home value formatted as currency · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "ip": "8.8.8.8",
    "location": {
      "zip": "94043",
      "city": "Mountain View",
      "state": "California",
      "stateCode": "CA",
      "country": "United States",
      "countryCode": "US",
      "latitude": 37.4056,
      "longitude": -122.0775,
      "timezone": "America/Los_Angeles"
    },
    "demographics": {
      "population": 81234,
      "medianAge": 34.5,
      "medianHouseholdIncome": 142567,
      "perCapitaIncome": 78234,
      "medianHomeValue": 1875000,
      "collegeEducatedPct": 68.3,
      "unemploymentRate": 3.2,
      "homeOwnershipRate": 45.6
    },
    "acsYear": 2022,
    "formatted": {
      "medianHouseholdIncome": "$142,567",
      "perCapitaIncome": "$78,234",
      "medianHomeValue": "$1,875,000"
    }
  }
}
```

## Use cases

- **Personalization** — Personalize content based on visitor demographics
- **Analytics** — Enrich analytics with demographic data for visitor insights
- **Ad Targeting** — Improve ad targeting with demographic information
- **Fraud Detection** — Factor demographics into risk scoring models

## SDKs

- **npm** — `npm install @apiverve/ipdemographics` (https://www.npmjs.com/package/@apiverve/ipdemographics)
- **PyPI** — `pip install apiverve-ipdemographics` (https://pypi.org/project/apiverve-ipdemographics/)
- **NuGet** — `dotnet add package APIVerve.API.IPDemographics` (https://www.nuget.org/packages/APIVerve.API.IPDemographics)
- **Source** — https://github.com/apiverve/ipdemographics-api

## More

- Full reference: https://docs.apiverve.com/ref/ipdemographics
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
