# Porkbun API v3 — Utility

> IP detection and credential verification

Part of the Porkbun API v3.48. Topic index: https://porkbun.com/llms · Full reference: https://porkbun.com/llms-full.txt · Overview: https://porkbun.com/llms.txt · OpenAPI spec: https://porkbun.com/api/json/v3/spec

**Auth:** send `X-API-Key` / `X-Secret-API-Key` headers (preferred) or `apikey` / `secretapikey` in the JSON body. Create keys at https://porkbun.com/account/api

---

# Endpoints

## POST /api/json/v3/ping

**Test credentials and get caller IP**

Returns the caller's public IP address. Optionally validates API credentials.

- **No credentials supplied** — returns IP only.
- **Valid credentials supplied** — returns IP with `credentialsValid: true`.
- **Invalid credentials supplied** — returns an error.

Useful for agents and clients to verify their API key is working before making other calls.

```bash
curl -X POST https://api.porkbun.com/api/json/v3/ping \
  -H 'Content-Type: application/json' \
  -d '[]'
```

Response fields:

| Field | Type | Description |
|---|---|---|
| `status` | string |  |
| `yourIp` | string | The caller's public IP address |
| `xForwardedFor` | string | Raw value of the X-Forwarded-For header |
| `credentialsValid` | boolean | Present and true when valid credentials were supplied |

## GET /api/json/v3/ping

**Test credentials and get caller IP**

Returns the caller's public IP address. Optionally validates API credentials.

- **No credentials supplied** — returns IP only.
- **Valid credentials supplied** — returns IP with `credentialsValid: true`.
- **Invalid credentials supplied** — returns an error.

Useful for agents and clients to verify their API key is working before making other calls.

| Parameter | In | Required | Description |
|---|---|---|---|
| `Authorization` | header | no | Bearer token: `Authorization: Bearer <token>` |
| `X-API-Key` | header | no | API key header auth (use with X-Secret-API-Key) |
| `X-Secret-API-Key` | header | no | Secret API key header auth (use with X-API-Key) |

```bash
curl 'https://api.porkbun.com/api/json/v3/ping'
```

Response fields:

| Field | Type | Description |
|---|---|---|
| `status` | string |  |
| `yourIp` | string | The caller's public IP address |
| `xForwardedFor` | string | Raw value of the X-Forwarded-For header |
| `credentialsValid` | boolean | Present and true when valid credentials were supplied |

## POST /api/json/v3/ip

**Get caller IP address**

Returns the caller's public IP address. No credentials required. Use the `api-ipv4.porkbun.com` hostname if you need to force an IPv4 address.

```bash
curl -X POST https://api.porkbun.com/api/json/v3/ip \
  -H 'Content-Type: application/json' \
  -d '[]'
```

Response fields (IpResponse):

| Field | Type | Description |
|---|---|---|
| `status` | string |  |
| `yourIp` | string | The caller's public IP address |
| `xForwardedFor` | string | Raw value of the X-Forwarded-For header |

## GET /api/json/v3/ip

**Get caller IP address**

Returns the caller's public IP address. No credentials required. Use the `api-ipv4.porkbun.com` hostname if you need to force an IPv4 address.

```bash
curl 'https://api.porkbun.com/api/json/v3/ip'
```

Response fields (IpResponse):

| Field | Type | Description |
|---|---|---|
| `status` | string |  |
| `yourIp` | string | The caller's public IP address |
| `xForwardedFor` | string | Raw value of the X-Forwarded-For header |

---

## More

- Guides (how-tos): https://porkbun.com/llms/guides
- Topic index: https://porkbun.com/llms
- Full reference (one file): https://porkbun.com/llms-full.txt
- OpenAPI spec (full schemas): https://porkbun.com/api/json/v3/spec
- Short overview: https://porkbun.com/llms.txt
- Official MCP server: https://porkbun.com/mcp (`npx -y @porkbunllc/mcp-server`)
- Create API keys: https://porkbun.com/account/api
