# IP Extractor

POST /tools/ip-extractor: Extracts every unique IPv4 and IPv6 address from a block of text. Duplicates are removed and the order follows the text.

Source: https://docs.deepinfo.com/reference/utilities/ip-extractor/

Last updated: 2026-12-05

---
`POST https://api.deepinfo.com/v1/tools/ip-extractor`

Extracts every unique IPv4 and IPv6 address from a block of text. Duplicates are removed and the order follows the text.

It extracts **every** address it can parse, including private and reserved ones (`10.0.0.1` comes back), so filter those out yourself if you only want routable addresses.

## Authentication

Send your API key in the `apikey` request header.

## Request Body

| Parameter | Type | Required | Description |
|---|---|---|---|
| `text` | string | Required | Text to scan. Limited to 1,000,000 characters and 10,000 lines. |

```json
{
  "text": "Indicators seen in the leak: 198.51.100.7, 203.0.113.10 and 198.51.100.7 again, plus 2001:db8::1.\nHosts: www.example.com, mail.example.org, shop.example.co.uk, xn--mteri-h9ac.example.com.\nNot hosts: bad..name, host.invalid, 10.0.0.1, user@example.org"
}
```

## Response Fields

| Field | Type | Description |
|---|---|---|
| `ips` | array of string | The unique IP addresses found, IPv4 and IPv6. |

## Response Schema

| Field | Type |
|---|---|
| `ips` | array<string> |

## Examples

### 200 · OK

```bash
curl -X POST 'https://api.deepinfo.com/v1/tools/ip-extractor' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "text": "Indicators seen in the leak: 198.51.100.7, 203.0.113.10 and 198.51.100.7 again, plus 2001:db8::1.\nHosts: www.example.com, mail.example.org, shop.example.co.uk, xn--mteri-h9ac.example.com.\nNot hosts: bad..name, host.invalid, 10.0.0.1, user@example.org"
}'
```

`Content-Type: application/json` · `deepinfo-request-id: 5f0c6a8e-1b2d-4c3e-9f4a-7b8c9d0e1f2a`

```json
{
  "ips": [
    "198.51.100.7",
    "203.0.113.10"
  ]
}
```

### 200 · File Upload

```bash
curl -X POST 'https://api.deepinfo.com/v1/tools/ip-extractor' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -F 'text=@indicators.txt'
```

`Content-Type: application/json` · `deepinfo-request-id: 5f0c6a8e-1b2d-4c3e-9f4a-7b8c9d0e1f2a`

```json
{
  "ips": [
    "198.51.100.7",
    "203.0.113.10"
  ]
}
```

### 400 · Validation Error (empty text)

```bash
curl -X POST 'https://api.deepinfo.com/v1/tools/ip-extractor' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "text": ""
}'
```

`Content-Type: application/json` · `deepinfo-request-id: 5f0c6a8e-1b2d-4c3e-9f4a-7b8c9d0e1f2a`

```json
{
  "code": 10400,
  "parameters": [
    {
      "details": [
        "Empty text is provided as input."
      ],
      "subcode": 19002
    }
  ],
  "solution": "https://docs.deepinfo.com/reference/"
}
```

### 400 · Validation Error (file content does not match its extension)

```bash
curl -X POST 'https://api.deepinfo.com/v1/tools/ip-extractor' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -F 'text=@notreally.xlsx'
```

`Content-Type: application/json` · `deepinfo-request-id: 5f0c6a8e-1b2d-4c3e-9f4a-7b8c9d0e1f2a`

```json
{
  "code": -1,
  "details": [
    "[OfficeParser]: Error occured while reading the file buffers"
  ],
  "solution": "https://docs.deepinfo.com/reference/"
}
```

### 422 · Too Large (file over 1 MB)

```bash
curl -X POST 'https://api.deepinfo.com/v1/tools/ip-extractor' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -F 'text=@big.txt'
```

`Content-Type: application/json` · `deepinfo-request-id: 5f0c6a8e-1b2d-4c3e-9f4a-7b8c9d0e1f2a`

```json
{
  "reason": "Maximum text size is 1mb.",
  "code": 19001
}
```
