Caddy Templates

List a server's Caddy templates

GET/api/v1/servers/{server}/caddy-templates

Required scope: servers:read

Parameters

NameInRequiredDescription
serverpathyesThe server id.
page[size]querynoItems per page (1-100, default 30).
page[cursor]querynoOpaque cursor from a previous response.

Example request

curl https://hangar.nagara.cloud/api/v1/servers/server_123/caddy-templates?account_id=acct_123 \
  -H "Authorization: Bearer hgp_your_token"

Example response

{
  "data": [ { /* ... */ } ],
  "meta": { "per_page": 30, "next_cursor": "eyJ...", "prev_cursor": null },
  "links": { "next": "/api/v1/...?page[cursor]=eyJ...", "prev": null }
}

Create a Caddy template

POST/api/v1/servers/{server}/caddy-templates

Required scope: servers:write

Parameters

NameInRequiredDescription
serverpathyesThe server id.

Example request

curl https://hangar.nagara.cloud/api/v1/servers/server_123/caddy-templates \
  -X POST \
  -H "Authorization: Bearer hgp_your_token" \
  -H "Content-Type: application/json" \
  -d '{"content": "...", "name": "..."}'

Example response

{ "data": {
  "content": "...",
  "created_at": "2026-01-01T00:00:00Z",
  "id": "id_123",
  "is_default": false,
  "name": "...",
  "server_id": "..."
} }

Update a Caddy template

PATCH/api/v1/caddy-templates/{template}

Required scope: servers:write

Parameters

NameInRequiredDescription
templatepathyesThe template id.

Example request

curl https://hangar.nagara.cloud/api/v1/caddy-templates/{template} \
  -X PATCH \
  -H "Authorization: Bearer hgp_your_token" \
  -H "Content-Type: application/json" \
  -d '{"content": "...", "name": "..."}'

Example response

{ "data": {
  "content": "...",
  "created_at": "2026-01-01T00:00:00Z",
  "id": "id_123",
  "is_default": false,
  "name": "...",
  "server_id": "..."
} }

Delete a Caddy template

DELETE/api/v1/caddy-templates/{template}

Required scope: servers:write

Parameters

NameInRequiredDescription
templatepathyesThe template id.

Example request

curl https://hangar.nagara.cloud/api/v1/caddy-templates/{template} \
  -X DELETE \
  -H "Authorization: Bearer hgp_your_token"

Example response

HTTP/1.1 204 No Content

Apply a Caddy template to an app

POST/api/v1/apps/{app}/caddy-template

Required scope: apps:write

Parameters

NameInRequiredDescription
apppathyesThe app id.

Example request

curl https://hangar.nagara.cloud/api/v1/apps/app_123/caddy-template \
  -X POST \
  -H "Authorization: Bearer hgp_your_token" \
  -H "Content-Type: application/json" \
  -d '{"template_id": "..."}'

Example response

HTTP/1.1 204 No Content