# 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/b302691ff9ad841804e93e5addbdc53b6974473b/libs/langchain_v1/langchain/agents/middleware/_redaction.py#L98)