Schemas

September 17, 2026 · View on GitHub

Notify Service v1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Service for contacting respondents via Gov Notify SMS messages

Base URLs:

email-fulfilment-endpoint

emailFulfilment

Code samples

# You can also use wget
curl -X POST http://localhost:8162/email-fulfilment \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST http://localhost:8162/email-fulfilment HTTP/1.1
Host: localhost:8162
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "header": {
    "channel": "RH",
    "correlationId": "48fb4cd3-2ef6-4479-bea1-7c92721b988c",
    "originatingUser": "fred.bloggs@ons.gov.uk",
    "source": "Survey Enquiry Line API"
  },
  "payload": {
    "emailFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "email": "example@example.com",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "uacMetadata": null
    },
    "smsFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "phoneNumber": "+447123456789",
      "uacMetadata": null
    }
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('http://localhost:8162/email-fulfilment',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'http://localhost:8162/email-fulfilment',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('http://localhost:8162/email-fulfilment', headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','http://localhost:8162/email-fulfilment', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("http://localhost:8162/email-fulfilment");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "http://localhost:8162/email-fulfilment", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /email-fulfilment

Email Fulfilment Request

Body parameter

{
  "header": {
    "channel": "RH",
    "correlationId": "48fb4cd3-2ef6-4479-bea1-7c92721b988c",
    "originatingUser": "fred.bloggs@ons.gov.uk",
    "source": "Survey Enquiry Line API"
  },
  "payload": {
    "emailFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "email": "example@example.com",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "uacMetadata": null
    },
    "smsFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "phoneNumber": "+447123456789",
      "uacMetadata": null
    }
  }
}

Parameters

NameInTypeRequiredDescription
bodybodyRequestDTOtruenone

Example responses

200 Response

{
  "qid": "string",
  "uacHash": "string"
}

Responses

StatusMeaningDescriptionSchema
200OKSend an email fulfilment for a case. Returns uacHash & QID if template has UAC/QID, or empty response if notEmailFulfilmentResponseSuccess
400Bad RequestEmail Fulfilment request failed validationEmailFulfilmentResponseError
500Internal Server ErrorError with Gov Notify when attempting to send emailNone

sms-fulfilment-endpoint

smsFulfilment

Code samples

# You can also use wget
curl -X POST http://localhost:8162/sms-fulfilment \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST http://localhost:8162/sms-fulfilment HTTP/1.1
Host: localhost:8162
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "header": {
    "channel": "RH",
    "correlationId": "48fb4cd3-2ef6-4479-bea1-7c92721b988c",
    "originatingUser": "fred.bloggs@ons.gov.uk",
    "source": "Survey Enquiry Line API"
  },
  "payload": {
    "emailFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "email": "example@example.com",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "uacMetadata": null
    },
    "smsFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "phoneNumber": "+447123456789",
      "uacMetadata": null
    }
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('http://localhost:8162/sms-fulfilment',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'http://localhost:8162/sms-fulfilment',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('http://localhost:8162/sms-fulfilment', headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','http://localhost:8162/sms-fulfilment', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("http://localhost:8162/sms-fulfilment");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "http://localhost:8162/sms-fulfilment", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /sms-fulfilment

SMS Fulfilment Request

Body parameter

{
  "header": {
    "channel": "RH",
    "correlationId": "48fb4cd3-2ef6-4479-bea1-7c92721b988c",
    "originatingUser": "fred.bloggs@ons.gov.uk",
    "source": "Survey Enquiry Line API"
  },
  "payload": {
    "emailFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "email": "example@example.com",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "uacMetadata": null
    },
    "smsFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "phoneNumber": "+447123456789",
      "uacMetadata": null
    }
  }
}

Parameters

NameInTypeRequiredDescription
bodybodyRequestDTOtruenone

Example responses

200 Response

{
  "qid": "string",
  "uacHash": "string"
}

Responses

StatusMeaningDescriptionSchema
200OKSend an SMS fulfilment for a case. Returns uacHash & QID if template has UAC/QID, or empty response if notSmsFulfilmentResponseSuccess
400Bad RequestSMS Fulfilment request failed validationSmsFulfilmentResponseError
500Internal Server ErrorError with Gov Notify when attempting to send SMSNone

Schemas

EmailFulfilment

{
  "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
  "email": "example@example.com",
  "packCode": "string",
  "personalisation": {
    "name": "Joe Bloggs"
  },
  "uacMetadata": null
}

Properties

NameTypeRequiredRestrictionsDescription
caseIdstring(uuid)falsenoneThe case, which must exist in RM
emailstringfalsenoneThe target email address, to which we will send a fulfilment
packCodestringfalsenoneThe pack code, which must exist in RM and the pack code must be allowed on the survey the case belongs to
personalisationobject,nullfalsenoneOptional personalisation key/value pairs to include in the sent email. Keys must match __request__. prefixed fields in the selected template, or they will be ignored
» additionalPropertiesstringfalsenonenone
uacMetadataanyfalsenoneMetadata for UACQIDLinks

EmailFulfilmentResponseError

{
  "error": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone

EmailFulfilmentResponseSuccess

{
  "qid": "string",
  "uacHash": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
qidstringfalsenonenone
uacHashstringfalsenonenone

RequestDTO

{
  "header": {
    "channel": "RH",
    "correlationId": "48fb4cd3-2ef6-4479-bea1-7c92721b988c",
    "originatingUser": "fred.bloggs@ons.gov.uk",
    "source": "Survey Enquiry Line API"
  },
  "payload": {
    "emailFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "email": "example@example.com",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "uacMetadata": null
    },
    "smsFulfilment": {
      "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
      "packCode": "string",
      "personalisation": {
        "name": "Joe Bloggs"
      },
      "phoneNumber": "+447123456789",
      "uacMetadata": null
    }
  }
}

Properties

NameTypeRequiredRestrictionsDescription
headerRequestHeaderDTOfalsenonenone
payloadRequestPayloadDTOfalsenonenone

RequestHeaderDTO

{
  "channel": "RH",
  "correlationId": "48fb4cd3-2ef6-4479-bea1-7c92721b988c",
  "originatingUser": "fred.bloggs@ons.gov.uk",
  "source": "Survey Enquiry Line API"
}

Properties

NameTypeRequiredRestrictionsDescription
channelstringfalsenoneThe product that is calling the API
correlationIdstring(uuid)falsenoneThe ID that connects all the way from the public web load balancer to the backend, and back again
originatingUserstringfalsenoneThe ONS user who is triggering this API request via an internal UI
sourcestringfalsenoneThe microservice that is calling the API

RequestPayloadDTO

{
  "emailFulfilment": {
    "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
    "email": "example@example.com",
    "packCode": "string",
    "personalisation": {
      "name": "Joe Bloggs"
    },
    "uacMetadata": null
  },
  "smsFulfilment": {
    "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
    "packCode": "string",
    "personalisation": {
      "name": "Joe Bloggs"
    },
    "phoneNumber": "+447123456789",
    "uacMetadata": null
  }
}

Properties

NameTypeRequiredRestrictionsDescription
emailFulfilmentEmailFulfilmentfalsenonenone
smsFulfilmentSmsFulfilmentfalsenonenone

SmsFulfilment

{
  "caseId": "af51d69f-996a-4891-a745-aadfcdec225a",
  "packCode": "string",
  "personalisation": {
    "name": "Joe Bloggs"
  },
  "phoneNumber": "+447123456789",
  "uacMetadata": null
}

Properties

NameTypeRequiredRestrictionsDescription
caseIdstring(uuid)falsenoneThe case, which must exist in RM
packCodestringfalsenoneThe pack code, which must exist in RM and the pack code must be allowed on the survey the case belongs to
personalisationobject,nullfalsenoneOptional personalisation key/value pairs to include in the sent email. Keys must match __request__. prefixed fields in the selected template, or they will be ignored
» additionalPropertiesstringfalsenonenone
phoneNumberstringfalsenoneThe phone number, which must be a UK number consisting of 9 digits, preceded by a 7 and optionally a UK country code or zero (0, 044 or +44).
uacMetadataanyfalsenoneMetadata for UACQIDLinks

SmsFulfilmentResponseError

{
  "error": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone

SmsFulfilmentResponseSuccess

{
  "qid": "string",
  "uacHash": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
qidstringfalsenonenone
uacHashstringfalsenonenone