TenanciTenanci

Help centerAPI referenceRoutes, headers & scripts

Routes, headers & scripts

Project rules (apply to every domain) and per-domain rules.

List project rules

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

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • kindpath · stringrequired

    Rule type: routes, headers or injections

Request

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

Response 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"
    }
  ]
}

Create a project rule

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

The body depends on the type: routes {source, destination, mode}, headers {name, value, direction}, injections {content, injectAt}.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • kindpath · stringrequired

    Rule type: routes, headers or injections

Body

object

Request

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"}'

Response 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"
}

List domain rules

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

By default, the rules in effect on the domain (the project's, or its own if the domain overrides). effective=false lists only the domain's own.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • kindpath · stringrequired

    Rule type: routes, headers or injections

  • effectivequery · "true" | "false"

    false: only the domain's own rules.

Request

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

Response 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"
    }
  ]
}

Create a domain rule

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

The body depends on the type: routes {source, destination, mode}, headers {name, value, direction}, injections {content, injectAt}.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • kindpath · stringrequired

    Rule type: routes, headers or injections

Body

object

Request

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"}'

Response 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"
}

Update a rule

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

The same fields as creation (all optional), plus enabled and position.

Parameters

  • kindpath · stringrequired

    Rule type: routes, headers or injections

  • ruleIdpath · stringrequired

    Rule id (rte_…, hdr_…, inj_…)

Body

  • enabledboolean
  • positioninteger≥ 0, ≤ 9007199254740991

Request

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}'

Response 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"
}

Delete a rule

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

Parameters

  • kindpath · stringrequired

    Rule type: routes, headers or injections

  • ruleIdpath · stringrequired

    Rule id (rte_…, hdr_…, inj_…)

Request

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

Response 204

Success