---
title: "Creates a key"
method: POST
path: "/apps/{app_id}/keys"
tags: ["keys"]
---

# Creates a key

`POST /apps/{app_id}/keys`

## Path parameters

- `app_id` string, required

## Request body

- KeyPost
  - `name` string, required
  - `revocableTokens` boolean, nullable
  - `capability` object, required

## Response `201`

Key created

- KeyResponse
  - `appId` string
  - `id` string
  - `name` string, nullable
  - `status` integer
  - `key` string
  - `revocableTokens` boolean, nullable
  - `capability` object
  - `created` integer
  - `modified` integer

## Other responses

- `400` — Bad request
- `401` — Authentication failed
- `404` — App not found
- `422` — Invalid request
- `500` — Internal server error

---

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