# Make a new client secret for an organisation's app

> Page: https://docs.plotwork.dev/api/post-orgs-org-apps-id-secret. Index of every page: https://docs.plotwork.dev/llms.txt

Makes a new secret for a confidential app, shown once; the old one stops working at once.

`POST /orgs/{org}/apps/{id}/secret`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Make a new client secret for an organisation's app. |
| What does it take? | `org`, `id` in the path. |
| What does it return? | Status 200 with a body of type [`AppWithSecret`](https://docs.plotwork.dev/api/schemas.md#appwithsecret). |
| What can go wrong? | `401` not signed in; `403` only the owner or an admin may (orgs.forbidden), or the origin may not make changes; `404` no such organisation or app; `422` the app is public and has no secret (apps.invalid); `429` too many requests; `503` organisations are not set up on this server. Every failure uses the one error envelope. |

## What it does

Makes a new secret for a confidential app, shown once; the old one stops working at once. The owner and an admin may.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `org` | `string` | yes | The organisation's id or its slug. |
| `id` | `string` | yes |  |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | The app with its new secret, shown once. | [`AppWithSecret`](https://docs.plotwork.dev/api/schemas.md#appwithsecret) |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | Only the owner or an admin may (orgs.forbidden), or the origin may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such organisation or app. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 422 | The app is public and has no secret (apps.invalid). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Organisations are not set up on this server. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 200 answer has the type [`AppWithSecret`](https://docs.plotwork.dev/api/schemas.md#appwithsecret).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes | The app's id, which is its OAuth client_id. |
| `name` | `string` | yes | Shown to people as a claim on the consent page. |
| `homepage` | `string \| null` | yes |  |
| `clientType` | `"confidential" \| "public"` | yes | confidential holds a client secret on its server; public (a page or a tool with no server) holds none. |
| `redirectUris` | `string[]` | yes |  |
| `membersOnly` | `boolean` | yes | For an organisation's app: only its members may connect it, to the organisation. |
| `hasSecret` | `boolean` | yes |  |
| `createdAt` | `integer` | yes | Milliseconds since the epoch. |
| `updatedAt` | `integer` | yes | Milliseconds since the epoch. |
| `clientSecret` | `string \| null` | yes | The client secret (pws_...), shown once, or null for a public app. Store it on your server. |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
