# Verify an account from an agent

Buying anything over the API, and adding credit, needs a **verified email
address and phone number**. New accounts are not asked to verify the phone at
signup, so the first purchase from an account an agent just made often fails
with `VERIFICATION_REQUIRED`. Both can be verified without leaving the
conversation: the API sends a code to the email address or phone on the
account, the person (or whoever reads that inbox) gives the agent the code, and
the agent confirms it.

The code always goes to the address or phone being verified, never to the
agent: it proves something only because it arrives there.

## 1. Send the code

Phone:

```
POST /api/json/v3/account/verifyPhone/send
{"apikey":"pk1_...","secretapikey":"sk1_..."}
```

```json
{"status":"SUCCESS","sent":true,"channel":"sms","sentTo":"+1 ••• 42","expiresInMinutes":10}
```

If the text does not arrive, send again with `"channel": "call"` for a voice
call that reads the code out. A second text request within 10 minutes returns
`"codeAlreadySent": true` instead of texting again: the first code is still good.

Email:

```
POST /api/json/v3/account/verifyEmail/send
{"apikey":"pk1_...","secretapikey":"sk1_..."}
```

```json
{"status":"SUCCESS","sent":true,"sentTo":"o•••@example.com","expiresInMinutes":4320}
```

This emails the usual verification message, a link plus a code. A second
request within 10 minutes returns `"codeAlreadySent": true`; the earlier email's
code is good for 3 days.

The phone number and email address are the ones **already on the account**;
they cannot be chosen or changed over the API.

## 2. Ask for the code, and confirm it

```
POST /api/json/v3/account/verifyPhone/confirm
{"apikey":"pk1_...","secretapikey":"sk1_...","code":"CKVEGRUS"}
```

```
POST /api/json/v3/account/verifyEmail/confirm
{"apikey":"pk1_...","secretapikey":"sk1_...","code":"<code from the email>"}
```

Pass the code exactly as received. Each response says whether the other one is
verified (`emailVerified` / `phoneVerified`); once both are, retry the call that
failed. Clicking the link in the verification email works too.

## 3. Optional: wait for webhooks instead of asking "done yet?"

Subscribe a webhook endpoint to `account.verification.*`:

- `account.verification.code_sent`: a code went to the email or phone, from the
  API or the website. `data` has `channel`, `method`, `sentTo` (masked) and
  `expiresInMinutes`, never the code.
- `account.verification.completed`: the email or phone was verified, however it
  happened (code over the API, the link, or the website). `data` has `channel`,
  `emailVerified` and `phoneVerified`; when both are `true`, retry the purchase.

See [Receive and verify webhooks](https://porkbun.com/llms/guides/verify-a-webhook).

## From the MCP server

The tools are `send_phone_verification_code` / `confirm_phone_verification` and
`send_email_verification_code` / `confirm_email_verification`.

## Errors

- `PHONE_CODE_INVALID` / `EMAIL_CODE_INVALID`: wrong or expired code (for email,
  also a code from an older email or for a different address). Check it, or send
  a new one.
- `PHONE_VERIFY_LIMIT`: five codes sent today, or ten wrong codes this hour.
  `EMAIL_VERIFY_LIMIT`: ten wrong codes this hour.
- `PHONE_VERIFY_UNAVAILABLE`: no phone number on the account, or a country where
  phone verification needs the website's CAPTCHA. Verify at
  https://porkbun.com/account.
- `EMAIL_VERIFY_UNAVAILABLE`: the email could not be sent, or there is no
  address on the account.
- `PHONE_VERIFY_FAILED`: the code could not be sent. Retry once, or use
  `"channel": "call"`.

Already verified: the calls return `"alreadyVerified": true`. Not available on
sandbox keys.


---

## 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
