# Global IP to ASN & Network Range Intelligence (`afkdigital/newapi32-global-ip-asn-network-intelligence`) Actor

Look up IP addresses or ASNs against the hourly PDDL-licensed IPtoASN snapshot. Network range intelligence; no facility or contact claims.

- **URL**: https://apify.com/afkdigital/newapi32-global-ip-asn-network-intelligence.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$6.50 / 1,000 unique asn records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Global IP to ASN & Network Range Intelligence

NEWAPI32 v0.2 uses the [IPtoASN hourly snapshot](https://iptoasn.com/), published under the [PDDL 1.0 public-domain dedication](https://opendatacommons.org/licenses/pddl/1-0/). The public API at IPtoASN was discontinued; this Actor downloads the current compressed TSV file once per run and performs local lookups. It does **not** access PeeringDB or RIPEstat.

### What it does

Find the ASN and source network description for up to 50 input IPv4/IPv6 addresses; alternatively filter by up to 150 ASNs or a two-letter IP-range country. All supplied filters are combined. One output item represents a unique ASN, with the number of matched source ranges, up to 20 example ranges, country codes in those ranges and matching input IPs. No input filter defaults to a small two-IP example: `1.1.1.1` and `8.8.8.8`, which typically completes well within five minutes.

The country is the snapshot's label for an **IP range**, not a facility location, operator domicile, or proof of service availability there. `network_name` is the source's AS description. The range count covers the records matching the supplied filters and the selected ASN; `maxResults` selects the first distinct ASNs encountered in the source's range order. The sample ranges are not a complete range export. Not-routed rows with ASN 0 are ignored.

This source does not provide website, network type, traffic capacity, data center, network-to-facility presence or POC contact fields. The Actor never invents these. A physical facility relationship cannot be inferred from an IP address or ASN. The previous PeeringDB prototype is archived under `releases/0.1-peeringdb-blocked` and is not part of the current Actor image.

### Input and output

```json
{"ipAddresses":["1.1.1.1","8.8.8.8"],"maxResults":5,"sampleRangesPerAsn":3}
```

Fields: `ipAddresses` (at most 50), `asns` (at most 150), `country` (two letters), `maxResults` (1–100, default 5), `sampleRangesPerAsn` (1–20, default 5). Leave `ipAddresses` empty when searching by ASN or country. The output includes `asn`, `network_name`, `country_codes`, `range_count`, `ip_range_sample`, optionally `matched_ip_addresses`, source URL and license, SHA-256 and the HTTP Last-Modified header when supplied. The SHA-256 identifies the compressed source snapshot, and is not a guarantee that every line is accurate.

The Apify Dataset is available as JSON through `.../items` and CSV through `.../items?format=csv`. Apify flattens nested arrays and objects in CSV, producing columns such as `country_codes/0` and `ip_range_sample/0/range_start`. Clay and n8n can use JSON for structured samples or map these CSV columns directly.

### Source handling

One HTTPS download per run. A 32 MB compressed size ceiling, 40-second request timeout, three backoff attempts, full streamed TSV parsing, a 240-second processing deadline, IP normalization, deduplication and result limit are applied. The source updates hourly, but the run's Last-Modified header is the authority for that particular response. Data is community/registry-derived and can lag live routing; it is not a BGP route monitor or security verdict. The Actor sends a named User-Agent and logs no secrets.

### Pricing

The configured Apify Pay-per-Event setting is one **synthetic `apify-default-dataset-item` event at $0.0065 per unique ASN record** ($6.50 per 1,000). Source ranges, retries and repeated IPs do not create extra dataset items. There is no separate startup event. The Store price is authoritative. Owner-run usage may show zero charged events even while the event is configured; this does not establish what a buyer is charged. User max-charge limits are handled by the Python SDK's `ChargeResult`.

### Verification

Run `python3 -m unittest discover -s tests -v`, then `docker build -t newapi32:0.2 .` on adf-netcup-01. The fixture tests do not hit the network. A two-IP live Apify run completed in 8.4 seconds with two unique ASN records. Source: [IPtoASN](https://iptoasn.com/). This independent Actor is not affiliated with IPtoASN.

# Actor input Schema

## `ipAddresses` (type: `array`):

Up to 50 IPv4 or IPv6 addresses. Leave blank when filtering by ASN/country.

## `asns` (type: `array`):

Up to 150 exact AS numbers. Leave blank when filtering by IP/country.

## `country` (type: `string`):

Two-letter country in the source range; not the operator domicile or facility location.

## `maxResults` (type: `integer`):

Maximum distinct ASNs to publish and charge.

## `sampleRangesPerAsn` (type: `integer`):

Up to this many matched example IP ranges per ASN.

## Actor input object example

```json
{
  "maxResults": 5,
  "sampleRangesPerAsn": 5
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `csv` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/newapi32-global-ip-asn-network-intelligence").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/newapi32-global-ip-asn-network-intelligence").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call afkdigital/newapi32-global-ip-asn-network-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/newapi32-global-ip-asn-network-intelligence"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/itKi4aDRQxcHRBPry/builds/1UAVZLZFAfy20pcVq/openapi.json
