Create API key for subaccount

POST https://www.digicert.com/partner-subscription/api/v1/api-key/account/{{accountId}}

Use this endpoint to create an API key for an existing subaccount.

Only parent accounts can create API keys for their subaccounts. Subaccounts cannot create API keys for other subaccounts.

Example requests and responses

curl -X POST \
  https://www.digicert.com/partner-subscription/api/v1/api-key/account/67891 \
  -H 'Content-Type: application/json' \
  -H 'X-PARTNER-APIKEY: {{partner_api_key}}' \
  -d '{
    "name": "Subaccount Production Key"
}'
import requests

url = "https://www.digicert.com/partner-subscription/api/v1/api-key/account/67891"

payload = "{\n  \"name\": \"Subaccount Production Key\"\n}"
headers = {
    'X-PARTNER-APIKEY': "{{partner_api_key}}",
    'Content-Type': "application/json"
    }

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

print(response.text)
package main

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

func main() {

	url := "https://www.digicert.com/partner-subscription/api/v1/api-key/account/67891"

	payload := strings.NewReader("{\n  \"name\": \"Subaccount Production Key\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-PARTNER-APIKEY", "{{partner_api_key}}")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
var request = require("request");

var options = {
  method: 'POST',
  url: 'https://www.digicert.com/partner-subscription/api/v1/api-key/account/67891',
  headers: {
    'Content-Type': 'application/json',
    'X-PARTNER-APIKEY': '{{partner_api_key}}'
  },
  body: {
    name: 'Subaccount Production Key'
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

201 Created

{
  "id": 12346,
  "name": "Subaccount Production Key",
  "api_key": "xyz789def456ghi123jkl456mno789pqr012stu345vwx678yz",
  "status": "active",
  "account_id": 67891
}

URL path and query parameters

NameReq/OptTypeDescription
accountIdrequiredintegerThe unique identifier of the subaccount.

Request parameters

NameReq/OptTypeDescription
namerequiredstringA descriptive name for the API key (maximum 200 characters).

Response parameters

NameTypeDescription
idintegerUnique identifier of the API key.
namestringDescriptive name of the API key.
api_keystringFull API key value returned when the API key is created.
statusstringOperational status of the API key.
Allowed values: active, inactive
account_idintegerIdentifier of the subaccount that owns the API key.