---
search:
  tags:
    - OAuth applications
    - POST
seo:
  description: >-
    Creates a secret for the application, to… Reference for the POST
    /organizations/{organizationId}/oauth-clients/{clientId}/secrets endpoint in
    the Auth API.
sidebar:
  label: Create a client secret
  badge: POST
title: Create a client secret
type: openapi-operation
---
Creates a secret for the application, to start using secrets or to rotate them. Requires organization:update. Only this response holds the secret. An application holds at most 5 active secrets (409).

`POST /organizations/{organizationId}/oauth-clients/{clientId}/secrets`

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

- `expires_at` (string<date-time>) — When the secret stops authenticating the client, in the future. Without it the secret does not expire.

Request body example:

```json
{
  "expires_at": "2019-08-24T14:15:22Z"
}
```

**Responses**

- `201` — The new secret, with its value.
- `default` — The request failed.

Response example, 201:

```json
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "secret": "string",
  "hint": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "revoked_at": "2019-08-24T14:15:22Z"
}
```
