<!-- https://headless-lms.dev/docs/api/apps -->

# Apps

The frontends an organization runs, and the domain each is reached at

- [The app and organization of the domain the request comes from](https://headless-lms.dev/docs/api/apps/getApp): Public: no session and no key. Answers for the domain in the `Origin` header, or else the `Referer`; it takes no domain as a parameter. A frontend's server sends its visitor's domain as `Origin` and the visitor's IP address as `X-Forwarded-For`. 404 when the request carries no domain or the domain is no app's. Limited to 100 requests in 10 seconds per client IP address (429, with `Retry-After`).
- [The organization's apps](https://headless-lms.dev/docs/api/apps/listApps): Requires `organizations:read`. An app is a frontend the organization runs on a domain; it serves courses, the community, or both. Links in emails, invites and calendar files use the domain of the app that serves what the link is about.
- [Create an app](https://headless-lms.dev/docs/api/apps/createApp): Requires `organizations:write`. 409, with the reason as `error`: `domain_taken` when another app has the domain, in this organization or any other; `domain_reserved` when the domain is the admin app's, the API's or another listed origin of the installation; `slug_taken`; `courses_taken` or `community_taken` when the organization already has an app that serves it. 400 when the app would serve neither, or the domain is not a bare origin: a path, a query, a username or password, a wildcard or a trailing dot is refused.
- [Change an app](https://headless-lms.dev/docs/api/apps/updateApp): Requires `organizations:write`. Changes what is sent; the next link uses the new domain, and people sign in on it from the next request. 409 and 400 for the same reasons as creating an app, 400 also when the change would leave the app serving neither.
- [Delete an app](https://headless-lms.dev/docs/api/apps/deleteApp): Requires `organizations:write`. Its domain stops reaching the organization, and frees up for another app.
