curl --request POST \
--url https://api.example.com/v2/template/{id}/preview \
--header 'Content-Type: application/json' \
--data '
{
"personalisation": {}
}
'{
"id": "<string>",
"type": "<string>",
"version": 123,
"body": "<string>",
"subject": "<string>",
"html": "<string>",
"postage": "<string>",
"status_code": 123,
"errors": [
{}
]
}curl --request POST \
--url https://api.example.com/v2/template/{id}/preview \
--header 'Content-Type: application/json' \
--data '
{
"personalisation": {}
}
'{
"id": "<string>",
"type": "<string>",
"version": 123,
"body": "<string>",
"subject": "<string>",
"html": "<string>",
"postage": "<string>",
"status_code": 123,
"errors": [
{}
]
}Generates a preview of a template with personalisation data filled in. This allows you to see what the final message will look like before sending it.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/alphagov/notifications-api/llms.txt
Use this file to discover all available pages before exploring further.
sms - SMS message templateemail - Email templateletter - Letter templatefirst - First classsecond - Second classeconomy - Economy classeurope - Europerest-of-world - Rest of worldcurl -X POST "https://api.notifications.service.gov.uk/v2/template/f33517ff-2a88-4f6e-b855-c550268ce08a/preview" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"personalisation": {
"name": "John Smith",
"reference": "REF-12345"
}
}'
{
"id": "f33517ff-2a88-4f6e-b855-c550268ce08a",
"type": "email",
"version": 3,
"body": "Hello John Smith,\n\nYour reference number is REF-12345.",
"subject": "Your application has been received",
"html": "<p>Hello John Smith,</p><p>Your reference number is REF-12345.</p>",
"postage": null
}
{
"id": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
"type": "sms",
"version": 1,
"body": "Your security code is 123456. Do not share this code.",
"subject": null,
"html": null,
"postage": null
}
{
"id": "b2c3d4e5-f6a7-4b6c-9d0e-1f2a3b4c5d6e",
"type": "letter",
"version": 2,
"body": "Dear Sarah Jones,\n\nThis is to confirm your appointment on 15 March 2024.",
"subject": null,
"html": null,
"postage": "second"
}
{
"status_code": 400,
"errors": [
{
"error": "ValidationError",
"message": "id is not a valid UUID"
}
]
}
{
"status_code": 400,
"errors": [
{
"error": "BadRequestError",
"message": "Missing personalisation: name, reference"
}
]
}
{
"status_code": 400,
"errors": [
{
"error": "ValidationError",
"message": "Invalid JSON"
}
]
}
{
"status_code": 403,
"errors": [
{
"error": "AuthError",
"message": "Invalid token: service not found"
}
]
}
{
"status_code": 404,
"errors": [
{
"error": "NoResultFound",
"message": "No result found"
}
]
}