> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encrata.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> ## Submitting feedback
> If you find an error, a missing step, or information that is outdated or misleading on this page — especially if it stopped you from completing your task — report it so the Encrata docs team can fix it.
> Send a POST request to https://docs.encrata.com/feedback with a JSON body containing `path` (the full URL of the page, for example `https://docs.encrata.com/quickstart`) and `feedback` (what was wrong and what you expected):
> curl -X POST https://docs.encrata.com/feedback -H 'Content-Type: application/json' -d '{"path": "https://docs.encrata.com/quickstart", "feedback": "Step 3 uses a parameter that the API rejects."}'
> Do not include API keys, personal data, or other secrets in your feedback.

# Phone VoIP

> Check if a phone number is a VoIP line, including numbers ported onto a VoIP carrier. 2 credits, free when the answer is unknown.

Phone VoIP answers one question: is this number a VoIP line? VoIP numbers are
cheap to get in bulk, so they are common in SMS fraud and fake sign-ups.

`POST /api/lookup/phone/voip`

Requires an [Encrata API key](https://docs.encrata.com/authentication.md) in the `Authorization` header.

## Request

**phone** `string` *required*

The phone number in E.164 format, for example `+14155552671`. You can send it
as `query` instead.

**mode** `string` (default: static)

How to check the line.

| Value | Checks | Use when |
| - | - | - |
| `static` | The line type the number range was issued as. | You want a fast, broad check. |
| `current` | The carrier and line type the number uses today, after porting. Falls back to `static` when that can't be resolved. Most precise for US numbers. | You need to catch a mobile number moved onto a VoIP carrier. |

Any other value returns `400`.

### Example request

```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -X POST "https://developer.encrata.com/api/lookup/phone/voip" \
  -H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"phone": "+14155552671", "mode": "current"}'
```

```python Python theme={"theme":{"light":"github-light","dark":"vesper"}}
import requests

resp = requests.post(
    "https://developer.encrata.com/api/lookup/phone/voip",
    headers={"Authorization": "Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},
    json={"phone": "+14155552671", "mode": "current"},
)
print(resp.json())
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"vesper"}}
const resp = await fetch("https://developer.encrata.com/api/lookup/phone/voip", {
  method: "POST",
  headers: {
    Authorization: "Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ phone: "+14155552671", mode: "current" }),
});
const data = await resp.json();
```

## How the answer is decided

| `voip_status` | When |
| - | - |
| `voip` | The line type is `voip`. |
| `not_voip` | The line type is `mobile`, `fixed_line`, or `toll_free`. |
| `unknown` | The number is invalid, or its range can be either landline or mobile (`fixed_line_or_mobile`), or the line type is anything else. |

In `current` mode, the line type the number uses today wins over the one it was
issued as. A mobile number ported to a VoIP carrier comes back as `voip`.

## Response

The lookup is in `result`. `message` is `VoIP check complete.`

**phone** `string`

The number in E.164 format.

**valid** `boolean`

`true` when the number is valid. An invalid number is always
`voip_status: "unknown"` and is free.

**reason** `string`

Why the number isn't valid. Left out when `valid` is `true`.

**is\_voip** `boolean`

`true` only when `voip_status` is `voip`.

**voip\_status** `string`

`voip`, `not_voip`, or `unknown`. See
[How the answer is decided](#how-the-answer-is-decided).

**line\_type** `string`

The line type the answer used: `mobile`, `fixed_line`, `voip`, `toll_free`,
`fixed_line_or_mobile`, `short_code`, or `emergency`.

**original\_line\_type** `string`

`current` mode only: the line type the number was issued as, when it differs
from today's.

**carrier** `string`

The carrier the number was issued to. Left out when unknown.

**current\_carrier** `string`

`current` mode only: the carrier the number uses today.

**ported** `boolean`

`current` mode only: `true` when the number moved to another carrier. Left out
when unknown.

**region** `string`

The region the number belongs to. Left out when unknown.

**country** `string`

The country name. Left out when unknown.

**country\_code** `string`

ISO 3166-1 alpha-2 code. Left out when unknown.

**timezone** `string[]`

The time zones the number can be in. Left out when unknown.

**mode** `string`

The mode that ran: `static` or `current`.

**credits** `number`

Credits charged: `2`, or `0` when the number is invalid, the answer is
`unknown`, or the check is a free repeat.

**cached** `boolean`

`true` when the answer came from Encrata's cache. It isn't a billing signal.

## Errors

See [Phone Lookup errors](https://docs.encrata.com/api-reference/endpoint/phone-lookup.md#errors). VoIP
adds these:

| Status | `result.code` | When |
| - | - | - |
| `400` | `validation_failed` | `mode` isn't `static` or `current`. |
| `400` | `validation_failed` | The number couldn't be checked. The message asks for international format, for example `+14155550123`. |
| `402` | `insufficient_credits` | You have fewer than 2 credits and the check isn't a free repeat. |

## Credits

Each check costs **2 credits**. You pay nothing when the number is invalid or
the answer is `unknown`. Checking the same number in the same mode again within
6 months is free (`credits: 0`). `static` and `current` are billed separately.
See [Credits](https://docs.encrata.com/credits.md#free-repeat-window).

```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -X POST "https://developer.encrata.com/api/lookup/phone/voip" \
  -H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"phone": "+14155552671", "mode": "current"}'
```

```json 200 Ported to VoIP theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "success": true,
  "result": {
    "phone": "+14155552671",
    "valid": true,
    "is_voip": true,
    "voip_status": "voip",
    "line_type": "voip",
    "original_line_type": "mobile",
    "carrier": "T-Mobile USA, Inc.",
    "current_carrier": "Bandwidth.com",
    "ported": true,
    "region": "California",
    "country": "United States",
    "country_code": "US",
    "timezone": ["America/Los_Angeles"],
    "mode": "current",
    "cached": false,
    "credits": 2
  },
  "message": "VoIP check complete."
}
```

```json 200 Not VoIP theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "success": true,
  "result": {
    "phone": "+442071838750",
    "valid": true,
    "is_voip": false,
    "voip_status": "not_voip",
    "line_type": "fixed_line",
    "carrier": "BT",
    "region": "London",
    "country": "United Kingdom",
    "country_code": "GB",
    "timezone": ["Europe/London"],
    "mode": "static",
    "cached": false,
    "credits": 2
  },
  "message": "VoIP check complete."
}
```

```json 200 Unknown (free) theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "success": true,
  "result": {
    "phone": "+12015550123",
    "valid": true,
    "is_voip": false,
    "voip_status": "unknown",
    "line_type": "fixed_line_or_mobile",
    "country": "United States",
    "country_code": "US",
    "mode": "static",
    "cached": false,
    "credits": 0
  },
  "message": "VoIP check complete."
}
```

```json 400 theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "success": false,
  "result": { "code": "validation_failed" },
  "message": "Mode must be \"static\" or \"current\"."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.