# Keys

## Create an identity key pair.

> This endpoint creates an identity key pair associated with the user's account for custodian-mode clients.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://studio-api.cheqd.net","description":"Main (production) server"},{"url":"https://studio-api-staging.cheqd.net","description":"Staging server for testing"},{"url":"http://localhost:3000","description":"Local server for testing"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"x-api-key","in":"header"}},"schemas":{"KeyResult":{"type":"object","properties":{"kid":{"type":"string"},"type":{"type":"string","enum":["Ed25519","Secp256k1"]},"publicKeyHex":{"type":"string"}}},"InvalidRequest":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}},"UnauthorizedError":{"description":"Access token is missing or invalid","type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/key/create":{"post":{"tags":["Keys"],"summary":"Create an identity key pair.","description":"This endpoint creates an identity key pair associated with the user's account for custodian-mode clients.","parameters":[{"name":"type","description":"Key type of the identity key pair to create.","in":"query","schema":{"type":"string","enum":["Ed25519"]}}],"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResult"}}}},"400":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}}}}}}}
```

## Import an identity key pair.

> This endpoint imports an identity key pair associated with the user's account for custodian-mode clients.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://studio-api.cheqd.net","description":"Main (production) server"},{"url":"https://studio-api-staging.cheqd.net","description":"Staging server for testing"},{"url":"http://localhost:3000","description":"Local server for testing"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"x-api-key","in":"header"}},"schemas":{"KeyImportRequest":{"type":"object","properties":{"alias":{"type":"string"},"type":{"type":"string","enum":["Ed25519","Secp256k1"]},"privateKeyHex":{"type":"string"}}},"KeyResult":{"type":"object","properties":{"kid":{"type":"string"},"type":{"type":"string","enum":["Ed25519","Secp256k1"]},"publicKeyHex":{"type":"string"}}},"InvalidRequest":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}},"UnauthorizedError":{"description":"Access token is missing or invalid","type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/key/import":{"post":{"tags":["Keys"],"summary":"Import an identity key pair.","description":"This endpoint imports an identity key pair associated with the user's account for custodian-mode clients.","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/KeyImportRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/KeyImportRequest"}}}},"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResult"}}}},"400":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}}}}}}}
```

## Fetch an identity key pair.

> This endpoint fetches an identity key pair's details for a given key ID. Only the user account associated with the custodian-mode client can fetch the key pair.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://studio-api.cheqd.net","description":"Main (production) server"},{"url":"https://studio-api-staging.cheqd.net","description":"Staging server for testing"},{"url":"http://localhost:3000","description":"Local server for testing"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"x-api-key","in":"header"}},"schemas":{"KeyResult":{"type":"object","properties":{"kid":{"type":"string"},"type":{"type":"string","enum":["Ed25519","Secp256k1"]},"publicKeyHex":{"type":"string"}}},"InvalidRequest":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}},"UnauthorizedError":{"description":"Access token is missing or invalid","type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/key/read/{kid}":{"get":{"tags":["Keys"],"summary":"Fetch an identity key pair.","description":"This endpoint fetches an identity key pair's details for a given key ID. Only the user account associated with the custodian-mode client can fetch the key pair.","parameters":[{"name":"kid","description":"Key ID of the identity key pair to fetch.","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResult"}}}},"400":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}}}}}}}
```

## Convert a key to a W3C Verification Method.

> This endpoint converts a stored key (by key ID) into a \[W3C Verification Method]\(<https://www.w3.org/TR/did-core/#verification-methods>) format.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://studio-api.cheqd.net","description":"Main (production) server"},{"url":"https://studio-api-staging.cheqd.net","description":"Staging server for testing"},{"url":"http://localhost:3000","description":"Local server for testing"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"x-api-key","in":"header"}},"schemas":{"VerificationMethod":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"controller":{"type":"string"},"publicKeyMultibase":{"type":"string"},"publicKeyJwk":{"type":"array","items":{"type":"string"}}}},"InvalidRequest":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}},"UnauthorizedError":{"description":"Access token is missing or invalid","type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/key/{kid}/verification-method":{"get":{"tags":["Keys"],"summary":"Convert a key to a W3C Verification Method.","description":"This endpoint converts a stored key (by key ID) into a [W3C Verification Method](https://www.w3.org/TR/did-core/#verification-methods) format.","parameters":[{"name":"kid","description":"Key ID of the identity key pair to convert.","in":"path","schema":{"type":"string"},"required":true},{"name":"verificationMethodType","description":"Type of verification method to use for the DID. See <a href=\"https://www.w3.org/TR/did-core/#verification-methods\">DID Core specification</a> for more details. Only the types listed below are supported.","in":"query","schema":{"type":"string","enum":["Ed25519VerificationKey2018","Ed25519VerificationKey2020","JsonWebKey2020"]},"required":true},{"name":"controller","description":"Controller DID of the verification method","in":"query","schema":{"type":"string"}},{"name":"id","description":"Verification Method Id Fragment","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationMethod"}}}},"400":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"404":{"description":"The key was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}},"500":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}}}}}}}
```


---

# 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.cheqd.io/product/api-reference/combined/keys.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.
