{% extends "withoutnav_template.html" %} {% from "components/page-footer.html" import page_footer %} {% from "components/api-key.html" import api_key %} {% block page_title %} API documentation – GOV.UK Notify {% endblock %} {% block maincolumn_content %}
Notify provides an API that allows the creation of text notifications and the ability to get the status of a sent notification.
Notify uses JSON Web Tokens (JWT) for authentication. JWT tokens have a series of claims, standard and application specific.
Notify standard claims:
{{''' { "typ": "JWT", "alg": "HS256" } '''|syntax_highlight_json}}Notify application specific:
{{""" { iss: 'string', // service id iat: 0, // creation time in epoch seconds (UTC) } """|syntax_highlight_json}}To create a text notification
Where ‘to’ is the phone number and ‘template’ is the template ID to send.
Response:
To get the status of a text notification
{{ "GET /notifications/{id}"|syntax_highlight_json }} {{""" { 'data':{ 'notification': { 'status':'sent', 'createdAt':'2016-01-01T09:00:00.999999Z', 'to':'+447827992607', 'method':'sms', 'sentAt':'2016-01-01T09:01:00.999999Z', 'id':1, 'message':'...', 'jobId':1, 'sender':'sms-partner' } } } """|syntax_highlight_json }}A python client library is support by the Notify team:
This provides example code for calling the API and for constructing the API tokens.
Notify API code is open sourced at:
https://api.notifications.service.gov.uk/