---
title: "Add application secret"
method: POST
path: "/api/applications/{id}/secrets"
tags: ["Applications"]
---

# Add application secret

`POST /api/applications/{id}/secrets`

Add a new secret for the application.

## Path parameters

- `id` string, required

## Request body

- object
  - `name` string, required — The secret name. Must be unique within the application.
  - `expiresAt` number, nullable — The epoch time in milliseconds when the secret will expire. If not provided, the secret will never expire.

## Response `201`

The secret was added successfully.

- object
  - `tenantId` string, required
  - `applicationId` string, required
  - `name` string, required
  - `value` string, required
  - `createdAt` number, required
  - `expiresAt` number, nullable, required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `422` — The secret name is already in use.
- `500` — Internal Server Error

---

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