Central de ajudaReferência da APIRotas, cabeçalhos e scripts
Rotas, cabeçalhos e scripts
Regras do projeto (valem para todos os domínios) e de cada domínio.
Listar regras do projeto
/projects/{id}/rules/{kind}domains:readParâmetros
idpath · stringobrigatórioId do recurso (prj_…, dom_…)
kindpath · stringobrigatórioTipo de regra: routes, headers ou injections
Requisição
curl "https://api.tenanci.com/v2/projects/prj_8f3k2m/rules/<kind>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Resposta 200
{
"items": [
{
"id": "rte_2k9d7x",
"orgId": "org_5t1v",
"scopeType": "project",
"scopeId": "prj_8f3k2m",
"source": "/agendar",
"destination": "/booking",
"mode": "rewrite",
"enabled": true,
"position": 1,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z"
}
]
}Criar regra do projeto
/projects/{id}/rules/{kind}domains:writeO corpo depende do tipo: routes {source, destination, mode}, headers {name, value, direction}, injections {content, injectAt}.
Parâmetros
idpath · stringobrigatórioId do recurso (prj_…, dom_…)
kindpath · stringobrigatórioTipo de regra: routes, headers ou injections
Corpo
object
Requisição
curl -X POST "https://api.tenanci.com/v2/projects/prj_8f3k2m/rules/<kind>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"source":"/agendar","destination":"/booking","mode":"rewrite"}'Resposta 201
{
"id": "rte_2k9d7x",
"orgId": "org_5t1v",
"scopeType": "project",
"scopeId": "prj_8f3k2m",
"source": "/agendar",
"destination": "/booking",
"mode": "rewrite",
"enabled": true,
"position": 1,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z"
}Listar regras do domínio
/domains/{id}/rules/{kind}domains:readPor padrão, as regras que valem no domínio (as do projeto, ou as próprias se o domínio sobrescreve). effective=false lista só as do domínio.
Parâmetros
idpath · stringobrigatórioId do recurso (prj_…, dom_…)
kindpath · stringobrigatórioTipo de regra: routes, headers ou injections
effectivequery · "true" | "false"false: só as regras próprias do domínio.
Requisição
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/rules/<kind>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Resposta 200
{
"items": [
{
"id": "rte_2k9d7x",
"orgId": "org_5t1v",
"scopeType": "project",
"scopeId": "prj_8f3k2m",
"source": "/agendar",
"destination": "/booking",
"mode": "rewrite",
"enabled": true,
"position": 1,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z"
}
]
}Criar regra do domínio
/domains/{id}/rules/{kind}domains:writeO corpo depende do tipo: routes {source, destination, mode}, headers {name, value, direction}, injections {content, injectAt}.
Parâmetros
idpath · stringobrigatórioId do recurso (prj_…, dom_…)
kindpath · stringobrigatórioTipo de regra: routes, headers ou injections
Corpo
object
Requisição
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/rules/<kind>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"name":"X-Frame-Options","value":"SAMEORIGIN","direction":"response"}'Resposta 201
{
"id": "hdr_7m2p",
"orgId": "org_5t1v",
"scopeType": "domain",
"scopeId": "dom_4h7n1q",
"enabled": true,
"position": 1,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z",
"name": "X-Frame-Options",
"value": "SAMEORIGIN",
"direction": "response"
}Alterar regra
/rules/{kind}/{ruleId}domains:writeOs mesmos campos da criação (todos opcionais), mais enabled e position.
Parâmetros
kindpath · stringobrigatórioTipo de regra: routes, headers ou injections
ruleIdpath · stringobrigatórioId da regra (rte_…, hdr_…, inj_…)
Corpo
enabledbooleanpositioninteger≥ 0, ≤ 9007199254740991
Requisição
curl -X PATCH "https://api.tenanci.com/v2/rules/<kind>/<ruleId>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"enabled":false}'Resposta 200
{
"id": "rte_2k9d7x",
"orgId": "org_5t1v",
"scopeType": "project",
"scopeId": "prj_8f3k2m",
"source": "/agendar",
"destination": "/booking",
"mode": "rewrite",
"enabled": false,
"position": 1,
"createdAt": "2026-10-14T12:00:00.000Z",
"updatedAt": "2026-10-14T12:00:00.000Z"
}Apagar regra
/rules/{kind}/{ruleId}domains:writeParâmetros
kindpath · stringobrigatórioTipo de regra: routes, headers ou injections
ruleIdpath · stringobrigatórioId da regra (rte_…, hdr_…, inj_…)
Requisição
curl -X DELETE "https://api.tenanci.com/v2/rules/<kind>/<ruleId>" \
-H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"Resposta 204
Sucesso

