Introduction
This documentation aims to provide all the information you need to work with our API.
Authenticating requests
To authenticate requests, include a x-api-key header with the value
"{YOUR_AUTH_KEY}".
All authenticated endpoints are marked with a requires authentication badge in the documentation
below.
Your API key and channel will be provided to you by TTB.
Quote endpoints
Endpoints for generating quotes
POST Full Quote
requires authentication
The request is made to one of the following URLS:
-
Churchill Dev: https://api-ext-dev.twothreebird.com/tpq/churchill/create-quote
-
Churchill Prod: https://api-ext.twothreebird.com/tpq/churchill/create-quote
-
Sundays US Dev: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/v1/tpq
-
Sundays US Prod: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/live/tpq
-
Sundays UK Dev: https://api-ext-dev.twothreebird.com/tpq/sundays-uk/create-quote
-
Sundays UK Prod: https://api-ext.twothreebird.com/tpq/sundays-uk/create-quote
The response provides estimated monthly and annual premiums. The response also contains a "tpq" value which is used to generate the customer redirect URL. This TPQ is used to generate the redirect URL for the customer. Replace {TPQ} with the received TPQ for the following environments.
-
Churchill Dev: https://dev-churchill.dlg.twothreebird.com/tpq/{TPQ}
-
Churchill Prod: https://churchill.dlg.twothreebird.com/tpq/{TPQ}
-
Sundays US Dev: https://dev-quote.sus.twothreebird.com/ql?tpq={TPQ}
-
Sundays US Prod: https://quote.sundaysinsurance.com/ql/tpq/{TPQ}
-
Sundays UK Dev: https://sundays.uk.23bird.dev/quote/tpq/{TPQ}
-
Sundays UK Prod: https://quote.sundaysinsurance.co.uk/quote/tpq/{TPQ}
Example request:
$client = new \GuzzleHttp\Client();
$url = 'http://{Product & region specific url}';
$response = $client->post(
$url,
[
'headers' => [
'x-api-key' => '{YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'customer' => [
'brand' => 'Sundays UK',
'dateOfBirth' => '1999-12-31',
'firstName' => 'John',
'lastName' => 'Smith',
'contactNumber' => '2124561234',
'email' => '[email protected]',
'personalInfoUse' => false,
'address' => [
'line1' => 'Flat 7',
'line2' => 'quo',
'town' => 'London',
'province' => 'London',
'postal_code' => 'NW10 9BA',
],
],
'policy' => [
'product' => 'Sundays UK',
'policyType' => 'BC',
'channel' => '{{YOUR_CHANNEL}',
'policyStartDate' => '2023-02-14',
'excess' => 200,
'Insurable' => [
[
'value' => '2000',
'type' => 'Bike',
'bikeType' => 'Road Bike',
'bikeMake' => 'Specialized',
'storage' => 'Other',
'bikeModel' => 'S-Works SL7',
'bikeYear' => '2018',
],
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));curl --request POST \
"http://{Product & region specific url}" \
--header "x-api-key: {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"customer\": {
\"brand\": \"Sundays UK\",
\"dateOfBirth\": \"1999-12-31\",
\"firstName\": \"John\",
\"lastName\": \"Smith\",
\"contactNumber\": \"2124561234\",
\"email\": \"[email protected]\",
\"personalInfoUse\": false,
\"address\": {
\"line1\": \"Flat 7\",
\"line2\": \"quo\",
\"town\": \"London\",
\"province\": \"London\",
\"postal_code\": \"NW10 9BA\"
}
},
\"policy\": {
\"product\": \"Sundays UK\",
\"policyType\": \"BC\",
\"channel\": \"{{YOUR_CHANNEL}\",
\"policyStartDate\": \"2023-02-14\",
\"excess\": 200,
\"Insurable\": [
{
\"value\": \"2000\",
\"type\": \"Bike\",
\"bikeType\": \"Road Bike\",
\"bikeMake\": \"Specialized\",
\"storage\": \"Other\",
\"bikeModel\": \"S-Works SL7\",
\"bikeYear\": \"2018\"
}
]
}
}"
import requests
import json
url = 'http://{Product & region specific url}'
payload = {
"customer": {
"brand": "Sundays UK",
"dateOfBirth": "1999-12-31",
"firstName": "John",
"lastName": "Smith",
"contactNumber": "2124561234",
"email": "[email protected]",
"personalInfoUse": false,
"address": {
"line1": "Flat 7",
"line2": "quo",
"town": "London",
"province": "London",
"postal_code": "NW10 9BA"
}
},
"policy": {
"product": "Sundays UK",
"policyType": "BC",
"channel": "{{YOUR_CHANNEL}",
"policyStartDate": "2023-02-14",
"excess": 200,
"Insurable": [
{
"value": "2000",
"type": "Bike",
"bikeType": "Road Bike",
"bikeMake": "Specialized",
"storage": "Other",
"bikeModel": "S-Works SL7",
"bikeYear": "2018"
}
]
}
}
headers = {
'x-api-key': '{YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()const url = new URL(
"http://{Product & region specific url}"
);
const headers = {
"x-api-key": "{YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"customer": {
"brand": "Sundays UK",
"dateOfBirth": "1999-12-31",
"firstName": "John",
"lastName": "Smith",
"contactNumber": "2124561234",
"email": "[email protected]",
"personalInfoUse": false,
"address": {
"line1": "Flat 7",
"line2": "quo",
"town": "London",
"province": "London",
"postal_code": "NW10 9BA"
}
},
"policy": {
"product": "Sundays UK",
"policyType": "BC",
"channel": "{{YOUR_CHANNEL}",
"policyStartDate": "2023-02-14",
"excess": 200,
"Insurable": [
{
"value": "2000",
"type": "Bike",
"bikeType": "Road Bike",
"bikeMake": "Specialized",
"storage": "Other",
"bikeModel": "S-Works SL7",
"bikeYear": "2018"
}
]
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
Show headers
cache-control: no-cache, private
content-type: application/json
{
"data": {
"type": "Policy",
"attributes": {
"annualPremium": 98.64,
"monthlyPremium": 8.22,
"tpq": "9abc28f7a9ecb9e195487d70be34f49472c74621d659"
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
POST Abbreviated Quote
requires authentication
The response provides estimated monthly and annual premiums.
The request is made to one of the following URLS:
- Sundays US Dev: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/v1/create-quote
- Sundays US Prod: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/live/create-quote
The response provides estimated monthly and annual premiums. The response also contains a "tpq" value which is used to generate the customer redirect URL. This TPQ is used to generate the redirect URL for the customer. Replace {TPQ} with the received TPQ for the following environments.
- Sundays US Dev: https://dev-quote.sus.twothreebird.com/ql?tpq={TPQ}
- Sundays US Prod: https://quote.sundaysinsurance.com/ql/tpq/{TPQ}
Example request:
$client = new \GuzzleHttp\Client();
$url = 'http://{Product & region specific url}';
$response = $client->post(
$url,
[
'headers' => [
'x-api-key' => '{YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'policy' => [
'product' => 'Sundays US',
'channel' => '{{YOUR_CHANNEL}',
'bike' => [
'value' => '2000',
'type' => 'Road Bike',
'make' => 'Specialized',
'year' => '2023',
'serial' => 'XYZ-123',
'model' => 'S-Works SL7',
'isElectric' => false,
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));curl --request POST \
"http://{Product & region specific url}" \
--header "x-api-key: {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"policy\": {
\"product\": \"Sundays US\",
\"channel\": \"{{YOUR_CHANNEL}\",
\"bike\": {
\"value\": \"2000\",
\"type\": \"Road Bike\",
\"make\": \"Specialized\",
\"year\": \"2023\",
\"serial\": \"XYZ-123\",
\"model\": \"S-Works SL7\",
\"isElectric\": false
}
}
}"
import requests
import json
url = 'http://{Product & region specific url}'
payload = {
"policy": {
"product": "Sundays US",
"channel": "{{YOUR_CHANNEL}",
"bike": {
"value": "2000",
"type": "Road Bike",
"make": "Specialized",
"year": "2023",
"serial": "XYZ-123",
"model": "S-Works SL7",
"isElectric": false
}
}
}
headers = {
'x-api-key': '{YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()const url = new URL(
"http://{Product & region specific url}"
);
const headers = {
"x-api-key": "{YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"policy": {
"product": "Sundays US",
"channel": "{{YOUR_CHANNEL}",
"bike": {
"value": "2000",
"type": "Road Bike",
"make": "Specialized",
"year": "2023",
"serial": "XYZ-123",
"model": "S-Works SL7",
"isElectric": false
}
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
Show headers
cache-control: no-cache, private
content-type: application/json
{
"data": {
"type": "Policy",
"attributes": {
"annualPremium": 132,
"monthlyPremium": 11,
"tpq": "157bb4bfb68ddb5b2ec838db3e329f7781eff02461dc"
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.