Create key

POST https://www.digicert.com/services/v2/key/user/{{user_id}}

Use this endpoint to create a new API key for a specific user.

The API key is shown only this one time in the creation response. It will never be shown again and there is no way to retrieve it if lost.

Example requests and responses

curl -X POST \
  'https://www.digicert.com/services/v2/key/user/{{user_id}}' \
  -H 'Content-Type: application/json' \
  -H 'X-DC-DEVKEY: {{api_key}}' \
  -d '{ "name": "New API Key" }'
import requests

url = "https://www.digicert.com/services/v2/key/user/{{user_id}}"

payload = "{\n  \"name\": \"New API Key\"\n}"

headers = {
    'X-DC-DEVKEY': "{{api_key}}",
    'Content-Type': "application/xml"
    }

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/services/v2/key/user/{{user_id}}"

    payload := strings.NewReader("{\n  \"name\": \"New API Key\"\n}")

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

    req.Header.Add("X-DC-DEVKEY", "{{api_key}}")
    req.Header.Add("Content-Type", "application/xml")

    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/services/v2/key/user/{{user_id}}',
  headers: 
   { 'Content-Type': 'application/xml',
     'X-DC-DEVKEY': '{{api_key}}' },
  body: '{\n  "name": "New API Key"\n}' };

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

  console.log(body);
});

201 Created

{
  "id": 184,
  "api_key": "Aqdgb0p5U153195f22s6pw5cj0mfvp06xg89xw0xhh3zhc2"
}

Request parameters

NameReq/OptTypeDescription
namerequiredstringName of the key.
restricted_to_role_idoptionalintTo limit API key permissions, specify the API key role ID.
Allowed values: 0, 100, 101, 102, 103. For more information, see Glossary – API key roles.

Response parameters

NameTypeDescription
idintUnique identifier for the created key.
api_keystringRandomly generated API key.