# Create Key

`POST /keys`

Creates a key for the given scheme and curve. Returns a new key entity.&#x20;

{% hint style="info" %}

* User action signature required. See [User Action Signing](/d/api-docs/authentication/user-action-signing.md) for more information.
* Request headers required. See [Request Headers](/d/advanced-topics/authentication/request-headers.md) for more information.
* Authentication required. See [Authentication Headers](/d/advanced-topics/authentication/request-headers.md#authentication-headers) for more information.
  {% endhint %}

## Required Permissions

| Name            | Conditions                             |
| --------------- | -------------------------------------- |
| `Keys:Create`   | Always Required.                       |
| `Keys:Delegate` | Required if `delegateTo` is specified. |

## Request Body

| Field             | Description                                                                                                                                                             | Type - Optional      |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| `scheme`          | A supported `scheme`.                                                                                                                                                   | String               |
| `curve`           | A supported curve that's compatible with the chosen `scheme`.                                                                                                           | String               |
| `name`            | Name given to the key.                                                                                                                                                  | String *(optional)*  |
| `delegateTo`      | ID of the end user to delegate this key to upon creation. The key will be non-custodial and can only be used by the end user.                                           | String *(optional)*  |
| `delayDelegation` | Specify this if you want to create the key from a service account and [later delegate it to an end user](/d/api-docs/wallets/delegate-wallet.md).  Defaults to `false`. | Boolean *(optional)* |

### Example

```json
{
  "scheme": "ECDSA",
  "curve": "secp256k1"
}
```

## Response Body

| Field          | Description                                                                                      | Type - Optional      |
| -------------- | ------------------------------------------------------------------------------------------------ | -------------------- |
| `id`           | ID of the key.                                                                                   | String               |
| `scheme`       | Key scheme.                                                                                      | String               |
| `curve`        | Key curve.                                                                                       | String               |
| `publicKey`    | Hex-encoded value of public key.                                                                 | String               |
| `status`       | Status of the key, can be one of `Active`, `Archived`.                                           | String               |
| `custodial`    | Whether the wallet is owned by an end user (non-custodial), or by your organization (custodial). | Boolean              |
| `dateCreated`  | [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date string when wallet was created.          | String               |
| `imported`     | `true` if the key is imported.                                                                   | Boolean *(optional)* |
| `exported`     | `true` if the key was already exported at least once.                                            | Boolean *(optional)* |
| `dateExported` | [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date string when wallet was first exported.   | String *(optional)*  |

### 200 Success

```json
{
  "id": "key-6ece3-9l565-xxxxxxxxxxxxxxxx",
  "scheme": "ECDSA",
  "curve": "secp256k1",
  "publicKey": "02660461d66a637ea2d2ee3565669ad794f51ca3e0812ff03a0fe4820a19754839",
  "status": "Active",
  "custodial": true,
  "dateCreated": "2025-03-26T20:25:52.909Z"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-legacy.dfns.co/d/api-docs/keys/create-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
