Example API Usage

Leverage Opentact to seamlessly acquire numbers throughout the United States and Canada through our RESTful API.

Order a Number

Once you've utilized the Number Search API to identify an available number, seamlessly proceed to purchase it using the API, streamlining the entire process for your convenience.

Here is how you use API to order phone numbers:

  curl -X 'POST' \
  'https://api.opentact.org/rest/order' \
  -H 'accept: application/json' \
  -H 'X-Auth-Token: "YOUR_API_KEY" 
  -H 'Content-Type: application/json' \
  -d '{
  "items": [
    {
      "tn": 12029822917,
      "features": [
        "voice",
        "sms"
      ],
      "autorenew": true
    }
  ]
}'

Request URL

https://api.opentact.org/rest/order

Here is the response:

Response code: 201
  {
  "success": true,
  "payload": {
    "uuid": "c5cc6326-0023-43d8-81a5-e7b7e019919d",
    "state": "success",
    "created_on": "2024-01-16T14:15:49.037Z",
    "modified_on": "2024-01-16T14:15:49.037Z",
    "total": 10,
    "success": 10,
    "processing": 0,
    "failed": 0
  }
}

Retrieve All Order

Upon utilizing the Order Number API mentioned earlier, you will receive a unique order uuid. To efficiently manage and track all your number orders, you can employ the following API to query comprehensive information regarding your order history. This streamlined approach ensures a seamless and organized overview of your acquired numbers through Opentact.

curl -X 'POST' \
  'https://api.opentact.org/rest/order/search?take=10&skip=0' \
  -H 'accept: application/json' \
  -H 'X-Auth-Token: "YOUR_API_KEY" 
  -H 'Content-Type: application/json' \
  -d '{
  "state": "success",
  "order": {
    "created_on": "DESC"
  }
}'

Request URL

https://api.opentact.org/rest/order/search?take=10&skip=0

Sample Response

Response code : 200
{
  "success": true,
  "payload": {
    "take": 1,
    "skip": 0,
    "total": 1000,
    "data": [
      {
        "uuid": "c5cc6326-0023-43d8-81a5-e7b7e019919d",
        "state": "success",
        "created_on": "2024-01-16T14:15:49.034Z",
        "modified_on": "2024-01-16T14:15:49.034Z",
        "total": 10,
        "success": 10,
        "processing": 0,
        "failed": 0
      }
    ]
  }
}

Lookup a Specific Order

If you possess the number_order_uuid, utilize the following API to check the order status and retrieve the comprehensive list of purchased numbers once the order process concludes. This ensures real-time visibility into the status and details of your order, providing a seamless and efficient way to track and manage your acquired numbers through Opentact.

curl -X 'GET' \
  'https://api.opentact.org/rest/order/f5e6ae94-8d20-4649-ada9-d2fef5bb3e49' \
  -H 'accept: application/json' \
  -H 'X-Auth-Token: "YOUR_API_KEY"
  
Request URL
https://api.opentact.org/rest/order/f5e6ae94-8d20-4649-ada9-d2fef5bb3e49

Sample Response

Response code: 200
{
  "success": true,
  "payload": {
    "uuid": "c5cc6326-0023-43d8-81a5-e7b7e019919d",
    "state": "success",
    "created_on": "2024-01-16T14:15:49.038Z",
    "modified_on": "2024-01-16T14:15:49.038Z",
    "total": 10,
    "success": 10,
    "processing": 0,
    "failed": 0,
    "account": {
      "created_on": "2024-01-16T14:15:49.038Z",
      "modified_on": "2024-01-16T14:15:49.038Z",
      "uuid": "f2cb79fb-6bf8-4484-8034-debf95aac73b",
      "email": "info@denovolab.com",
      "name": "DENOVOLAB",
      "level": "Level0",
      "deleted_on": null,
      "balance": 99.87895
    },
    "created_by": {
      "uuid": "0116f6d1-1280-44b2-9134-da48509ec575",
      "email": "info@opentact.org",
      "wss_online": true,
      "role": "User",
      "created_on": "2024-01-16T14:15:49.038Z",
      "modified_on": "2024-01-16T14:15:49.038Z",
      "deleted_on": null,
      "phone_number": "+1234567890",
      "dob": "2024-01-16T14:15:49.038Z",
      "avatar": "https://google/image.png",
      "first_name": "First Name",
      "last_name": "Last Name",
      "gender": "Female"
    },
    "tn_items": [
      {
        "created_on": "2024-01-16T14:15:49.038Z",
        "modified_on": "2024-01-16T14:15:49.038Z",
        "uuid": "77a25843-41f5-473d-bc51-5a9b5ccaf7d9",
        "state": "success",
        "reason": "Complete",
        "autorenew": true,
        "request": {
          "tn": 12017771234
        },
        "features": [
          "sms",
          "voice"
        ],
        "context": "a2p",
        "tn": {
          "tn": 12017771234,
          "created_on": "2024-01-16T14:15:49.038Z",
          "modified_on": "2024-01-16T14:15:49.038Z",
          "deleted_on": null
        }
      },
      {
        "created_on": "2024-01-16T14:15:49.038Z",
        "modified_on": "2024-01-16T14:15:49.038Z",
        "uuid": "77a25843-41f5-473d-bc51-5a9b5ccaf7d9",
        "state": "failed",
        "reason": "Error buying a number",
        "autorenew": true,
        "request": {
          "tn": 12017771234
        },
        "features": [
          "sms",
          "voice"
        ],
        "context": "a2p",
        "tn": {
          "tn": 12017771234,
          "created_on": "2024-01-16T14:15:49.039Z",
          "modified_on": "2024-01-16T14:15:49.039Z",
          "deleted_on": null
        }
      }
    ],
    "tn_leases": []
  }
}

Last updated