TenanciTenanci

Help centerIntegrations

Supabase, Xano, n8n and Make

Where to create customer portal links, register domains automatically and receive Tenanci events using Supabase, Xano, n8n or Make.

Front-end builders like WeWeb, Softr, Lovable and Bolt can't keep secrets. The Tenanci key has to live on a backend, and that's where portal links, automatic domain registration and reactions to events (say, emailing a customer when their domain goes live) happen. This guide shows how to do it on Supabase, Xano, n8n and Make.

The calls you'll use

All of them with a domains:write key, created under API keys and restricted to the project.

To Call
Portal link ("Connect domain" button) POST /projects/:id/portal/sessions
Register a customer's domain, customer included POST /domains with tenant
Update customer data (name, plan, colors) PUT /domains/:id/tenant

Supabase (Edge Function)

The path for Lovable, Bolt and WeWeb with Supabase. The function validates the user through the session and takes their customer from there, never from the browser.

  1. Store the key as a secret: supabase secrets set TENANCI_API_KEY=... (or Edge Functions → Secrets in the Supabase dashboard).
  2. Create supabase/functions/tenanci-portal/index.ts with the code below and adjust the tenantId line to your data model.
  3. Deploy with supabase functions deploy tenanci-portal.
  4. In the app, call it with supabase.functions.invoke("tenanci-portal") and open the response's url.
Edge Function
// supabase/functions/tenanci-portal/index.ts — creates the portal link for the logged-in user
import { createClient } from "npm:@supabase/supabase-js@2";

const cors = { "access-control-allow-origin": "*", "access-control-allow-headers": "authorization, content-type" };

Deno.serve(async (req) => {
  if (req.method === "OPTIONS") return new Response(null, { headers: cors });
  const supabase = createClient(Deno.env.get("SUPABASE_URL")!, Deno.env.get("SUPABASE_ANON_KEY")!, {
    global: { headers: { Authorization: req.headers.get("Authorization") ?? "" } },
  });
  const { data: { user } } = await supabase.auth.getUser();
  if (!user) return new Response("unauthorized", { status: 401, headers: cors });
  // the customer comes from the logged-in user, never from the browser (adjust to your data model)
  const tenantId = String(user.app_metadata?.tenant_id ?? user.id);
  const r = await fetch("https://api.tenanci.com/v2/projects/prj_8f3k2m/portal/sessions", {
    method: "POST",
    headers: { authorization: `Bearer ${Deno.env.get("TENANCI_API_KEY")}`, "content-type": "application/json" },
    body: JSON.stringify({ tenantId, tenantData: { name: user.user_metadata?.company ?? user.email }, returnUrl: req.headers.get("origin") ?? undefined }),
  });
  return new Response(await r.text(), { status: r.status, headers: { ...cors, "content-type": "application/json" } });
});

Xano

A good match for WeWeb: WeWeb calls a Xano endpoint, and Xano talks to Tenanci.

  1. Under Settings → Environment Variables, create TENANCI_API_KEY with your key.
  2. Create an endpoint (for example POST /tenanci/portal) with user authentication on.
  3. In the function stack, look up the authenticated user's customer in your database.
  4. Add an External API Request, click Import cURL and paste the call below.
  5. Replace the key in the header with $env.TENANCI_API_KEY, and tenantId/name with the customer data from step 3.
  6. Return the response's url field. In WeWeb, the button calls the endpoint and uses Navigate to with that url.
cURL (Xano, n8n)
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/portal/sessions" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"tenantId":"<tenantId>","tenantData":{"name":"<name>"},"returnUrl":"<returnUrl>"}'

n8n

Handy when the app has no backend (Softr, for example): the button opens an n8n webhook, which creates the link and redirects the customer.

  1. Create a workflow with a Webhook node (GET method). The button's link passes the customer id, for example https://n8n.yourdomain.com/webhook/tenanci-portal?customer=rec123.
  2. Check in your database that this customer exists and is active.
  3. Add an HTTP Request node, click Import cURL and paste the call above. Keep the key in a credential (Header Auth, name Authorization, value Bearer + the key) instead of leaving it in the node.
  4. Finish with Respond to Webhook, set Respond With to Redirect and use the response's url.

Make

The same flow as n8n, with Make modules:

  1. Webhooks → Custom webhook, receiving the customer id in the URL.
  2. Look up and check the customer in your database (Airtable, Google Sheets, your Softr data source…).
  3. HTTP → Make a request: method POST, URL https://api.tenanci.com/v2/projects/prj_8f3k2m/portal/sessions, header Authorization: Bearer + the key, a JSON body with tenantId, tenantData and returnUrl, and Parse response on.
  4. Webhooks → Webhook response with status 302 and a Location header set to the url from step 3.

Register domains automatically

If your system already knows the customer's domain (at sign-up or checkout), create the domain directly, with the customer attached. The response includes the DNS record (dns.type, dns.name, dns.values) for you to show or email.

curl -X POST "https://api.tenanci.com/v2/domains" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-48213" \
  -d '{"projectId":"prj_8f3k2m","hostname":"seasidehomes.com","tenant":{"id":"rec123","data":{"name":"Seaside Homes","plan":"pro"},"expose":true}}'

When the customer changes plan or name, update it with PUT /domains/:id/tenant. The new value reaches the domains within seconds.

Read the customer in your backend

If your backend is the project's origin (the address set on the project), every request that goes through Tenanci arrives with X-Tenanci-Tenant, X-Tenanci-Tenant-Data and, once the project has a secret, the X-Tenanci-Tenant-Signature signature. Generate the secret under project → Customization → Customer context signature and check the signature before trusting the value. Verification code (Node.js and Python) is in Customer context.

Receive events (webhooks)

To react without polling the API, register an endpoint under Organization → Webhooks (it can be an n8n Webhook node or a Make Custom webhook). The events are domain.created, domain.status_changed, domain.deleted and tailorkit.published, signed in the Tenanci-Signature header. A common use: when domain.status_changed shows the domain went live, send the customer a welcome email. Details in Webhooks.