---
title: "Generates a new API key."
method: POST
path: "/accessmanagement/api-key"
tags: ["accessmanagement - api keys"]
---

# Generates a new API key.

`POST /accessmanagement/api-key`

## Request

- Base URL: `https://manager.digicertdns.com/v1`
- URL: `https://manager.digicertdns.com/v1/accessmanagement/api-key`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/digicert/apis/digicert-dns/docs/accessmanagement/api-key/post.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint generates a new API key, allowing users to securely authenticate new applications or services.</br></br>Key features include:</br></br>- **Clear success messaging:** Returns a `200` success code with a confirmation message indicating the successful completion of the requested action.</br>- **Comprehensive error handling:** Returns a `400` error code with a clear description when requests fail.</br>- **Seamless API key generation:** Facilitates the generation of an API key in-line with the appropriate schema, ensuring smooth and efficient organization.

## Request body

- ApiKeyCreateRequest
  - `name` string, required
  - `note` string, nullable
  - `expirationDate` string, date-time, nullable: Must be specified if 'expire' is set to true
  - `expire` boolean, required
  - `type` 'USER' | 'SERVICE', required
  - `roles` ApiKeyCreateRequestRoles[]: Optional field for Service Keys only to assign roles during creation
    - `id` integer: Role Ids to Assign to the Service Key

## Response `200`

API key generated successfully.

- ApiKeyCreateResponse
  - `id` string
  - `name` string
  - `apiKey` string
  - `expirationDate` string, date-time, nullable
  - `expire` boolean
  - `note` string, nullable
  - `status` 'ACTIVE' | 'DISABLED' | 'EXPIRED'
  - `lastUsedTs` string, date-time
  - `createdTs` string, date-time
  - `modifiedTs` string, date-time
  - `type` 'USER' | 'SERVICE'
  - `roles` ServiceKeyResponseFieldsRoles[]
    - `id` integer
    - `name` string
    - `description` string
  - `resourceGroups` ServiceKeyResponseFieldsResourceGroups[]
    - `id` integer
    - `name` string
    - `description` string
    - `isDefault` boolean
  - `userGroups` ServiceKeyResponseFieldsUserGroups[]
    - `id` integer
    - `name` string
    - `description` string
    - `isDefault` boolean

## Other responses

- `400`: Request is malformed or invalid.

---

[API](https://skmtc.dev/digicert/apis/digicert-dns.md) - [All operations](https://skmtc.dev/digicert/apis/digicert-dns/llms.txt) - [OpenAPI document](https://skmtc.dev/digicert/apis/digicert-dns/revisions/c74fc728cff8?raw)
