---
title: "Register a new Key under an Agent in an Organization."
method: POST
path: "/orgs/{orgId}/agents/{agentId}/keys"
tags: ["Agents", "public"]
---

# Register a new Key under an Agent in an Organization.

`POST /orgs/{orgId}/agents/{agentId}/keys`

## Path parameters

- `orgId` string, required
- `agentId` string, required

## Request body

- KeyCreateBody
  - `public_key` string, required — A pcks8 RSA public key PEM encoded (as the ones produced by openssl), whose module length is greater or equal than 4096 bits.

## Response `200`

Successful list response.

- Key — An object containing the details of a Key.
  - `fingerprint` string, required — The Key fingerprint (sha256 hash of the DER representation of the key).
  - `public_key` string, required — A pcks8 RSA ublic key PEM encoded.
  - `created_at` string, date-time, required — Time of the Key being registered.
  - `created_by` string, required — User ID of user that added the Key.
  - `expired_at` string, date-time, required — Time when the Key should be replaced (2 years after its creation).
  - `is_authorized` boolean, required — If this key has been authorized to be used to validate requests coming from an Agent.

## Other responses

- `400` — The request was invalid. More detail can be found in the error body.
- `404` — Either the resource or a related resource could not be found. More detail can be found in the error body.
- `409` — The request itself is valid however it could not be applied based on the current state of the resource. More detail can be found in the error body.

---

[API](https://skmtc.net/humanitec/apis/humanitec-api.md) · [All operations](https://skmtc.net/humanitec/apis/humanitec-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/humanitec/humanitec-api/revisions/e21ad140ec3c/schema)
