openapi: 3.0.3
info:
  title: 'TTB external API documentation'
  description: ''
  version: 1.0.0
servers:
  -
    url: 'http://{Product & region specific url}'
paths:
  /full-quote:
    post:
      summary: 'POST Full Quote'
      operationId: pOSTFullQuote
      description: "<aside>Use this endpoint if you have customer and bike information available.</aside>\n\n The request is made to one of the following URLS:\n\n * Churchill Dev: https://api-ext-dev.twothreebird.com/tpq/churchill/create-quote\n * Churchill Prod: https://api-ext.twothreebird.com/tpq/churchill/create-quote\n * Sundays US Dev: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/v1/tpq\n * Sundays US Prod: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/live/tpq\n * Sundays UK Dev: https://api-ext-dev.twothreebird.com/tpq/sundays-uk/create-quote\n * Sundays UK Prod: https://api-ext.twothreebird.com/tpq/sundays-uk/create-quote\n\n The response provides estimated monthly and annual premiums.\n The response also contains a \"tpq\" value which is used to generate the customer redirect URL. This TPQ is used to generate\n the redirect URL for the customer. Replace {TPQ} with the received TPQ for the following environments.\n\n * Churchill Dev: https://dev-churchill.dlg.twothreebird.com/tpq/{TPQ}\n * Churchill Prod: https://churchill.dlg.twothreebird.com/tpq/{TPQ}\n * Sundays US Dev: https://dev-quote.sus.twothreebird.com/ql?tpq={TPQ}\n * Sundays US Prod: https://quote.sundaysinsurance.com/ql/tpq/{TPQ}\n * Sundays UK Dev: https://sundays.uk.23bird.dev/quote/tpq/{TPQ}\n * Sundays UK Prod: https://quote.sundaysinsurance.co.uk/quote/tpq/{TPQ}"
      parameters:
        -
          in: header
          name: x-api-key
          description: ''
          example: '{YOUR_AUTH_KEY}'
          schema:
            type: string
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    type: Policy
                    attributes:
                      annualPremium: 98.64
                      monthlyPremium: 8.22
                      tpq: 9abc28f7a9ecb9e195487d70be34f49472c74621d659
                properties:
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: Policy
                      attributes:
                        type: object
                        properties:
                          annualPremium:
                            type: number
                            example: 98.64
                          monthlyPremium:
                            type: number
                            example: 8.22
                          tpq:
                            type: string
                            example: 9abc28f7a9ecb9e195487d70be34f49472c74621d659
      tags:
        - 'Quote endpoints'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer:
                  type: object
                  description: ''
                  example: []
                  nullable: false
                  properties:
                    brand:
                      type: string
                      description: 'The Brand to which the customer belongs. Available options: <ul><li>Sundays US</li><li>Sundays UK</li><li>Churchill</li></ul>'
                      example: 'Sundays UK'
                      nullable: false
                    dateOfBirth:
                      type: string
                      description: 'The customer date of birth in YYYY-MM-DD format. Age must be equal or greater than 18.'
                      example: '1999-12-31'
                      nullable: false
                    firstName:
                      type: string
                      description: "The customer's first name."
                      example: John
                      nullable: false
                    lastName:
                      type: string
                      description: "The customer's last name."
                      example: Smith
                      nullable: false
                    contactNumber:
                      type: string
                      description: "The customer's contact number."
                      example: '2124561234'
                      nullable: false
                    email:
                      type: email
                      description: "The customer's email address."
                      example: john.smith.x@test.com
                      nullable: false
                    personalInfoUse:
                      type: boolean
                      description: 'Whether the customer has agreed that personal info may be used to contact them regarding their quote.'
                      example: false
                      nullable: false
                    state:
                      type: string
                      description: "The customer's 2 letter state <br />Required when creating quotes for Sundays US."
                      example: null
                      nullable: false
                    address:
                      type: object
                      description: ''
                      example: []
                      nullable: false
                      properties:
                        line1:
                          type: string
                          description: "The first line of the customer's address."
                          example: 'Flat 7'
                          nullable: false
                        line2:
                          type: string
                          description: "The second line of the customer's address. 25 Church Road"
                          example: quo
                          nullable: false
                        town:
                          type: string
                          description: "The town of the customer's address."
                          example: London
                          nullable: false
                        province:
                          type: string
                          description: "The province/county/state of the customer's address."
                          example: London
                          nullable: false
                        postal_code:
                          type: string
                          description: "The postal code of the customer's address."
                          example: 'NW10 9BA'
                          nullable: false
                      required:
                        - line1
                        - town
                        - province
                        - postal_code
                  required:
                    - brand
                    - dateOfBirth
                    - firstName
                    - lastName
                    - contactNumber
                    - email
                    - address
                policy:
                  type: object
                  description: ''
                  example: []
                  nullable: false
                  properties:
                    product:
                      type: string
                      description: 'The Product to which the policy will belong.<br />Available options: <ul><li>Sundays US</li><li>Sundays UK</li><li>Churchill</li></ul>'
                      example: 'Sundays UK'
                      nullable: false
                    policyType:
                      type: 'in:BC,C,B,V,I'
                      description: 'The policy type (BC: Bicycle & Cyclist, B: Bicycle, C: Cyclist, V: Vehicle, I: Insurer).'
                      example: BC
                      nullable: false
                    channel:
                      type: string
                      description: 'Your channel name (provided by TTB).'
                      example: '{{YOUR_CHANNEL}'
                      nullable: false
                    policyStartDate:
                      type: string
                      description: 'The proposed start date for the policy in YYYY-MM-DD format.'
                      example: '2023-02-14'
                      nullable: false
                    excess:
                      type: integer
                      description: 'The excess for the policy. <br />Available options: <ul><li>Sundays US<ul><li>150</li><li>250</li><li>350</li></ul></li><li>Sundays UK:<ul><li>50</li><li>100</li><li>200</li></ul></li></ul>'
                      example: 200
                      nullable: false
                    Insurable:
                      type: array
                      description: ''
                      example:
                        - []
                      items:
                        type: object
                        properties:
                          value:
                            type: numeric
                            description: 'The value of the insurable.<ul><li>Bike:<ul><li>Sundays UK</li><ul><li>Minimum: 250</li><li>Maximum: 15000</li></ul><li>Sundays US</li><ul><li>Minimum: 300</li><li>Maximum: 21500</li></ul><li>Churchill</li><ul><li>Minimum: 250</li><li>Maximum: 15000</li></ul></ul></li><li>Accessories:<ul><li>Sundays UK</li><ul><li>Minimum: 10</li><li>Maximum: 5000</li></ul><li>Sundays US</li><ul><li>Minimum: 150</li><li>Maximum: 1000</li></ul><li>Churchill</li><ul><li>Minimum: 250</li><li>Maximum: 1000</li></ul></ul></li><li>Wheelset:<ul><li>Sundays UK</li><ul><li>Minimum: 10</li><li>Maximum: 5000</li></ul><li>Sundays US</li><ul><li>Minimum: 150</li><li>Maximum: 5000</li></ul></ul></li></ul> <br />Required when specifying "Accessories", "Bike" or "Wheelset" as type being created.'
                            example: '2000'
                            nullable: false
                          type:
                            type: string
                            description: 'The type of insurable being added to the policy.<br /><i>Standard options:</i><ul><li>Accessories</li><li>Bike</li><li>Cyclist Legal Cover</li><li>Racing</li><li>Worldwide travel</li></ul><br /> <i>Sundays UK additional options:</i> <ul><li>Cyclist Racing Cover</li><li>Cyclist Personal Liability</li><li>Wheelset</li></ul> <br /><i>Sundays US additional options:</i><ul><li>Cyclist Personal Injury</li><li>New for Old</li><li>Wheelset</li></ul> <br /><i>Churchill additional options:</i><ul><li>Cyclist Personal Injury</li></ul>'
                            example: Bike
                            nullable: false
                          bikeType:
                            type: string
                            description: 'The bike type.<br />Required when specifying "Bike" as type being created. <br /><i>Standard Options</i><ul><li>Road Bike</li><li>Mountain Bike</li><li>Gravel Bike</li><li>Cargo Bike</li><li>Folding Bike</li><li>BMX</li><li>Track Bike</li><li>Other</li></ul><i>Sundays UK Additional Options:</i><ul><li>City Bike</li><li>Triathlon/Time Trial</li><li>Hybrid Bike</li><li>CycloCross</li><li>Touring Bike</li></ul><i>Sundays US Additional Options:</i><ul><li>Commuter Bike</li><li>Hybrid Bike</li></ul><i>Churchill Additional Options:</i><ul><li>Bespoke</li><li>Commuter Bike</li><li>Cyclocross</li><li>Downhill</li><li>Electric Bike</li><li>Electric Cargo Bike</li><li>Hybrid/City Bike</li><li>Single Speed</li><li>Triathlon/Time Trial</li></ul>'
                            example: 'Road Bike'
                            nullable: false
                          bikeMake:
                            type: string
                            description: 'The bike make.'
                            example: Specialized
                            nullable: false
                          isElectric:
                            type: boolean
                            description: 'Whether the bike is electric or not.'
                            example: null
                            nullable: false
                          storage:
                            type: string
                            description: 'Where the bike is stored. <br />Required when specifying "Bike" as type being created and Product is "Churchill" or "Sundays UK". <br />Available options: <ul><li>Inside my property</li><li>Inside my garage</li><li>An outbuilding on my property</li><li>A communal area in my property</li><li>Inside my wooden shed on my property</li><li>Inside my metal shed on my property</li><li>In an off-site bicycle hanger</li><li>Other</li></ul>'
                            example: Other
                            nullable: false
                          bikeModel:
                            type: string
                            description: 'The bike model.'
                            example: 'S-Works SL7'
                            nullable: false
                          bikeYear:
                            type: string
                            description: 'The bike year model.<br />Required when specifying "Bike" as type being created.'
                            example: '2018'
                            nullable: false
                        required:
                          - value
                          - type
                  required:
                    - product
                    - policyType
                    - channel
                    - policyStartDate
                    - excess
                    - Insurable
              required:
                - customer
                - policy
  /abbreviated-quote:
    post:
      summary: 'POST Abbreviated Quote'
      operationId: pOSTAbbreviatedQuote
      description: "<aside>Use this endpoint if you have bike information but do not have (or cannot collect) any customer information.</aside>\nThe response provides estimated monthly and annual premiums.\n\nThe request is made to one of the following URLS:\n  * Sundays US Dev: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/v1/create-quote\n  * Sundays US Prod: https://9tr26jbq04.execute-api.us-west-1.amazonaws.com/live/create-quote\n\nThe response provides estimated monthly and annual premiums.\nThe response also contains a \"tpq\" value which is used to generate the customer redirect URL. This TPQ is used to generate\nthe redirect URL for the customer. Replace {TPQ} with the received TPQ for the following environments.\n\n  * Sundays US Dev: https://dev-quote.sus.twothreebird.com/ql?tpq={TPQ}\n  * Sundays US Prod: https://quote.sundaysinsurance.com/ql/tpq/{TPQ}"
      parameters:
        -
          in: header
          name: x-api-key
          description: ''
          example: '{YOUR_AUTH_KEY}'
          schema:
            type: string
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    type: Policy
                    attributes:
                      annualPremium: 132
                      monthlyPremium: 11
                      tpq: 157bb4bfb68ddb5b2ec838db3e329f7781eff02461dc
                properties:
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: Policy
                      attributes:
                        type: object
                        properties:
                          annualPremium:
                            type: integer
                            example: 132
                          monthlyPremium:
                            type: integer
                            example: 11
                          tpq:
                            type: string
                            example: 157bb4bfb68ddb5b2ec838db3e329f7781eff02461dc
      tags:
        - 'Quote endpoints'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                policy:
                  type: object
                  description: 'Policy object.'
                  example: null
                  nullable: false
                  properties:
                    product:
                      type: string
                      description: 'The Product for which you want to generate a quote.'
                      example: 'Sundays US'
                      nullable: false
                    channel:
                      type: string
                      description: 'Your channel name (provided by TTB).'
                      example: '{{YOUR_CHANNEL}'
                      nullable: false
                    bike:
                      type: object
                      description: 'Bike object for which you want to generate a quote.'
                      example: null
                      nullable: false
                      properties:
                        value:
                          type: numeric
                          description: 'The value of the insurable.<ul><li>Bike:<ul><li>Minimum: 300</li><li>Maximum: 21500</li></ul></li></ul>'
                          example: '2000'
                          nullable: false
                        type:
                          type: string
                          description: 'The bike type of the insurable.<br />Available options: <ul><li>Road Bike</li><li>Mountain Bike</li><li>Electric Bicycle</li><li>Cargo E-bike</li><li>Gravel Bike</li><li>Folding Bike</li><li>Hybrid Bike</li><li>BMX</li><li>Track Bike</li></ul>'
                          example: 'Road Bike'
                          nullable: false
                        make:
                          type: string
                          description: 'The bike make of the insurable. Must be at least 2 characters. Must not be greater than 50 characters.'
                          example: Specialized
                          nullable: false
                        year:
                          type: string
                          description: 'The bike year model of the insurable.'
                          example: '2023'
                          nullable: false
                        serial:
                          type: string
                          description: 'The serial number of the insurable. Must be at least 2 characters. Must not be greater than 50 characters.'
                          example: XYZ-123
                          nullable: false
                        model:
                          type: string
                          description: 'The bike model of the insurable.'
                          example: 'S-Works SL7'
                          nullable: false
                        isElectric:
                          type: boolean
                          description: 'Whether the bike is electric or not.'
                          example: false
                          nullable: false
                      required:
                        - value
                        - type
                        - make
                        - year
                  required:
                    - product
                    - channel
                    - bike
              required:
                - policy
tags:
  -
    name: 'Quote endpoints'
    description: 'Endpoints for generating quotes'
components:
  securitySchemes:
    default:
      type: apiKey
      name: x-api-key
      in: header
      description: 'Your API key and channel will be provided to you by TTB.'
security:
  -
    default: []
