Skip to content
Esc
navigateopen⌘Jpreview
Dashboard

Upsert connection uri domain

Create or update a connection uri domain.

SuperTokens subscription license key is required, if not using the base connection uri domain.

This request must originate from public app and public tenant on the base connection uri domain.

The firstFactors can be set to following values:

  • null: When set to null, all the login methods will be available for the connection URI domain (public app, public tenant).
  • [] (empty array): No login methods will be enabled for the connection URI domain (public app, public tenant).
  • ['factor1', 'factor2', ...] (non-empty array): The list of login methods to enable for the connection URI domain (public 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

If first factors are not specified while creating a new connection uri domain, all the login methods will be enabled by default.

The requiredSecondaryFactors can be set to following values:

  • null: When set to null, no secondary factors will be required for the users of the connection URI domain (public app, public tenant).
  • ['factor1', 'factor2', ...] (non-empty array): The list of factors that the users of the connection URI domain (public 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
  • Time based OTP: totp

If updating an existing connection uri domain,

  1. core will keep the existing state of login methods and only update the ones that are specified in the request body.
  2. Core config will be merged into existing config. To delete a key in the config, use a null value

Note: The core config must contain a unique connection to the storage layer, because sharing of database between 2 different connection uri domains is not allowed.

Note: Updation of core config is not allowed for the default connectionUriDomain. In order to update config for the default connectionUriDomain, you must edit the config.yaml or the docker env directly.

PUT/recipe/multitenancy/connectionuridomain/v2
Authorization
api-keyAPI key · headerrequired
The core service API token. If you are using a self-hosted core service and you have not generated a token, you can omit the header.
Header parameters
ridstring
cdi-versionstring
X.Y of the X.Y.Z CDI version.
Request body
application/json
connectionUriDomainstringrequired
firstFactorsfirstFactors
requiredSecondaryFactorsrequiredSecondaryFactors
coreConfigobject
Responses
200Create or Update connection uri domain result
statusstatusOKrequired
Allowed:OK
createdNewbooleanrequired
400error code 400
string
401error code 401
string
402error code 402
string
404error code 404
string
500error code 500
string
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X PUT "/recipe/multitenancy/connectionuridomain/v2" \
  -H "api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "connectionUriDomain": "core-1234.supertokens.io:3567",
  "firstFactors": [
    "emailpassword"
  ],
  "requiredSecondaryFactors": [
    "otp-phone"
  ],
  "coreConfig": {}
}'
Response
{
  "status": "OK",
  "createdNew": true
}

API reference

API schema and response details