Skip to main content
GET
/
v2
/
templates
Get all templates
curl --request GET \
  --url https://api.example.com/v2/templates
{
  "templates": [
    {
      "id": "<string>",
      "type": "<string>",
      "created_at": "<string>",
      "updated_at": "<string>",
      "created_by": "<string>",
      "version": 123,
      "body": "<string>",
      "subject": "<string>",
      "name": "<string>",
      "postage": "<string>"
    }
  ],
  "status_code": 123,
  "errors": [
    {}
  ]
}
Retrieves all templates for your service. You can optionally filter by template type.

Query Parameters

type
string
Filter templates by type. One of:
  • sms - SMS message templates
  • email - Email templates
  • letter - Letter templates
If not specified, returns all templates regardless of type.

Authentication

Requires an API key with appropriate service permissions.

Response

templates
array
Array of template objects. Each template contains:

Example Requests

curl -X GET "https://api.notifications.service.gov.uk/v2/templates" \
  -H "Authorization: Bearer your_api_key_here"

Example Response

{
  "templates": [
    {
      "id": "f33517ff-2a88-4f6e-b855-c550268ce08a",
      "type": "email",
      "created_at": "2024-01-15T14:30:00.000000Z",
      "updated_at": "2024-01-16T09:15:00.000000Z",
      "created_by": "[email protected]",
      "version": 3,
      "body": "Hello ((name)),\n\nYour reference number is ((reference)).",
      "subject": "Your application has been received",
      "name": "Application confirmation email",
      "postage": null
    },
    {
      "id": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
      "type": "sms",
      "created_at": "2024-01-10T10:00:00.000000Z",
      "updated_at": null,
      "created_by": "[email protected]",
      "version": 1,
      "body": "Your security code is ((code)). Do not share this code.",
      "subject": null,
      "name": "Security code SMS",
      "postage": null
    },
    {
      "id": "b2c3d4e5-f6a7-4b6c-9d0e-1f2a3b4c5d6e",
      "type": "letter",
      "created_at": "2024-01-05T08:00:00.000000Z",
      "updated_at": "2024-01-12T11:30:00.000000Z",
      "created_by": "[email protected]",
      "version": 2,
      "body": "Dear ((name)),\n\nThis is to confirm your appointment on ((date)).",
      "subject": null,
      "name": "Appointment confirmation letter",
      "postage": "second"
    }
  ]
}

Error Responses

status_code
integer
HTTP status code
errors
array
Array of error objects describing what went wrong

400 Bad Request

Returned when an invalid template type is provided.
{
  "status_code": 400,
  "errors": [
    {
      "error": "ValidationError",
      "message": "type is not one of: sms, email, letter"
    }
  ]
}

403 Forbidden

Returned when the API key is invalid or doesn’t have permission.
{
  "status_code": 403,
  "errors": [
    {
      "error": "AuthError",
      "message": "Invalid token: service not found"
    }
  ]
}

Build docs developers (and LLMs) love