Help centerAPI referenceTenant context
Tenant context
Who the customer behind each domain is, sent signed to your origin.
Generate/rotate the signing secret
POST
/projects/{id}/tenant-secretdomains:writeSecret used to sign the X-Tenanci-Tenant header. It's only shown in this response: store it in your app's backend.
Parameters
idpath · stringrequiredResource id (prj_…, dom_…)
Request
cURL
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/tenant-secret" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 200
{
"secret": "tsk_Q2xv…"
}Get the domain's tenant
GET
/domains/{id}/tenantdomains:readParameters
idpath · stringrequiredResource id (prj_…, dom_…)
Request
cURL
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/tenant" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 200
{
"id": "barbearia-123",
"data": {
"name": "Barbearia do Zé",
"plan": "pro"
},
"expose": false,
"projectHasSecret": true
}Set the domain's tenant
PUT
/domains/{id}/tenantdomains:writeThe origin starts receiving X-Tenanci-Tenant (signed) on every request to this domain.
Parameters
idpath · stringrequiredResource id (prj_…, dom_…)
Body
idstring | nullCustomer id in your system (null removes it).
dataRecord<string, string | number | boolean | null>Customer data sent to the origin (name, plan…).
exposebooleanAlso expose as window.TENANCI in the browser.
Request
cURL
curl -X PUT "https://api.tenanci.com/v2/domains/dom_4h7n1q/tenant" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"id":"barbearia-123","data":{"name":"Barbearia do Zé","plan":"pro"},"expose":true}'Response 200
{
"id": "barbearia-123",
"data": {
"name": "Barbearia do Zé",
"plan": "pro"
},
"expose": true
}
