# detect_ip

> **Function** in `langchain`

📖 [View in docs](https://reference.langchain.com/python/langchain/agents/middleware/_redaction/detect_ip)

Detect IPv4 or IPv6 addresses in content.

## Signature

```python
detect_ip(
    content: str,
) -> list[PIIMatch]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `content` | `str` | Yes | The text content to scan for IP addresses. |

## Returns

`list[PIIMatch]`

A list of detected IP address matches.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/42f8f79293cfb7589e5bc1d74a8ae4dfd0bf15e3/libs/langchain_v1/langchain/agents/middleware/_redaction.py#L98)