Help centerAPI referenceAuthMesh & API Gateway
AuthMesh & API Gateway
Third-party API calls without exposing the key (AuthMesh) and a gateway for your own APIs (Scale plan).
List AuthMesh services
/projects/{p}/authmeshprojects:readScale+The secret is never returned (hasCredential tells whether there is one). activationProblems lists what's missing before the service can be turned on.
Parameters
ppath · stringrequiredProject id (prj_…)
Request
curl "https://api.tenanci.com/v2/projects/prj_8f3k2m/authmesh" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 200
{
"items": [
{
"id": "id_01JA3M7Q2K8W4N6P9R1T5V3X0Z",
"orgId": "org_5t1v",
"projectId": "prj_8f3k2m",
"slug": "asaas",
"name": "Cobranças (Asaas)",
"upstreamBaseUrl": "https://api.asaas.com/v3",
"enabled": true,
"credentialKind": "header",
"credentialName": "access_token",
"allowedMethods": [
"GET",
"POST"
],
"allowedPaths": [
"/payments/*",
"/customers"
],
"callerAuth": "jwt",
"jwksUrl": "https://app.agendafacil.com/.well-known/jwks.json",
"jwtIssuer": "https://app.agendafacil.com",
"jwtAudience": "agendafacil",
"introspectionUrl": null,
"allowedOrigins": [
"https://barbeariadoze.com.br"
],
"rateLimitPerMin": 60,
"maxBodyKb": 256,
"legacyBubbleId": null,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:20:00.000Z",
"deletedAt": null,
"hasCredential": true,
"activationProblems": []
}
]
}Create an AuthMesh service
/projects/{p}/authmeshprojects:writeScale+The API secret stays at Tenanci and the edge injects it into browser calls to https://<domain>/__tenanci/mesh/<slug>/<path> → <upstream>/<path>. The service starts off: turn it on with PATCH after setting the credential, allowed paths and caller authentication. Duplicate slug: 409 slug_taken.
Parameters
ppath · stringrequiredProject id (prj_…)
Body
slugstringrequiredIdentifier in the /__tenanci/mesh/<slug>/… address (2–40 characters a-z, 0-9, -). Unique within the project.
upstreamBaseUrlstringrequiredhttps URL of the target API (internal hosts and IPs are rejected).
namestringA name you'll recognize (up to 80 characters).
credentialobjectCredential the edge injects into every upstream call.
kind"header" | "bearer" | "basic" | "query"requiredHow the credential is sent upstream: custom header, Authorization: Bearer, Basic or query parameter.
namestring | nullHeader or parameter name (required for header and query).
secretstringrequiredThe API secret. It's stored encrypted at Tenanci and never returned.
allowedMethodsstring[]Allowed methods: GET, POST, PUT, PATCH, DELETE (default GET only).
allowedPathsstring[]≤ 100 itensAllowed upstream paths (start with /). "/x" matches /x and everything below; "/x/*" only what's below. Nothing is allowed by default.
callerAuth"public" | "jwt" | "session_introspection"How the caller proves who they are: user JWT (default), session introspection on your backend, or public.
jwksUrlstring | nullhttps URL of the JWKS that validates the JWT (callerAuth jwt).
jwtIssuerstring | nullExpected issuer (iss) in the JWT.
jwtAudiencestring | nullExpected audience (aud) in the JWT.
introspectionUrlstring | nullhttps URL on your backend that confirms the session (callerAuth session_introspection).
allowedOriginsstring[]≤ 20 itenshttps origins allowed to call the service from the browser.
rateLimitPerMininteger≥ -9007199254740991, ≤ 9007199254740991Calls per minute (1 to 100,000; default 60).
maxBodyKbinteger≥ -9007199254740991, ≤ 9007199254740991Max body size in KB (1 to 10,240; default 256).
Request
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/authmesh" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"slug":"asaas","name":"Cobranças (Asaas)","upstreamBaseUrl":"https://api.asaas.com/v3","credential":{"kind":"header","name":"access_token","secret":"$aact_prod_000Mz…"},"allowedMethods":["GET","POST"],"allowedPaths":["/payments/*","/customers"],"callerAuth":"jwt","jwksUrl":"https://app.agendafacil.com/.well-known/jwks.json","jwtIssuer":"https://app.agendafacil.com","allowedOrigins":["https://barbeariadoze.com.br"]}'Response 201
{
"id": "id_01JA3M7Q2K8W4N6P9R1T5V3X0Z",
"orgId": "org_5t1v",
"projectId": "prj_8f3k2m",
"slug": "asaas",
"name": "Cobranças (Asaas)",
"upstreamBaseUrl": "https://api.asaas.com/v3",
"enabled": false,
"credentialKind": "header",
"credentialName": "access_token",
"allowedMethods": [
"GET",
"POST"
],
"allowedPaths": [
"/payments/*",
"/customers"
],
"callerAuth": "jwt",
"jwksUrl": "https://app.agendafacil.com/.well-known/jwks.json",
"jwtIssuer": "https://app.agendafacil.com",
"jwtAudience": null,
"introspectionUrl": null,
"allowedOrigins": [
"https://barbeariadoze.com.br"
],
"rateLimitPerMin": 60,
"maxBodyKb": 256,
"legacyBubbleId": null,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z",
"deletedAt": null,
"hasCredential": true
}Update an AuthMesh service
/projects/{p}/authmesh/{id}projects:writeScale+To turn it on (enabled: true) the service needs a credential, at least one allowed path and caller authentication configured; otherwise 422 authmesh_policy_required with what's missing in details. A public service (callerAuth: public) requires acknowledgePublic: true.
Parameters
ppath · stringrequiredProject id (prj_…)
idpath · stringrequiredAuthMesh service id
Body
slugstringIdentifier in the /__tenanci/mesh/<slug>/… address (2–40 characters a-z, 0-9, -). Unique within the project.
upstreamBaseUrlstringhttps URL of the target API (internal hosts and IPs are rejected).
namestringA name you'll recognize (up to 80 characters).
credentialobjectCredential the edge injects into every upstream call.
kind"header" | "bearer" | "basic" | "query"requiredHow the credential is sent upstream: custom header, Authorization: Bearer, Basic or query parameter.
namestring | nullHeader or parameter name (required for header and query).
secretstringrequiredThe API secret. It's stored encrypted at Tenanci and never returned.
allowedMethodsstring[]Allowed methods: GET, POST, PUT, PATCH, DELETE (default GET only).
allowedPathsstring[]≤ 100 itensAllowed upstream paths (start with /). "/x" matches /x and everything below; "/x/*" only what's below. Nothing is allowed by default.
callerAuth"public" | "jwt" | "session_introspection"How the caller proves who they are: user JWT (default), session introspection on your backend, or public.
jwksUrlstring | nullhttps URL of the JWKS that validates the JWT (callerAuth jwt).
jwtIssuerstring | nullExpected issuer (iss) in the JWT.
jwtAudiencestring | nullExpected audience (aud) in the JWT.
introspectionUrlstring | nullhttps URL on your backend that confirms the session (callerAuth session_introspection).
allowedOriginsstring[]≤ 20 itenshttps origins allowed to call the service from the browser.
rateLimitPerMininteger≥ -9007199254740991, ≤ 9007199254740991Calls per minute (1 to 100,000; default 60).
maxBodyKbinteger≥ -9007199254740991, ≤ 9007199254740991Max body size in KB (1 to 10,240; default 256).
enabledbooleanTurns the service on or off at the edge.
acknowledgePublicbooleanConfirms any visitor will be able to use the credential within the allowed paths (required to turn on with callerAuth public).
Request
curl -X PATCH "https://api.tenanci.com/v2/projects/prj_8f3k2m/authmesh/prj_8f3k2m" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"enabled":true,"jwtAudience":"agendafacil"}'Response 200
{
"id": "id_01JA3M7Q2K8W4N6P9R1T5V3X0Z",
"orgId": "org_5t1v",
"projectId": "prj_8f3k2m",
"slug": "asaas",
"name": "Cobranças (Asaas)",
"upstreamBaseUrl": "https://api.asaas.com/v3",
"enabled": true,
"credentialKind": "header",
"credentialName": "access_token",
"allowedMethods": [
"GET",
"POST"
],
"allowedPaths": [
"/payments/*",
"/customers"
],
"callerAuth": "jwt",
"jwksUrl": "https://app.agendafacil.com/.well-known/jwks.json",
"jwtIssuer": "https://app.agendafacil.com",
"jwtAudience": "agendafacil",
"introspectionUrl": null,
"allowedOrigins": [
"https://barbeariadoze.com.br"
],
"rateLimitPerMin": 60,
"maxBodyKb": 256,
"legacyBubbleId": null,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:20:00.000Z",
"deletedAt": null,
"hasCredential": true
}Delete an AuthMesh service
/projects/{p}/authmesh/{id}projects:writeScale+Parameters
ppath · stringrequiredProject id (prj_…)
idpath · stringrequiredAuthMesh service id
Request
curl -X DELETE "https://api.tenanci.com/v2/projects/prj_8f3k2m/authmesh/prj_8f3k2m" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 204
Success
List gateway APIs
/projects/{p}/gatewayprojects:readScale+Parameters
ppath · stringrequiredProject id (prj_…)
Request
curl "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 200
{
"items": [
{
"id": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
"orgId": "org_5t1v",
"projectId": "prj_8f3k2m",
"name": "API de agendamentos",
"pathPrefix": "/api",
"enabled": true,
"apiKeyHeader": "x-api-key",
"allowApiKeys": true,
"jwtIssuer": null,
"jwtAudience": null,
"jwksUrl": null,
"rateLimitPerMin": 600,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z",
"deletedAt": null
}
]
}Create a gateway API
/projects/{p}/gatewayprojects:writeScale+Tenanci authenticates whoever calls your API (a Tenanci-issued key or a JWT), applies scopes and limits and forwards to your backend. signingSecret is only shown in this response: store it in your backend. Your backend checks X-Tenanci-Signature (HMAC-SHA256 with this secret) on every call the gateway forwards, to reject anything that didn't go through it. Duplicate prefix: 409 prefix_taken.
Parameters
ppath · stringrequiredProject id (prj_…)
Body
pathPrefixstringrequiredPath prefix on the project's domains where the API answers (e.g. /api). Unique within the project; /__tenanci, /__external__ and /.well-known are reserved.
namestringA name you'll recognize (up to 80 characters).
enabledbooleanTurns the API on at the edge. Requires API keys or a JWKS.
apiKeyHeaderstringHeader the consumer sends the key in (default x-api-key).
allowApiKeysbooleanAccept keys issued by Tenanci (default true).
jwtIssuerstring | nullExpected issuer (iss) when the consumer uses a JWT.
jwtAudiencestring | nullExpected audience (aud) in the JWT.
jwksUrlstring | nullhttps URL of your identity provider's JWKS (accepts JWTs besides keys).
rateLimitPerMininteger≥ -9007199254740991, ≤ 9007199254740991Calls per minute per consumer (1 to 1,000,000; default 600).
Request
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"name":"API de agendamentos","pathPrefix":"/api","allowApiKeys":true,"enabled":true}'Response 201
{
"id": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
"orgId": "org_5t1v",
"projectId": "prj_8f3k2m",
"name": "API de agendamentos",
"pathPrefix": "/api",
"enabled": true,
"apiKeyHeader": "x-api-key",
"allowApiKeys": true,
"jwtIssuer": null,
"jwtAudience": null,
"jwksUrl": null,
"rateLimitPerMin": 600,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z",
"deletedAt": null,
"signingSecret": "EXEMPLO-segredo-de-assinatura-mostrado-uma-vez"
}Update a gateway API
/projects/{p}/gateway/{api}projects:writeScale+Turning the API on without API keys or a JWKS returns 400 no_auth_method.
Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
Body
pathPrefixstringPath prefix on the project's domains where the API answers (e.g. /api). Unique within the project; /__tenanci, /__external__ and /.well-known are reserved.
namestringA name you'll recognize (up to 80 characters).
enabledbooleanTurns the API on at the edge. Requires API keys or a JWKS.
apiKeyHeaderstringHeader the consumer sends the key in (default x-api-key).
allowApiKeysbooleanAccept keys issued by Tenanci (default true).
jwtIssuerstring | nullExpected issuer (iss) when the consumer uses a JWT.
jwtAudiencestring | nullExpected audience (aud) in the JWT.
jwksUrlstring | nullhttps URL of your identity provider's JWKS (accepts JWTs besides keys).
rateLimitPerMininteger≥ -9007199254740991, ≤ 9007199254740991Calls per minute per consumer (1 to 1,000,000; default 600).
Request
curl -X PATCH "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"rateLimitPerMin":1200}'Response 200
{
"id": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
"orgId": "org_5t1v",
"projectId": "prj_8f3k2m",
"name": "API de agendamentos",
"pathPrefix": "/api",
"enabled": true,
"apiKeyHeader": "x-api-key",
"allowApiKeys": true,
"jwtIssuer": null,
"jwtAudience": null,
"jwksUrl": null,
"rateLimitPerMin": 1200,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-15T09:00:00.000Z",
"deletedAt": null
}Delete a gateway API
/projects/{p}/gateway/{api}projects:writeScale+Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
Request
curl -X DELETE "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 204
Success
Rotate the signing secret
/projects/{p}/gateway/{api}/rotate-secretprojects:writeScale+The new secret is only shown in this response. Signatures switch to it as soon as the edge gets the new configuration (within moments): update your backend right away. Your backend checks X-Tenanci-Signature (HMAC-SHA256 with this secret) on every call the gateway forwards, to reject anything that didn't go through it.
Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
Request
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/rotate-secret" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 200
{
"signingSecret": "EXEMPLO-novo-segredo-de-assinatura"
}List API routes
/projects/{p}/gateway/{api}/routesprojects:readScale+Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
Request
curl "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/routes" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 200
{
"items": [
{
"id": "id_01JA3N4R8S2T6V0W4X8Y2Z6A0B",
"apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
"method": "GET",
"pathPattern": "/bookings/*",
"upstreamUrl": "https://backend.agendafacil.com",
"authRequired": true,
"scopes": [
"bookings:read"
],
"stripPrefix": true,
"position": 1
}
]
}Add an API route
/projects/{p}/gateway/{api}/routesprojects:writeScale+When several routes match, the most specific path wins; an explicit method only breaks ties.
Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
Body
methodstringGET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS or * (default: all).
pathPatternstringrequiredPath relative to the API prefix: exact, "/x/*" (/x and everything below) or "/*" (everything).
upstreamUrlstringrequiredhttps URL of the backend that receives the call.
authRequiredbooleanRequire a key or JWT (default true; false makes the route public).
scopesstring[]Scopes the consumer must have.
stripPrefixbooleanStrip the API prefix before forwarding (default true).
Request
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/routes" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"method":"GET","pathPattern":"/bookings/*","upstreamUrl":"https://backend.agendafacil.com","scopes":["bookings:read"]}'Response 201
{
"id": "id_01JA3N4R8S2T6V0W4X8Y2Z6A0B",
"apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
"method": "GET",
"pathPattern": "/bookings/*",
"upstreamUrl": "https://backend.agendafacil.com",
"authRequired": true,
"scopes": [
"bookings:read"
],
"stripPrefix": true,
"position": 1
}Remove an API route
/projects/{p}/gateway/{api}/routes/{route}projects:writeScale+Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
routepath · stringrequiredRoute id
Request
curl -X DELETE "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/routes/<route>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 204
Success
List API consumers
/projects/{p}/gateway/{api}/consumersprojects:readScale+Each consumer comes with its keys (prefix and dates only; the secret is never returned).
Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
Request
curl "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/consumers" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 200
{
"items": [
{
"id": "id_01JA3N6C1D3E5F7G9H1J3K5M7N",
"apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
"orgId": "org_5t1v",
"name": "Barbearia do Zé",
"externalId": "barbearia-123",
"scopes": [
"bookings:read",
"bookings:write"
],
"rateLimitPerMin": null,
"metadata": {
"plan": "pro"
},
"createdAt": "2026-10-14T12:30:00.000Z",
"disabledAt": null,
"keys": [
{
"id": "key_01JA3N8P2Q4R6S8T0V2W4X6Y8Z",
"prefix": "9f2c4a7e1b",
"createdAt": "2026-10-14T12:31:00.000Z",
"expiresAt": null,
"revokedAt": null
}
]
}
]
}Create an API consumer
/projects/{p}/gateway/{api}/consumersprojects:writeScale+A consumer is whoever calls your API (a customer, an integration). Then issue a key for it.
Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
Body
namestringrequiredConsumer name (up to 120 characters).
externalIdstringConsumer id in your system.
scopesstring[]Granted scopes (sent to the backend in X-Tenanci-Scopes).
rateLimitPerMininteger | nullOwn per-minute limit (null: the API's).
metadataRecord<string, any>Free-form data for you.
Request
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/consumers" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"name":"Barbearia do Zé","externalId":"barbearia-123","scopes":["bookings:read","bookings:write"],"metadata":{"plan":"pro"}}'Response 201
{
"id": "id_01JA3N6C1D3E5F7G9H1J3K5M7N",
"apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
"orgId": "org_5t1v",
"name": "Barbearia do Zé",
"externalId": "barbearia-123",
"scopes": [
"bookings:read",
"bookings:write"
],
"rateLimitPerMin": null,
"metadata": {
"plan": "pro"
},
"createdAt": "2026-10-14T12:30:00.000Z",
"disabledAt": null
}Issue a consumer key
/projects/{p}/gateway/{api}/consumers/{consumer}/keysprojects:writeScale+secret is only shown in this response: hand it to the consumer, who sends it in the API's header (apiKeyHeader).
Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
consumerpath · stringrequiredConsumer id
Body
expiresAtstring | nullKey expiry (ISO 8601). Empty: never expires.
Request
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/consumers/<consumer>/keys" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"expiresAt":"2027-10-14T00:00:00Z"}'Response 201
{
"id": "key_01JA3N8P2Q4R6S8T0V2W4X6Y8Z",
"prefix": "9f2c4a7e1b",
"secret": "tgw_9f2c4a7e1b_…",
"expiresAt": "2027-10-14T00:00:00.000Z"
}Revoke a consumer key
/projects/{p}/gateway/{api}/keys/{key}projects:writeScale+Parameters
ppath · stringrequiredProject id (prj_…)
apipath · stringrequiredGateway API id
keypath · stringrequiredKey id (key_…)
Request
curl -X DELETE "https://api.tenanci.com/v2/projects/prj_8f3k2m/gateway/<api>/keys/<key>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Response 204
Success

