# Port numbers in

Ports numbers in.

```http
POST https://api.pozy.ai/v1/phone-numbers/port-in
```

- Area: Phone & voice / Phone Numbers
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `phoneNumbers`, array of string, required: At least 1 item. Up to 50 items
- `endUser`, object, required
  - `entityName`, string, required
  - `authPersonName`, string, required
  - `billingPhoneNumber`, string
  - `accountNumber`, string, required
  - `pinPasscode`, string
  - `taxIdentifier`, string: Up to 50 characters
  - `businessIdentifier`, string: Up to 50 characters
  - `streetAddress`, string, required
  - `extendedAddress`, string
  - `locality`, string, required
  - `administrativeArea`, string
  - `postalCode`, string, required
  - `countryCode`, string, required: One of `US`, `CA`, `GB`, `ES`, `DE`, `FR`, `NL`, `AU`, `BR`. 2 to 2 characters
- `loaDocumentId`, string, required
- `invoiceDocumentId`, string, required
- `focDatetimeRequested`, string (date-time)
- `customerReference`, string: Up to 100 characters
- `portType`, string: One of `full`, `partial`. Default `full`
- `requirements`, array of object: Up to 30 items
  - `requirementTypeId`, string, required
  - `fieldValue`, string, required: Up to 1000 characters

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/phone-numbers/port-in" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phoneNumbers": [
    "+14155550123"
  ],
  "endUser": {
    "entityName": "Acme",
    "authPersonName": "Acme",
    "accountNumber": "string",
    "streetAddress": "string",
    "locality": "string",
    "postalCode": "string",
    "countryCode": "US"
  },
  "loaDocumentId": "69672f55771520ecb8178d25",
  "invoiceDocumentId": "606bc6ac551d4eb2b1feef58"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/phone-numbers/port-in", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    phoneNumbers: [
      "+14155550123"
    ],
    endUser: {
      entityName: "Acme",
      authPersonName: "Acme",
      accountNumber: "string",
      streetAddress: "string",
      locality: "string",
      postalCode: "string",
      countryCode: "US"
    },
    loaDocumentId: "69672f55771520ecb8178d25",
    invoiceDocumentId: "606bc6ac551d4eb2b1feef58"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/phone-numbers/port-in",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "phoneNumbers": [
            "+14155550123",
        ],
        "endUser": {
            "entityName": "Acme",
            "authPersonName": "Acme",
            "accountNumber": "string",
            "streetAddress": "string",
            "locality": "string",
            "postalCode": "string",
            "countryCode": "US",
        },
        "loaDocumentId": "69672f55771520ecb8178d25",
        "invoiceDocumentId": "606bc6ac551d4eb2b1feef58",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 201

- `id`, string
- `carrierPortingOrderId`, string
- `status`, string: One of `draft`, `pending`, `foc_confirmed`, `ported`, `exception`, `cancelled`
- `phoneNumbers`, array of string
- `orders`, array of object
  - `id`, string
  - `carrierPortingOrderId`, string
  - `status`, string
  - `phoneNumbers`, array of string
  - `error`, string

```json
{
  "id": "6bfebd43ddc270f6d2c56fc5",
  "carrierPortingOrderId": "6ff0121227cdb2529beb44df",
  "status": "draft",
  "phoneNumbers": [
    "+14155550123"
  ],
  "orders": [
    {
      "id": "6bfebd43ddc270f6d2c56fc5",
      "carrierPortingOrderId": "6ff0121227cdb2529beb44df",
      "status": "active",
      "phoneNumbers": [
        "+14155550123"
      ],
      "error": "string"
    }
  ]
}
```
