# ipinfo.io API

> ipinfo.io workflow and API: ip location. Returns city, region, hostname and latitude as JSON.

ipinfo.io data from ipinfo.io: ip location.

- Page: https://fous.com/workflows/ipinfo-io
- Handle: `@ipinfo-io`
- Category: [Security](https://fous.com/workflows/category/security)
- Source website: https://ipinfo.io
- Last verified: Sep 29, 2026
- Fous is not affiliated with ipinfo.io.

## Methods

### Get ip location

Operation `get_ip_location`, version 1. 1 credit per call.

Find the public location and network operator of an IPv4 or IPv6 address. Private and reserved addresses have no public location.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `ip_address` | string | yes | `"8.8.8.8"` | Public IPv4 or IPv6 address, for example 8.8.8.8. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "ip_address"
  ],
  "properties": {
    "ip_address": {
      "type": "string",
      "description": "Public IPv4 or IPv6 address, for example 8.8.8.8.",
      "examples": [
        "8.8.8.8",
        "1.1.1.1",
        "2001:4860:4860::8888"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "ip_address": "8.8.8.8"
    },
    {
      "ip_address": "1.1.1.1"
    },
    {
      "ip_address": "2001:4860:4860::8888"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `city` | string or null | `"Mountain View"` | City, if available. |
| `region` | string or null | `"California"` | Region or state, if available. |
| `hostname` | string or null | `"dns.google"` | Hostname, if available. |
| `latitude` | number or null | `38.0088` | Latitude, if available. |
| `longitude` | number or null | `-122.1175` | Longitude, if available. |
| `time_zone` | string or null | `"America/Los_Angeles"` | IANA time zone, if available. |
| `ip_address` | string | `"8.8.8.8"` | Looked-up IP address. |
| `ipinfo_link` | string | `"https://ipinfo.io/8.8.8.8"` | IPinfo page for this address. |
| `postal_code` | string or null | `"94043"` | Postal code, if available. |
| `country_code` | string or null | `"US"` | Two-letter country code. |
| `country_name` | string or null | `"United States"` | Full country name. |
| `organization` | string or null | `"Google LLC"` | Organization or internet provider name, if available. |
| `network_number` | string or null | `"AS15169"` | Autonomous system number, if available. |

**Example input**

```json
{
  "ip_address": "8.8.8.8"
}
```

**Example output**

```json
{
  "city": "Mountain View",
  "region": "California",
  "hostname": "dns.google",
  "latitude": 38.0088,
  "longitude": -122.1175,
  "time_zone": "America/Los_Angeles",
  "ip_address": "8.8.8.8",
  "ipinfo_link": "https://ipinfo.io/8.8.8.8",
  "postal_code": "94043",
  "country_code": "US",
  "country_name": "United States",
  "organization": "Google LLC",
  "network_number": "AS15169"
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@ipinfo-io",
  "visibility": "public",
  "operation": "get_ip_location",
  "version": 1,
  "input": {
    "ip_address": "8.8.8.8"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@ipinfo-io\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_ip_location\",\n  \"version\": 1,\n  \"input\": {\n    \"ip_address\": \"8.8.8.8\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@ipinfo-io",
  "visibility": "public",
  "operation": "get_ip_location",
  "version": 1,
  "input": {
    "ip_address": "8.8.8.8"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@ipinfo-io","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## FAQ

### Is Fous affiliated with ipinfo.io?

No. Fous is not affiliated with ipinfo.io. This workflow reads the public ipinfo.io website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a ipinfo.io account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from ipinfo.io when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

## Related

- [Postcodes.io API](https://fous.com/workflows/postcodes-io.md): Postcodes.io provides UK postcode, location and administrative information; nearby postcode results include distance and coordinates, while retired postcodes lack administrative details.
- [ICANN Lookup API](https://fous.com/workflows/icann-lookup.md): Public domain registration lookup using ICANN registration data.
- [Zippopotam.us API](https://fous.com/workflows/zippopotam-us.md): Zippopotam.us returns places, regions and coordinates for postal codes in supported countries, and finds postal codes, places and coordinates by town and region.
- [US Census Bureau API](https://fous.com/workflows/us-census-bureau.md): US Census Bureau returns statistics from varying Census years, population estimates through July 1, and address geographies using Census vintages that may differ from representation.
- [OpenStreetMap API](https://fous.com/workflows/openstreetmap.md): OpenStreetMap returns place coordinates, address details, nearby readable place information, and ordered place search results from contributor-created data; results reflect mapped features and may be incomplete or differ from landmarks.
- [India Post PIN Codes API](https://fous.com/workflows/india-post-pin-codes.md): India Post PIN Codes returns Indian six-digit PIN codes and matching post offices, with branch types, delivery status, postal areas, districts, and states.
- [Google Maps API](https://fous.com/workflows/google-maps.md): Google Maps returns nearby places, public place details, up to 100 public reviews, and up to three routes; transit options vary by departure time.
- [AirNow API](https://fous.com/workflows/airnow.md): Current and forecast air quality for reporting areas in the United States and covered cities in Canada and Mexico.
- [All Security workflows](https://fous.com/workflows/category/security)
