Upsert app
Create or update an app.
SuperTokens subscription license key is required.
The firstFactors can be set to following values:
null: When set tonull, all the login methods will be available for the app (public tenant).[](empty array): No login methods will be enabled for the app (public tenant).['factor1', 'factor2', ...](non-empty array): The list of login methods to enable for the app (public tenant). For eg. if this is set to['emailpassword', 'thirdparty'], the users of the tenant will be able to login using emailpassword and third party providers.
List of built-in first factors are as follows:
- Email password auth:
emailpassword - Social login / enterprise SSO auth:
thirdparty - Passwordless:
- With email OTP:
otp-email - With SMS OTP:
otp-phone - With email magic link:
link-email - With SMS magic link:
link-phone
- With email OTP:
If first factors are not specified while creating a new app, all the login methods will be enabled by default.
The requiredSecondaryFactors can be set to following values:
null: When set tonull, no secondary factors will be required for the users of the app (public tenant).['factor1', 'factor2', ...](non-empty array): The list of factors that the users of the app (public tenant) must complete post the first factor login. For eg. if this is set to['otp-phone', 'totp'], the users of the tenant will be required to complete either phone OTP or TOTP post the first factor login.
List of built-in secondary factors are as follows:
- Email password auth:
emailpassword - Social login / enterprise SSO auth:
thirdparty - Passwordless:
- With email OTP:
otp-email - With SMS OTP:
otp-phone - With email magic link:
link-email - With SMS magic link:
link-phone
- With email OTP:
- Time based OTP:
totp
If updating an existing app,
- core will keep the existing state of login methods and only update the ones that are specified in the request body.
- Core config will be merged into existing config. To delete a key in the config, use a null value
Note: the newly created app will use the same connection uri domain from which this request originates and the request must originate from public app and public tenant.
Note: Updation of core config is not allowed for the default connectionUriDomain, public app. In order to update config for the default connectionUriDomain and public app, you must edit the config.yaml or the docker env directly.
/recipe/multitenancy/app/v2api-keyAPI key · headerrequiredridstringcdi-versionstringapplication/jsonappIdstringrequiredfirstFactorsfirstFactorsrequiredSecondaryFactorsrequiredSecondaryFactorscoreConfigobjectstatusstatusOKrequiredOKcreatedNewbooleanrequiredstringstringstringstringstringTry it
curl -X PUT "/recipe/multitenancy/app/v2" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"appId": "app1",
"firstFactors": [
"emailpassword"
],
"requiredSecondaryFactors": [
"otp-phone"
],
"coreConfig": {}
}'const response = await fetch("/recipe/multitenancy/app/v2", {
method: "PUT",
headers: {
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"appId": "app1",
"firstFactors": [
"emailpassword"
],
"requiredSecondaryFactors": [
"otp-phone"
],
"coreConfig": {}
})
});import requests
response = requests.put(
"/recipe/multitenancy/app/v2",
headers={
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"appId": "app1",
"firstFactors": [
"emailpassword"
],
"requiredSecondaryFactors": [
"otp-phone"
],
"coreConfig": {}
},
){
"status": "OK",
"createdNew": true
}"string""Invalid API key""License Error""Not Found""Internal Error"