Tenant routes: invite, pin, provision, requestSetup
The Tenant Verbs invite, pin, provision, requestSetup as api.sb routes, with inputs, result, refusals and an example.
Reference for Tenant, one group of Tenant routes.
Tenant.invite
Invite asks a Person to join a Customer’s Tenant, and resizes the Subscription when the Offer prices per member. Verb page.
POST /{namespace}/ tenants/ {tenant}/ invitePath: tenant. Body, as JSON: the other inputs. Emits Tenant.invited.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Customer’s Tenant. |
email | email | required | Where the invitation goes. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
person | Person | required | The invited Person. |
tenant | Tenant | required | The Tenant the Person was invited to. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ tenants/ ten_Bu63f0he26/ invite \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"email": "dana@leaseline.app"}'{
"api": "https: //api.sb/ leaseline.app",
"person": {
"$id": "https: //api.sb/ leaseline.app/ people/ person_oJZMe5UtCH",
"$type": "Person",
"name": "Dana Okafor"
},
"tenant": {
"$id": "https: //api.sb/ leaseline.app/ tenants/ ten_Bu63f0he26",
"$type": "Tenant",
"placement": "path",
"apiVersion": "v2"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Tenant.invite",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Tenant.pin
Pin moves a Tenant’s keys to another API version, or to latest, once a call with its test key passes there. Verb page.
POST /{namespace}/ tenants/ {tenant}/ pinPath: tenant. Body, as JSON: the other inputs. Emits Tenant.pinned.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Tenant whose keys move. |
apiVersion | string | required | The version to answer at, such as v2, or latest to track the newest. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Tenant, answering at its new version. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| Until a call with the Tenant’s test key succeeds at the target version | refused | Clear what the check names, then call it again. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ tenants/ ten_Bu63f0he26/ pin \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"apiVersion": "v2"}'{
"api": "https: //api.sb/ leaseline.app",
"tenant": {
"$id": "https: //api.sb/ leaseline.app/ tenants/ ten_Bu63f0he26",
"$type": "Tenant",
"placement": "path",
"apiVersion": "v2"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Tenant.pin",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Tenant.provision
Provision creates a Customer’s Tenant in a Startup’s App, holding that Customer’s records apart from every other. Verb page.
POST /{namespace}/ tenants/ provisionBody, as JSON: the inputs. Emits Tenant.provisioned.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
customer | Customer | required | The Customer the Tenant serves. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The new Tenant. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The operation is part of an Offer the caller has not accepted or paid for. | payment-required | Accept the Offer named in the response, then retry the call. | Offer.accept |
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ tenants/ provision \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"customer": "cus_K1BROJhqzZ"}'{
"api": "https: //api.sb/ leaseline.app",
"tenant": {
"$id": "https: //api.sb/ leaseline.app/ tenants/ ten_Bu63f0he26",
"$type": "Tenant",
"placement": "path",
"apiVersion": "v2"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Tenant.provision",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Tenant.requestSetup
RequestSetup sends a Customer’s admin a link to connect their own sign-in, directory or verified domain to the Tenant. Verb page.
POST /{namespace}/ tenants/ {tenant}/ requestSetupPath: tenant. Body, as JSON: the other inputs. Emits Tenant.setupRequested.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Tenant to set up. |
admin | Person | required | The Customer’s admin who receives the link. |
intent | string | required | What the link sets up. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
link | url | required | The single-use setup link, valid for 7 days. |
tenant | Tenant | required | The Tenant being set up. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ tenants/ ten_Bu63f0he26/ requestSetup \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"admin": "person_sLqbXbW683", "intent": "sso"}'{
"api": "https: //api.sb/ leaseline.app",
"link": "https: //leaseline.app",
"tenant": {
"$id": "https: //api.sb/ leaseline.app/ tenants/ ten_Bu63f0he26",
"$type": "Tenant",
"placement": "path",
"apiVersion": "v2"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Tenant.requestSetup",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}