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

# Create Phone

> Provision a new phone for running TikTok/Instagram accounts

## Request Body

<ParamField body="phoneName" type="string">
  Custom name for the phone (optional). If not provided, a default name will be generated.
</ParamField>

<ParamField body="country" type="string" default="US">
  ISO 3166-1 alpha-2 country code for the phone's proxy location (e.g. `US`, `GB`, `DE`). Determines where the phone's IP address appears to be located, which affects what content and audiences are available on TikTok and Instagram. Defaults to `US` if not provided.

  Supported values: `US`, `GB`, `DE`, `ES`, `CA`, `FR`, `IT`, `PT`, `AE`, `AR`, `AT`, `AU`, `BD`, `BE`, `BG`, `BR`, `CH`, `CL`, `CO`, `CY`, `CZ`, `DK`, `DZ`, `EG`, `FI`, `GE`, `GR`, `HK`, `HN`, `HR`, `HU`, `ID`, `IE`, `IL`, `IN`, `JP`, `KE`, `KR`, `KZ`, `LT`, `MA`, `MT`, `MX`, `MY`, `NG`, `NL`, `NO`, `NZ`, `PE`, `PH`, `PK`, `PL`, `RO`, `SA`, `SE`, `SG`, `SK`, `TH`, `TR`, `TW`, `UA`, `VN`, `ZA`
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the phone was created successfully (`true` or `false`).
</ResponseField>

<ResponseField name="phoneId" type="string">
  Unique identifier for the phone.
</ResponseField>

<ResponseField name="phoneSlot" type="number">
  The assigned phone slot number.
</ResponseField>

<ResponseField name="proxyId" type="string">
  ID of the proxy assigned to this phone.
</ResponseField>

<ResponseField name="status" type="string">
  Current status: `pending_setup`, `ready`, or `failed`.
</ResponseField>

<ResponseField name="message" type="string">
  Success message confirming phone creation.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of when the phone was created.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.infinipost.co/v1/phones \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "phoneName": "My Fashion Account Phone",
      "country": "GB"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.infinipost.co/v1/phones', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      phoneName: 'My Fashion Account Phone',
      country: 'GB'
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.infinipost.co/v1/phones',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'phoneName': 'My Fashion Account Phone',
          'country': 'GB'
      }
  )

  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "phoneId": "phone_abc123",
    "phoneSlot": 1,
    "proxyId": "proxy_xyz789",
    "status": "pending_setup",
    "message": "Phone created successfully",
    "createdAt": "2024-04-21T20:00:00Z"
  }
  ```

  ```json Failed Response theme={null}
  {
    "success": false,
    "error": {
      "code": "internal",
      "message": "Failed to create phone: Unable to allocate resources"
    }
  }
  ```
</ResponseExample>

## Provisioning Process

1. **Request Submitted** (instant): Phone provisioning request is queued
2. **Phone Slot Assignment**: System assigns next available phone slot
3. **Infrastructure Allocation** (30-90 seconds): Phone resources are allocated

## Error Responses

```json Phone Limit Reached theme={null}
{
  "error": {
    "code": "resource-exhausted",
    "message": "You've reached your phone limit (5). Please upgrade your plan."
  }
}
```

```json User Not Found theme={null}
{
  "error": {
    "code": "not-found",
    "message": "User not found"
  }
}
```

```json API Error theme={null}
{
  "error": {
    "code": "internal",
    "message": "API error: Unable to allocate resources"
  }
}
```

```json Unauthenticated theme={null}
{
  "error": {
    "code": "unauthenticated",
    "message": "User must be authenticated"
  }
}
```
