Add application secret

POST /api/applications/{id}/secrets

Add a new secret for the application.

Path parameters

  • id string Required

    The unique identifier of the application.

application/json

Body Required

  • name string Required

    The secret name. Must be unique within the application.

    Minimum length is 1, maximum length is 256.

  • expiresAt number | null

    The epoch time in milliseconds when the secret will expire. If not provided, the secret will never expire.

Responses

  • 201 application/json

    The secret was added successfully.

    Hide response attributes Show response attributes object
    • tenantId string Required

      Maximum length is 21.

    • applicationId string Required

      Minimum length is 1, maximum length is 21.

    • name string Required

      Minimum length is 1, maximum length is 256.

    • value string Required

      Minimum length is 1, maximum length is 64.

    • createdAt number Required
    • expiresAt number | null Required
  • Bad Request

  • Unauthorized

  • Forbidden

  • The secret name is already in use.

POST /api/applications/{id}/secrets
curl \
 -X POST https://[tenant_id].logto.app/api/applications/{id}/secrets \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"name":"string","expiresAt":42.0}'
Request examples
{
  "name": "string",
  "expiresAt": 42.0
}
Response examples (201)
{
  "tenantId": "string",
  "applicationId": "string",
  "name": "string",
  "value": "string",
  "createdAt": 42.0,
  "expiresAt": 42.0
}