# Register an app for an organisation

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

Registers an app for the organisation.

`POST /orgs/{org}/apps`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Register an app for an organisation. |
| What does it take? | A JSON body of type [`NewOrgAppBody`](https://docs.plotwork.dev/api/schemas.md#neworgappbody). |
| What does it return? | Status 201 with a body of type [`AppWithSecret`](https://docs.plotwork.dev/api/schemas.md#appwithsecret). |
| What can go wrong? | `400` the body is not valid; `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 the caller is not a member of it; `409` the organisation holds the most apps allowed (apps.limit_reached); `422` a redirect address or the homepage breaks the rules (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

Registers an app for the organisation. The owner and an admin may. With membersOnly, only its members may connect it, to the organisation. A confidential app gets a client secret, shown once.

## Path parameters

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

## Request body

The body has the type [`NewOrgAppBody`](https://docs.plotwork.dev/api/schemas.md#neworgappbody).

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | yes | at least 3 characters; at most 60 characters. |
| `homepage` | `string \| null` | no | An https address, shown as a claim. at most 2048 characters. |
| `clientType` | `"confidential" \| "public"` | yes |  |
| `redirectUris` | `string[]` | yes | One to ten addresses a code may be sent to, matched exactly: https, or http on localhost, 127.0.0.1 or [::1] with any port. |
| `membersOnly` | `boolean` | no |  |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 201 | Registered, with the secret shown once. | [`AppWithSecret`](https://docs.plotwork.dev/api/schemas.md#appwithsecret) |
| 400 | The body is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 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 the caller is not a member of it. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 409 | The organisation holds the most apps allowed (apps.limit_reached). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 422 | A redirect address or the homepage breaks the rules (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 201 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 |
