Skip to main content
GET
/
v2
/
template
/
{id}
Get a template
curl --request GET \
  --url https://api.example.com/v2/template/{id}
{
  "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 a template by ID. You can optionally specify a version number to retrieve a specific version of the template.

Path Parameters

id
string
required
The UUID of the template to retrieve

Optional Path Parameters

version
integer
The version number of the template to retrieve. If not specified, returns the latest version. Minimum value: 1

Authentication

Requires an API key with appropriate service permissions.

Response

id
string
The UUID of the template
type
string
The type of template. One of:
  • sms - SMS message template
  • email - Email template
  • letter - Letter template
created_at
string
ISO 8601 datetime when the template was created
updated_at
string
ISO 8601 datetime when the template was last updated
created_by
string
Email address of the user who created the template
version
integer
The version number of the template
body
string
The content of the template
subject
string
The subject line (for email templates only)
name
string
The name of the template
postage
string
The postage class for letter templates. One of:
  • first - First class
  • second - Second class
  • economy - Economy class
  • europe - Europe
  • rest-of-world - Rest of world

Example Request

curl -X GET "https://api.notifications.service.gov.uk/v2/template/f33517ff-2a88-4f6e-b855-c550268ce08a" \
  -H "Authorization: Bearer your_api_key_here"

Example Response

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

Error Responses

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

400 Bad Request

Returned when the template ID is not a valid UUID.
{
  "status_code": 400,
  "errors": [
    {
      "error": "ValidationError",
      "message": "id is not a valid UUID"
    }
  ]
}

403 Forbidden

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

404 Not Found

Returned when the template or specified version doesn’t exist.
{
  "status_code": 404,
  "errors": [
    {
      "error": "NoResultFound",
      "message": "No result found"
    }
  ]
}

Build docs developers (and LLMs) love