Skip to content

Tenant methods: invite, pin, provision, requestSetup

The Tenant Verbs invite, pin, provision, requestSetup as typed SDK methods, with inputs, result, refusals and an example.

Reference for Tenant, one group of Tenant methods.

Tenant.invite

Invite asks a Person to join a Customer’s Tenant, and resizes the Subscription when the Offer prices per member. Verb page.

TypeScript
interface TenantVerbs {
  invite(input: TenantInviteInput, options?: SB.CallOptions): SB.Call<TenantInviteOutput>
}

Emits Tenant.invited.

Inputs

InputTypeRequiredDescription
tenantTenantrequiredThe Customer’s Tenant.
emailemailrequiredWhere the invitation goes.

Returns

OutputTypeRequiredDescription
personPersonrequiredThe invited Person.
tenantTenantrequiredThe Tenant the Person was invited to.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const { person, tenant } = await $.Tenant.invite({ tenant: 'ten_Bu63f0he26', email: 'dana@leaseline.app' })

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.

TypeScript
interface TenantVerbs {
  pin(input: TenantPinInput, options?: SB.CallOptions): SB.Call<Tenant>
}

Emits Tenant.pinned.

Inputs

InputTypeRequiredDescription
tenantTenantrequiredThe Tenant whose keys move.
apiVersionstringrequiredThe version to answer at, such as v2, or latest to track the newest.

Returns

OutputTypeRequiredDescription
tenantTenantrequiredThe Tenant, answering at its new version.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse 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 versionrefusedClear what the check names, then call it again.None.

Example

TypeScript
import { $ } from 'startup-builder'

const tenant = await $.Tenant.pin({ tenant: 'ten_Bu63f0he26', apiVersion: 'v2' })

Tenant.provision

Provision creates a Customer’s Tenant in a Startup’s App, holding that Customer’s records apart from every other. Verb page.

TypeScript
interface TenantVerbs {
  provision(input: TenantProvisionInput, options?: SB.CallOptions): SB.Call<Tenant>
}

Emits Tenant.provisioned.

Inputs

InputTypeRequiredDescription
customerCustomerrequiredThe Customer the Tenant serves.

Returns

OutputTypeRequiredDescription
tenantTenantrequiredThe new Tenant.

Refuses when

CheckErrorFixThen call
The operation is part of an Offer the caller has not accepted or paid for.payment-requiredAccept the Offer named in the response, then retry the call.Offer.accept
The key is valid, but its scopes do not allow this operation.forbiddenUse 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.refusedRead the record, run the Verb that moves it to an allowed state, then retry.None.

Example

TypeScript
import { $ } from 'startup-builder'

const tenant = await $.Tenant.provision({ customer: 'cus_K1BROJhqzZ' })

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.

TypeScript
interface TenantVerbs {
  requestSetup(input: TenantRequestSetupInput, options?: SB.CallOptions): SB.Call<TenantRequestSetupOutput>
}

Emits Tenant.setupRequested.

Inputs

InputTypeRequiredDescription
tenantTenantrequiredThe Tenant to set up.
adminPersonrequiredThe Customer’s admin who receives the link.
intentstringrequiredWhat the link sets up.

Returns

OutputTypeRequiredDescription
linkurlrequiredThe single-use setup link, valid for 7 days.
tenantTenantrequiredThe Tenant being set up.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const { link, tenant } = await $.Tenant.requestSetup({ tenant: 'ten_Bu63f0he26', admin: 'person_sLqbXbW683', intent: 'sso' })