TenanciTenanci

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

GET/projects/{id}/rules/{kind}domains:read

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

  • kindpath · stringobrigatório

    Tipo de regra: routes, headers ou injections

Requisição

cURL
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

POST/projects/{id}/rules/{kind}domains:write

O corpo depende do tipo: routes {source, destination, mode}, headers {name, value, direction}, injections {content, injectAt}.

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

  • kindpath · stringobrigatório

    Tipo de regra: routes, headers ou injections

Corpo

object

Requisição

cURL
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

GET/domains/{id}/rules/{kind}domains:read

Por 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ório

    Id do recurso (prj_…, dom_…)

  • kindpath · stringobrigatório

    Tipo de regra: routes, headers ou injections

  • effectivequery · "true" | "false"

    false: só as regras próprias do domínio.

Requisição

cURL
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

POST/domains/{id}/rules/{kind}domains:write

O corpo depende do tipo: routes {source, destination, mode}, headers {name, value, direction}, injections {content, injectAt}.

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

  • kindpath · stringobrigatório

    Tipo de regra: routes, headers ou injections

Corpo

object

Requisição

cURL
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

PATCH/rules/{kind}/{ruleId}domains:write

Os mesmos campos da criação (todos opcionais), mais enabled e position.

Parâmetros

  • kindpath · stringobrigatório

    Tipo de regra: routes, headers ou injections

  • ruleIdpath · stringobrigatório

    Id da regra (rte_…, hdr_…, inj_…)

Corpo

  • enabledboolean
  • positioninteger≥ 0, ≤ 9007199254740991

Requisição

cURL
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

DELETE/rules/{kind}/{ruleId}domains:write

Parâmetros

  • kindpath · stringobrigatório

    Tipo de regra: routes, headers ou injections

  • ruleIdpath · stringobrigatório

    Id da regra (rte_…, hdr_…, inj_…)

Requisição

cURL
curl -X DELETE "https://api.tenanci.com/v2/rules/<kind>/<ruleId>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Resposta 204

Sucesso