Create Order

Creates a new DID Order to purchase phone numbers (DIDs) based on availability, reservations, or predefined stock-keeping units (SKUs). This request allows to order specific available DIDs, reserve numbers from a particular region, or request multiple DIDs in bulk.

Request

HTTP Method: POST

URI Path: /v3/orders

Body:

Name

Type

Is Required?

Description

allow_back_ordering

boolean

Optional

Allowing back ordering.

items

Array<CreateOrderItem>

Yes

Order items array.

callback_url

string

Optional

The HTTP or HTTPS endpoint to where events related to order will be delivered.

callback_method

string

Optional

The HTTP Method used for order events. POST, GET are supported methods.

Note

  • allow_back_ordering = true: Proceeds with the order when items are not in stock.

  • allow_back_ordering = false: Does not proceed with the order when items are not in stock.

See Callback details for information about callback_url and callback_method.

Order Item:

Name

Type

Is Required?

Description

type

string

Optional

Item object type: did_order_items for DIDs and capacity_order_items for Channels.

attributes

One of DID Order Item Attributes, Capacity Order Item Attributes

br

Optional

Order Item Attributes object.

Order Item Attributes:

Name

Type

Is Required?

Description

sku_id

string

Yes

Stock Keeping Unit ID. Should be used with one of optional parameters qty, available_did_id or did_reservation_id.

qty

integer

Yes

Quantity of DIDs.

did_reservation_id

string

Optional

Specific DID Reservation ID.

billing_cycles_count

integer

Optional

The number of Billing Cycles that this DID Number will renew until expiration.

available_did_id

string

Optional

Specific Available DID ID.

prorate_days_qty

integer

Optional

Amount of service time (days).

Attention

Please note that the prorate_days_qty attribute will be ignored if prorated billing is not enabled for your DIDWW account. To enable this billing option, please contact the Sales department via email at

Examples

http

POST /v3/orders HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API token]

{
  "data": {
    "type": "orders",
    "attributes": {
      "allow_back_ordering": true,
      "items": [
        {
          "type": "did_order_items",
          "attributes": {
            "qty": 15,
            "sku_id": "a78bb6d8-b05e-4e12-afe6-ad84ac979088"
          }
        }
      ]
    }
  }
}

curl

curl -i -X POST https://api.didww.com/v3/orders -H "Accept: application/vnd.api+json" -H "Api-Key: [API token]" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"attributes": {"allow_back_ordering": true, "items": [{"type": "did_order_items", "attributes": {"qty": 15, "sku_id": "a78bb6d8-b05e-4e12-afe6-ad84ac979088"}}]}, "type": "orders"}}'

response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "9eeaab6c-b758-41b8-af86-8978a86603a2",
    "type": "orders",
    "attributes": {
      "reference": "FZH-374899",
      "amount": "79.2",
      "status": "Pending",
      "created_at": "2017-06-25T14:56:31.513Z",
      "description": "DID",
      "items": [
        {
          "type": "did_order_items",
          "attributes": {
            "qty": 15,
            "nrc": "5.00",
            "mrc": "5.00",
            "prorated_mrc": true,
            "billed_from": "2018-08-15",
            "billed_to": "2018-09-15",
            "did_group_id": "d01704b0-6522-47d5-8865-3398c417ed1d"
          }
        }
      ]
    }
  }
}

http

POST /v3/orders HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API token]

{
  "data": {
    "type": "orders",
    "attributes": {
      "allow_back_ordering": false,
      "items": [
        {
          "type": "did_order_items",
          "attributes": {
            "available_did_id": "6c82282c-8193-43ca-9876-8ddef1ade253",
            "sku_id": "644c2449-0e23-4a67-9f81-565ad5137bb6",
            "prorate_days_qty": 10
          }
        }
      ]
    }
  }
}

curl

curl -i -X POST https://api.didww.com/v3/orders -H "Accept: application/vnd.api+json" -H "Api-Key: [API token]" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"attributes": {"allow_back_ordering": false, "items": [{"type": "did_order_items", "attributes": {"available_did_id": "6c82282c-8193-43ca-9876-8ddef1ade253", "sku_id": "644c2449-0e23-4a67-9f81-565ad5137bb6", "prorate_days_qty": 10}}]}, "type": "orders"}}'

response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

        {
    "data": {
        "id": "3276e7e6-559a-4344-95d8-1a83657f46ba",
        "type": "orders",
        "attributes": {
            "amount": "0.03",
            "status": "Pending",
            "created_at": "2022-03-04T07:45:24.471Z",
            "description": "DID",
            "reference": "EHF-778400",
            "items": [
                {
                    "type": "did_order_items",
                    "attributes": {
                        "qty": 1,
                        "nrc": "0.0",
                        "mrc": "0.03",
                        "prorated_mrc": true,
                        "billed_from": null,
                        "billed_to": null,
                        "setup_price": "0.0",
                        "monthly_price": "0.03",
                        "did_group_id": "239e74ad-9da1-4802-90dd-e1ce148da19e"
                    }
                }
            ],
            "callback_method": null,
            "callback_url": null
        }
    },
    "meta": {
        "api_version": "2021-12-15"
    }
}

Other Responses

Code

Success

Description

404

No

Not Found

401

No

Unauthorized