> For the complete documentation index, see [llms.txt](https://dantonia.gitbook.io/test/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dantonia.gitbook.io/test/telephone-number/order-telephone-number.md).

# Order Telephone Number

## CreateTNOrder

<mark style="color:green;">`POST`</mark> `https://api.opentact.org/rest/order/tn`

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | JWT\_TOKEN       |
| Content-Type  | string | application/json |

#### Request Body

| Name              | Type    | Description                                                                                                         |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| autorenew         | boolean | Default: `"true"`                                                                                                   |
| voice             | string  | <p>Default:<code>"true"</code><br>Voice feature</p>                                                                 |
| fax               | string  | Fax feature                                                                                                         |
| sms               | boolean | <p>SMS feature<br>Default: <code>"true"</code></p>                                                                  |
| mms               | boolean | MMS feature                                                                                                         |
| emergency         | boolean | Emergency feature                                                                                                   |
| tns               | string  | <p>Array of numbers \<double> <code>non-empty</code><br>Array of numbers to order</p>                               |
| profile           | string  | <p><code>\[ 1 .. 255 ] characters</code>   <br>Default: <code>US</code><br>TNProfile name</p>                       |
| sip\_connection   | string  | <p><code>^\[0-9a-f]{8}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{12}$</code><br>SIP Connection uuid</p>      |
| sip\_control\_app | string  | <p><code>^\[0-9a-f]{8}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{12}$</code><br>SIP Control app uuid<br></p> |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "payload": {
    "voice": true,
    "fax": true,
    "sms": true,
    "mms": true,
    "emergency": true,
    "autorenew": true,
    "state": "created",
    "request": {
      "voice": true,
      "fax": true,
      "sms": true,
      "mms": true,
      "emergency": true,
      "tns": [
        0
      ],
      "autorenew": true,
      "profile": "US"
    },
    "uuid": "e7fad289-f977-45bb-bc42-448d1290555c",
    "price": null,
    "created_on": "2020-10-28T10:47:28.270Z",
    "modified_on": "2020-10-28T10:47:28.270Z"
  }
}
```

{% endtab %}

{% tab title="201 " %}

```javascript
{
  "success": true,
  "payload": {
    "voice": true,
    "fax": true,
    "sms": true,
    "mms": true,
    "emergency": true,
    "autorenew": true,
    "state": "created",
    "request": {
      "voice": true,
      "fax": true,
      "sms": true,
      "mms": true,
      "emergency": true,
      "tns": [
        0
      ],
      "autorenew": true,
      "profile": "US"
    },
    "uuid": "e7fad289-f977-45bb-bc42-448d1290555c",
    "price": null,
    "created_on": "2020-10-28T10:47:28.270Z",
    "modified_on": "2020-10-28T10:47:28.270Z"
  }
}
```

{% endtab %}

{% tab title="402 Not enough balance." %}

```javascript
{
  "success": false,
  "message": "Not enough account balance",
  "status": 402
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "success": false,
  "message": "Not found",
  "status": 404
}
```

{% endtab %}
{% endtabs %}

### Code Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST "https://api.opentact.org/rest/order/tn" \
-H  "accept: application/json" \
-H  "X-Auth-Token: JWT_TOKEN" \
-H  "Content-Type: application/json" \
-d "{\"voice\":true,\"fax\":true,\"sms\":true,\"mms\":true,\"emergency\":true,\"tns\":[0],\"autorenew\":true,\"profile\":\"string\",\"sip_connection\":\"string\",\"sip_control_app\":\"string\"}"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'accept' => 'application/json',
    'X-Auth-Token' => 'JWT_TOKEN',
    'Content-Type' => 'application/json'
);
$data = '{"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"}';
$response = Requests::post('https://api.opentact.org/rest/order/tn', $headers, $data);

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'X-Auth-Token': 'JWT_TOKEN',
    'Content-Type': 'application/json',
}

data = '{"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"}'

response = requests.post('https://api.opentact.org/rest/order/tn', headers=headers, data=data)

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var fetch = require('node-fetch');

fetch('https://api.opentact.org/rest/order/tn', {
    method: 'POST',
    headers: {
        'accept': 'application/json',
        'X-Auth-Token': 'JWT_TOKEN',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"})
});

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"strings"
)

func main() {
	client := &http.Client{}
	var data = strings.NewReader(`{"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"}`)
	req, err := http.NewRequest("POST", "https://api.opentact.org/rest/order/tn", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("accept", "application/json")
	req.Header.Set("X-Auth-Token", "JWT_TOKEN")
	req.Header.Set("Content-Type", "application/json")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

```

{% endtab %}
{% endtabs %}

## GetOrderPrice

<mark style="color:green;">`POST`</mark> `https://api.opentact.org/rest/order/price`

Get order price

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | JWT\_TOKEN       |
| Content-Type  | string | application/json |

#### Request Body

| Name              | Type    | Description                                                                                                         |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| autorenew         | boolean | Default: `"true"`                                                                                                   |
| voice             | string  | <p>Default:<code>"true"</code><br>Voice feature</p>                                                                 |
| fax               | string  | Fax feature                                                                                                         |
| sms               | boolean | <p>SMS feature<br>Default: <code>"true"</code></p>                                                                  |
| mms               | boolean | MMS feature                                                                                                         |
| emergency         | boolean | Emergency feature                                                                                                   |
| tns               | string  | <p>Array of numbers \<double> <code>non-empty</code><br>Array of numbers to order</p>                               |
| profile           | string  | <p><code>\[ 1 .. 255 ] characters</code>   <br>Default: <code>US</code><br>TNProfile name</p>                       |
| sip\_connection   | string  | <p><code>^\[0-9a-f]{8}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{12}$</code><br>SIP Connection uuid</p>      |
| sip\_control\_app | string  | <p><code>^\[0-9a-f]{8}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{4}-\[0-9a-f]{12}$</code><br>SIP Control app uuid<br></p> |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "payload": {
    "nrc": 0,
    "mrc": 0,
    "items": [
      {
        "nrc": "0",
        "mrc": "0",
        "voice_nrc": "0",
        "voice_mrc": "0",
        "voice_incoming_per_min_cost": "0",
        "voice_outgoing_per_min_cost": "0",
        "fax_nrc": "0",
        "fax_mrc": "0",
        "fax_incoming_per_min_cost": "0",
        "fax_outgoing_per_min_cost": "0",
        "emergency_nrc": "0",
        "emergency_mrc": "0",
        "emergency_incoming_per_min_cost": "0",
        "emergency_outgoing_per_min_cost": "0",
        "sms_nrc": "0",
        "sms_mrc": "0",
        "sms_per_send_cost": "0",
        "sms_per_receive_cost": "0",
        "mms_nrc": "0",
        "mms_mrc": "0",
        "mms_per_send_cost": "0",
        "mms_per_receive_cost": "0",
        "id": "string",
        "name": "string",
        "description": "string"
      }
    ]
  }
}
```

{% endtab %}

{% tab title="400 " %}

```javascript
{
  "success": false,
  "message": "Not found",
  "status": 404
}
```

{% endtab %}
{% endtabs %}

### Code Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST "https://api.opentact.org/rest/order/price" -H  "accept: application/json" -H  "X-Auth-Token: JWT_TOKEN" -H  "Content-Type: application/json" \
-d "{\"voice\":true,\"fax\":true,\"sms\":true,\"mms\":true,\"emergency\":true,\"tns\":[0],\"autorenew\":true,\"profile\":\"string\",\"sip_connection\":\"string\",\"sip_control_app\":\"string\"}"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'accept' => 'application/json',
    'X-Auth-Token' => 'JWT_TOKEN',
    'Content-Type' => 'application/json'
);
$data = '{"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"}';
$response = Requests::post('https://api.opentact.org/rest/order/price', $headers, $data);

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'X-Auth-Token': 'JWT_TOKEN',
    'Content-Type': 'application/json',
}

data = '{"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"}'

response = requests.post('https://api.opentact.org/rest/order/price', headers=headers, data=data)

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var fetch = require('node-fetch');

fetch('https://api.opentact.org/rest/order/price', {
    method: 'POST',
    headers: {
        'accept': 'application/json',
        'X-Auth-Token': 'JWT_TOKEN',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"})
});

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"strings"
)

func main() {
	client := &http.Client{}
	var data = strings.NewReader(`{"voice":true,"fax":true,"sms":true,"mms":true,"emergency":true,"tns":[0],"autorenew":true,"profile":"string","sip_connection":"string","sip_control_app":"string"}`)
	req, err := http.NewRequest("POST", "https://api.opentact.org/rest/order/price", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("accept", "application/json")
	req.Header.Set("X-Auth-Token", "JWT_TOKEN")
	req.Header.Set("Content-Type", "application/json")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

```

{% endtab %}
{% endtabs %}

## ListOrders

<mark style="color:green;">`POST`</mark> `https://api.opentact.org/rest/order`

This return the order list.

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | JWT\_TOKEN       |
| Content-Type  | string | application/json |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "payload": {
    "created_on": "2019-08-24T14:15:22Z",
    "modified_on": "2019-08-24T14:15:22Z",
    "uuid": "string",
    "state": "created",
    "tns": [],
    "account": {},
    "profile": {},
    "sip_connection": {},
    "sip_control_app": {},
    "created_by": {},
    "modified_by": {},
    "request": {},
    "price": {},
    "autorenew": true,
    "tnleases": []
  }
}
```

{% endtab %}

{% tab title="400 " %}

```javascript
{
  "success": false,
  "message": "Not enough account balance",
  "status": 400
}
```

{% endtab %}
{% endtabs %}

### Code Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://api.opentact.org/rest/order" \
-H  "accept: application/json" -H  "X-Auth-Token: JWT_TOKEN"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'accept' => 'application/json',
    'X-Auth-Token' => 'JWT_TOKEN'
);
$response = Requests::get('https://api.opentact.org/rest/order', $headers);

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'X-Auth-Token': 'JWT_TOKEN',
}

response = requests.get('https://api.opentact.org/rest/order', headers=headers)

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var fetch = require('node-fetch');

fetch('https://api.opentact.org/rest/order', {
    headers: {
        'accept': 'application/json',
        'X-Auth-Token': 'JWT_TOKEN'
    }
});

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("GET", "https://api.opentact.org/rest/order", nil)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("accept", "application/json")
	req.Header.Set("X-Auth-Token", "JWT_TOKEN")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

```

{% endtab %}
{% endtabs %}

## GetOrderByUUID

<mark style="color:blue;">`GET`</mark> `https://api.opentact.org/rest/order/{uuid}`

Get extended order info.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| uuid | string |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| X-Auth-Token | string | JWT\_TOKEN  |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "payload": {
    "created_on": "2019-08-24T14:15:22Z",
    "modified_on": "2019-08-24T14:15:22Z",
    "uuid": "string",
    "state": "created",
    "tns": [
      {}
    ],
    "account": {
      "created_on": "2019-08-24T14:15:22Z",
      "modified_on": "2019-08-24T14:15:22Z",
      "uuid": "string",
      "name": "string",
      "email": "string",
      "level": "ServiceAccount",
      "balance": 0,
      "class4_id": 0,
      "deleted_on": "2019-08-24T14:15:22Z",
      "time_zone": {},
      "users": [],
      "admin": {},
      "messaging_profile_default": {},
      "messaging_profiles": [],
      "addresses": []
    },
    "profile": {
      "created_on": "2019-08-24T14:15:22Z",
      "modified_on": "2019-08-24T14:15:22Z",
      "uuid": "string",
      "name": "string",
      "description": "string",
      "priority": "high",
      "tn_provider": {},
      "toll_free": true,
      "class4_client_billing_rule_id": 1,
      "class4_vendor_res_id": 1,
      "class4_vendor_billing_rule_id": 1,
      "register_provider": {},
      "nrc": 0,
      "mrc": 0,
      "sms_provider": {},
      "sms_nrc": 0,
      "sms_mrc": 0,
      "sms_per_send_cost": 0,
      "sms_per_receive_cost": 0,
      "mms_nrc": 0,
      "mms_mrc": 0,
      "mms_per_send_cost": 0,
      "mms_per_receive_cost": 0,
      "voice_provider": {},
      "voice_nrc": 0,
      "voice_mrc": 0,
      "voice_incoming_per_min_cost": 0,
      "voice_outgoing_per_min_cost": 0,
      "fax_nrc": 0,
      "fax_mrc": 0,
      "fax_incoming_per_min_cost": 0,
      "fax_outgoing_per_min_cost": 0,
      "emergency_nrc": 0,
      "emergency_mrc": 0,
      "emergency_incoming_per_min_cost": 0,
      "emergency_outgoing_per_min_cost": 0
    },
    "sip_connection": {
      "created_on": "2019-08-24T14:15:22Z",
      "modified_on": "2019-08-24T14:15:22Z",
      "uuid": "string",
      "name": "string",
      "is_active": true,
      "tech_prefix": 0,
      "product": {},
      "subdomain": "string",
      "ip": "string",
      "port": 0,
      "class4_ingress_trunk_id": 0,
      "class4_ingress_trunk_settings": {},
      "class4_ingress_resource_ip_id": 0,
      "class4_egress_trunk_id": 0,
      "class4_egress_trunk_settings": {},
      "class4_egress_resource_ip_id": 0,
      "class4_trunk_prefix_id": 0,
      "tnleases": [],
      "sipusers": [],
      "sip_user_invites": [],
      "account": {},
      "created_by": {},
      "modified_by": {},
      "outbound_voice_profile": {}
    },
    "sip_control_app": {
      "created_on": "2019-08-24T14:15:22Z",
      "modified_on": "2019-08-24T14:15:22Z",
      "uuid": "string",
      "name": "string",
      "is_active": true,
      "subdomain": "string",
      "tnleases": [],
      "class4_egress_trunk_id": 0,
      "class4_egress_trunk_settings": {},
      "class4_egress_resource_ip_id": 0,
      "account": {},
      "created_by": {},
      "modified_by": {},
      "outbound_voice_profile": {},
      "webhook_url": "string",
      "webhook_method": "GET",
      "webhook_request_timeout": 0,
      "call_flow_url": "string",
      "call_flow_request_timeout": 0,
      "call_flow_method": "GET"
    },
    "created_by": {
      "created_on": "2019-08-24T14:15:22Z",
      "modified_on": "2019-08-24T14:15:22Z",
      "uuid": "string",
      "email": "string",
      "password": "string",
      "phone_number": "string",
      "first_name": "string",
      "last_name": "string",
      "avatar": "string",
      "gender": "Agender",
      "dob": "2019-08-24T14:15:22Z",
      "role": "Admin",
      "gmail_user_id": "string",
      "facebook_user_id": "string",
      "apple_user_id": "string",
      "wechat_user_id": "string",
      "deleted_on": "2019-08-24T14:15:22Z",
      "token": "string",
      "account": {}
    },
    "modified_by": {
      "created_on": "2019-08-24T14:15:22Z",
      "modified_on": "2019-08-24T14:15:22Z",
      "uuid": "string",
      "email": "string",
      "password": "string",
      "phone_number": "string",
      "first_name": "string",
      "last_name": "string",
      "avatar": "string",
      "gender": "Agender",
      "dob": "2019-08-24T14:15:22Z",
      "role": "Admin",
      "gmail_user_id": "string",
      "facebook_user_id": "string",
      "apple_user_id": "string",
      "wechat_user_id": "string",
      "deleted_on": "2019-08-24T14:15:22Z",
      "token": "string",
      "account": {}
    },
    "request": {
      "voice": "true",
      "fax": true,
      "sms": "true",
      "mms": true,
      "emergency": true,
      "tns": [],
      "autorenew": true,
      "profile": "US",
      "sip_connection": "string",
      "sip_control_app": "string"
    },
    "price": {
      "nrc": 0,
      "mrc": 0,
      "items": []
    },
    "autorenew": true,
    "tnleases": [
      {}
    ]
  }
}
```

{% endtab %}

{% tab title="401 " %}

```javascript
{
  "success": false,
  "message": "Not enough account balance",
  "status": 401
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "success": false,
  "message": "Not enough account balance",
  "status": 404
}
```

{% endtab %}
{% endtabs %}

### Code Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://api.opentact.org/rest/order/{uuid}" \
-H  "accept: application/json" -H  "X-Auth-Token: JWT_TOKEN"

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'accept' => 'application/json',
    'X-Auth-Token' => 'JWT_TOKEN'
);
$response = Requests::get('https://api.opentact.org/rest/order/{uuid}', $headers);

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'X-Auth-Token': 'JWT_TOKEN',
}

response = requests.get('https://api.opentact.org/rest/order/%7Buuid%7D', headers=headers)

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var fetch = require('node-fetch');

fetch('https://api.opentact.org/rest/order/{uuid}', {
    headers: {
        'accept': 'application/json',
        'X-Auth-Token': 'JWT_TOKEN'
    }
});

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("GET", "https://api.opentact.org/rest/order/{uuid}", nil)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("accept", "application/json")
	req.Header.Set("X-Auth-Token", "JWT_TOKEN")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

```

{% endtab %}
{% endtabs %}
