---
search:
  tags:
    - App keys
    - POST
seo:
  description: >-
    Makes another publishable key or secret token for a tenant, with its own
    rules:… Reference for the POST /_luna/tenants/{tenant}/keys endpoint in the
    Luna API.
sidebar:
  label: Create an app key
  badge: POST
title: Create an app key
type: openapi-operation
---
Makes another publishable key or secret token for a tenant, with its own rules: the origins it works from, how fast it can call, the luna types it reaches and when it expires. A secret token is shown once, in this response.

`POST /_luna/tenants/{tenant}/keys`

**Request body** (`application/json`, required)

- `kind` (string | null) — \`publishable\`, which is the default, or \`secret\`. Only read when a key is made.
- `name` (string | null) — A name to tell the key by.
- `origins` (string[] | null) — The origins a browser can use the key from, such as \`https://app.example.com\`. Empty means any origin.
- `ratePerSecond` (number<double> | null) — The most requests a second the key can make. More than 0.
- `types` (string[] | null) — The luna types the key can call. Empty sets no such limit.
- `expiresIn` (integer<int64> | null) — How long the key works, in seconds from now.

Request body example:

```json
{
  "kind": null,
  "name": null,
  "origins": null,
  "ratePerSecond": null,
  "types": null,
  "expiresIn": null
}
```

**Responses**

- `200` — The new key.
- `default` — The request failed. The status says how and \`error.message\` says why.

Response example, 200:

```json
{
  "id": "string",
  "kind": "string",
  "key": "string"
}
```
