Declaration Template Repository
API Contract
REST
/api/v1/declaration-templates
7 endpoints
GET
/api/v1/declaration-templates/api/v1/declaration-templates
List all declaration templates across organisations
Public
Response Example
{
"data": [
{
"template_id": "tpl_v3_org_812",
"org_id": "org_812",
"version": 3,
"active": true,
"created_at": "2026-01-10T00:00:00Z",
"updated_at": "2026-02-15T00:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 6
}
}
GET
/api/v1/declaration-templates/api/v1/declaration-templates/:template_id
Get a template by ID including its content
Public
Response Example
{
"template_id": "tpl_v3_org_812",
"org_id": "org_812",
"version": 3,
"active": true,
"content": "Taushetserklæring\n\nJeg, den undertegnede, bekrefter herved at jeg er kjent med...",
"created_at": "2026-01-10T00:00:00Z",
"updated_at": "2026-02-15T00:00:00Z"
}
POST
/api/v1/declaration-templates/api/v1/declaration-templates
Insert a new declaration template for an organisation
Public
Request Example
{
"org_id": "org_812",
"content": "Taushetserklæring\n\nJeg bekrefter at jeg er kjent med taushetsplikt...",
"active": true
}
Response Example
{
"template_id": "tpl_v4_org_812",
"org_id": "org_812",
"version": 4,
"active": true,
"created_at": "2026-03-26T09:00:00Z"
}
PUT
/api/v1/declaration-templates/api/v1/declaration-templates/:template_id
Update an existing declaration template content
Public
Request Example
{
"content": "Taushetserklæring v4 — oppdatert tekst...",
"active": false
}
Response Example
{
"template_id": "tpl_v3_org_812",
"org_id": "org_812",
"version": 3,
"active": false,
"updated_at": "2026-03-26T10:00:00Z"
}
DELETE
/api/v1/declaration-templates/api/v1/declaration-templates/:template_id
Delete a declaration template (only if not referenced by any declaration)
Public
Response Example
{
"template_id": "tpl_v3_org_812",
"deleted": true,
"deleted_at": "2026-03-26T11:00:00Z"
}
GET
/api/v1/declaration-templates/api/v1/declaration-templates/orgs/:org_id/active
Get the currently active template for an organisation
Public
Response Example
{
"template_id": "tpl_v3_org_812",
"org_id": "org_812",
"version": 3,
"active": true,
"content": "Taushetserklæring\n\nJeg bekrefter...",
"updated_at": "2026-02-15T00:00:00Z"
}
GET
/api/v1/declaration-templates/api/v1/declaration-templates/orgs/:org_id/versions/:version
Get a specific version of the template for an organisation
Public
Response Example
{
"template_id": "tpl_v2_org_812",
"org_id": "org_812",
"version": 2,
"active": false,
"content": "Taushetserklæring v2...",
"created_at": "2025-10-01T00:00:00Z"
}