Create unit order

POST
https://www.digicert.com/services/v2/units/order

Use this endpoint to create a unit order. Unit orders allow you to buy units for the subaccounts you manage.

To buy units for a subaccount, the pricing method for the subaccount must be set to units. To get the pricing method for a subaccount, use the List subaccount products endpoint.

To create a unit order, the option to allow unit transfers must be enabled for your account. To find out if this option is enabled for your account, contact your account manager.

Example requests and responses

cURL
curl --request POST 'https://www.digicert.com/services/v2/units/order' \
--header 'X-DC-DEVKEY: {{api_key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "unit_account_id": {{unit_account_id}},
    "notes": "Notes about the order",
    "bundle": [
        {
            "product_name_id": "ssl_securesite_flex",
            "units": "5"
        },
		{
            "product_name_id": "ssl_ev_securesite_flex",
            "units": "20"
        }
    ]
}'
Python
import requests

url = "https://www.digicert.com/services/v2/units/order"

payload = "{\n    \"unit_account_id\": {{unit_account_id}},\n    \"notes\": \"For Testing Purpose\",\n    \"bundle\": [\n        {\n            \"product_name_id\": \"ssl_securesite_flex\",\n            \"units\": \"5\"\n        },\n\t\t{\n            \"product_name_id\": \"ssl_ev_securesite_flex\",\n            \"units\": \"20\"\n        }\n    ]\n}"
headers = {
  'X-DC-DEVKEY': {{api_key}},
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
Go
package main

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

func main() {

		url := "https://www.digicert.com/services/v2/units/order"
		method := "POST"

		payload := strings.NewReader("{\n    \"unit_account_id\": {{unit_account_id}},\n    \"notes\": \"For Testing Purpose\",\n    \"bundle\": [\n        {\n            \"product_name_id\": \"ssl_securesite_flex\",\n            \"units\": \"5\"\n        },\n		{\n            \"product_name_id\": \"ssl_ev_securesite_flex\",\n            \"units\": \"20\"\n        }\n    ]\n}")

		client := &http.Client {
		}
		req, err := http.NewRequest(method, url, payload)

		if err != nil {
				fmt.Println(err)
		}
		req.Header.Add("X-DC-DEVKEY", {{api_key}})
		req.Header.Add("Content-Type", "application/json")

		res, err := client.Do(req)
		defer res.Body.Close()
		body, err := ioutil.ReadAll(res.Body)

		fmt.Println(string(body))
}
NodeJS
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://www.digicert.com/services/v2/units/order',
  'headers': {
    'X-DC-DEVKEY': {{api_key}},
    'Content-Type': 'application/json'
  },
  body: "{\n    \"unit_account_id\": {{unit_account_id}},\n    \"notes\": \"For Testing Purpose\",\n    \"bundle\": [\n        {\n            \"product_name_id\": \"ssl_securesite_flex\",\n            \"units\": \"5\"\n        },\n\t\t{\n            \"product_name_id\": \"ssl_ev_securesite_flex\",\n            \"units\": \"20\"\n        }\n    ]\n}"

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
201 Created
{
  "id": 1371
}

Request parameters

Name Req/Opt Type Description
unit_account_id required integer ID of the subaccount to buy units for.
To get IDs for the subaccounts you manage, use the List subaccounts endpoint.
notes optional string Custom note to attach to the order.
Character limit: 512
bundle required array List of one or more objects with information about the amount of units to order for each type of product.
.. product_name_id required string Unique identifier for the product that you want to order units for.
Allowed values: See Glossary - Product identifiers.
.. units required integer Amount of units to order for the specified product.

Response parameters

Name Type Description
id integer ID of the order.