Overview
Apps represent separate applications or environments within your SuperTokens instance. Each app contains one or more tenants and can have its own configuration.PUT /recipe/multitenancy/app
Create or update an application.Request Body
Parameters
- appId (string, optional): Unique identifier for the app. If not provided, defaults to “public”
- emailPasswordEnabled (boolean, optional): Enable email/password authentication for all tenants in this app
- passwordlessEnabled (boolean, optional): Enable passwordless authentication for all tenants in this app
- thirdPartyEnabled (boolean, optional): Enable third-party (social) authentication for all tenants in this app
- coreConfig (object, optional): App-specific configuration that applies to all tenants
Response
- createdNew:
trueif a new app was created,falseif existing app was updated
Example
GET /recipe/multitenancy/app/list
List all apps in the current connection URI domain. Note: This endpoint can only be called from the public tenant of the public app.Response
Example
DELETE /recipe/multitenancy/app
Remove an app and all its tenants.Request Body
Response
- didExist:
trueif the app existed and was deleted,falseif it didn’t exist
Example
Implementation Details
- Located in:
src/main/java/io/supertokens/webserver/api/multitenancy/CreateOrUpdateAppAPI.java:36andListAppsAPI.java:43 - Recipe:
MULTITENANCY - App IDs are normalized and validated before use
- The public app (ID: “public”) is created automatically
- Each app automatically gets a public tenant on creation
- Configuration is inherited by tenants within the app
- Protected configuration values can be hidden based on API key permissions
App vs Tenant Configuration
App-level Configuration
Configuration set at the app level applies to all tenants within that app:- Core settings (token validity, password policy, etc.)
- Enabled authentication methods
- Default third-party providers
Tenant-level Overrides
Tenants can override app-level configuration:- Enable/disable specific authentication methods
- Configure tenant-specific providers
- Customize token validity and other settings
Use Cases
Multiple Environments
Create separate apps for different deployment environments:Multi-product Company
Separate apps for different products:Permissions
- Listing apps: Only allowed from the public tenant of the public app
- Creating/updating apps: Must be done from the public tenant context
- Deleting apps: The public app cannot be deleted
Best Practices
- Use descriptive app IDs that indicate purpose (e.g., “production”, “api-v2”)
- Configure common settings at the app level to avoid repetition
- Keep the number of apps minimal - use tenants for isolation within an app
- Document your app structure and intended use
- Use separate apps for completely isolated environments (prod/staging)
- Back up app configuration before making changes
Connection URI Domains
Apps are grouped under connection URI domains. In most deployments, you’ll have a single connection URI domain. For more complex setups:- PUT /recipe/multitenancy/connectionuridomain - Create or update a connection URI domain
- GET /recipe/multitenancy/connectionuridomain/list - List all connection URI domains
- DELETE /recipe/multitenancy/connectionuridomain - Remove a connection URI domain