--- title: "Create subaccount with API key" source_url: https://dev.digicert.com/partner-subscriptions-api/account-management/create-subaccount-with-api-key.html api_method: POST api_endpoint: "/partner-subscription/api/v1/account/subaccount" api_url: "https://www.digicert.com/partner-subscription/api/v1/account/subaccount" --- **POST** `https://www.digicert.com/partner-subscription/api/v1/account/subaccount` Use this endpoint to create a new partner subscriptions subaccount and generate an API key for that subaccount. > **Info** > > This endpoint requires a parent account Partner Subscriptions API key. Subaccounts cannot create their own subaccounts. > **Warning** > > Save the generated API key securely. The full API key value is displayed only once during creation. ## Example requests and responses **cURL** ```bash curl -X POST \ https://www.digicert.com/partner-subscription/api/v1/account/subaccount \ -H 'Content-Type: application/json' \ -H 'X-PARTNER-APIKEY: {{partner_api_key}}' \ -d '{ "api_key_name": "Production API Key", "name": "ACME Corporation Subaccount", "emergency_contact_emails": [ "security@example.com", "emergency@example.com" ] }' ``` **Python** ```python import requests url = "https://www.digicert.com/partner-subscription/api/v1/account/subaccount" payload = "{\n \"api_key_name\": \"Production API Key\",\n \"name\": \"ACME Corporation Subaccount\",\n \"emergency_contact_emails\": [\n \"security@example.com\",\n \"emergency@example.com\"\n ]\n}" headers = { 'X-PARTNER-APIKEY': "{{partner_api_key}}", 'Content-Type': "application/json" } response = requests.request("POST", url, data=payload, headers=headers) print(response.text) ``` **Go** ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://www.digicert.com/partner-subscription/api/v1/account/subaccount" payload := strings.NewReader("{\n \"api_key_name\": \"Production API Key\",\n \"name\": \"ACME Corporation Subaccount\",\n \"emergency_contact_emails\": [\n \"security@example.com\",\n \"emergency@example.com\"\n ]\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)) } ``` **NodeJS** ```javascript var request = require("request"); var options = { method: 'POST', url: 'https://www.digicert.com/partner-subscription/api/v1/account/subaccount', headers: { 'Content-Type': 'application/json', 'X-PARTNER-APIKEY': '{{partner_api_key}}' }, body: { api_key_name: 'Production API Key', name: 'ACME Corporation Subaccount', emergency_contact_emails: [ 'security@example.com', 'emergency@example.com' ] }, json: true }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` ## 201 Created ```json { "id": "67890", "name": "ACME Corporation Subaccount", "emergency_contact_emails": [ "security@example.com", "emergency@example.com" ], "api_key": { "id": 12345, "name": "Production API Key", "status": "active", "api_key": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz" } } ``` ## URL path and query parameters This endpoint does not use URL path or query parameters. ## Request parameters
| Name | Req/Opt | Type | Description |
|---|---|---|---|
| api_key_name | required | string | Descriptive name for the API key created for the new subaccount. Maximum: 128 characters. |
| name | required | string | Name of the new partner subscriptions subaccount. |
| emergency_contact_emails | required | array[string] | Emergency contact email addresses for the new subaccount. These email addresses are used for critical security or service-related notifications. |
| Name | Type | Description |
|---|---|---|
| id | string | Unique identifier of the new subaccount. |
| name | string | Name of the new subaccount. |
| emergency_contact_emails | array[string] | Emergency contact email addresses configured for the new subaccount. |
| api_key | object | API key object created for the new subaccount. |
| api_key.id | integer | Unique identifier of the API key. |
| api_key.name | string | Descriptive name of the API key. |
| api_key.status | string | Operational status of the API key. Allowed values: active, inactive |
| api_key.api_key | string | Full API key value generated for the new subaccount. |