# Validate and enrich a phone number

`POST /api/v1/phone`

- Authentication: Secret API key as a bearer token
- Billing: 1 credit for a fresh lookup that answers `valid` true; invalid numbers and 7-day repeats are free.
- Group: Phone

Parses a number with libphonenumber metadata and answers whether it is valid for its region, its E.164, national and international formats, the country, the line type (`mobile`, `fixed_line`, `fixed_line_or_mobile`, `voip`, `toll_free`, …), the carrier and region where the metadata knows them, and the time zones the number belongs to. Pass `country` (an ISO 3166-1 alpha-2 code) to parse numbers written without a country calling code.

The phone product page is marked "coming soon"; the endpoint itself works today under the same envelope, billing and error codes as every other lookup.

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `phone` | string | yes | The number, in any common notation. Include the country calling code or pass `country`. At most 32 characters. |
| `country` | string | null | no | An ISO 3166-1 alpha-2 region code (`US`, `GB`, `PL`) used to parse numbers written without a calling code. |

## Example request

```bash
curl -X POST https://spaw.co/api/v1/phone \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "+1 415 555 0142"
}'
```

## Responses

### 200 — The parsed number; `valid: false` with a `reason` for numbers that do not parse.

```json
{
    "success": true,
    "data": {
        "valid": true,
        "reason": null,
        "e164": "+14155550142",
        "national": "(415) 555-0142",
        "international": "+1 415-555-0142",
        "country": "US",
        "line_type": "fixed_line_or_mobile",
        "carrier": null,
        "region": "San Francisco, CA",
        "extension": null,
        "timezones": [
            "America/Los_Angeles"
        ],
        "sources": [
            {
                "dataset": "libphonenumber",
                "version": "9.0.37"
            }
        ]
    },
    "meta": {
        "credits_used": 1,
        "credits_remaining": 8,
        "cache_hit": false,
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 401 — The key is missing, malformed, or revoked.

```json
{
    "success": false,
    "error": {
        "code": "UNAUTHENTICATED",
        "message": "Provide a valid API key as a bearer token.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 402 — The balance is empty. The lookup did not run.

```json
{
    "success": false,
    "error": {
        "code": "INSUFFICIENT_CREDITS",
        "message": "Your credit balance is empty.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 422 — The request body could not be validated; `error.errors` lists the fields.

```json
{
    "success": false,
    "error": {
        "code": "VALIDATION_FAILED",
        "message": "The email field is required.",
        "errors": {
            "email": [
                "The email field is required."
            ]
        },
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 429 — Over 5 requests per second for the key. Retry after the limit resets.

```json
{
    "success": false,
    "error": {
        "code": "RATE_LIMITED",
        "message": "Too many requests. Retry after the limit resets.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

## Error codes

- `UNAUTHENTICATED` — https://spaw.co/docs/errors/UNAUTHENTICATED
- `VALIDATION_FAILED` — https://spaw.co/docs/errors/VALIDATION_FAILED
- `INSUFFICIENT_CREDITS` — https://spaw.co/docs/errors/INSUFFICIENT_CREDITS
- `RATE_LIMITED` — https://spaw.co/docs/errors/RATE_LIMITED

---

Canonical page: https://spaw.co/docs/api/validate-phone · OpenAPI document: https://spaw.co/openapi.json · All endpoints: https://spaw.co/docs/api
