swagger: "2.0"
info:
  description: |
    Provides services to allow the transfer of data to the IM1 Toolbar Transfer Services or GP Connect destinations; [https://quicksilva.com/nhs-integration/](https://quicksilva.com/nhs-integration/).<br/>The API Key `special-key` should be used to access the test endpoints
    To send messages via GP Connect, the sender MUST be an accredited GP Connect user, and there are additional requirements placed upon them.
    Contact Quicksilva to find out more about sending via GP Connect.

    (To send via GP Connect use specific GPConnect endpoints, identified as /api/v1/gpconnect/....)

  version: "1.0.0"
  title: "IM1 Toolbar Message Transfer Services"
  contact:
    email: "info@qxlva.com"
host: "toolbar.transfer.io"
basePath: "/api/v1"
tags:
- name: "topic"
  description: "Available messaging topics"
  externalDocs:
    description: "Find out more"
    url: "https://docs.quicksilva.info/toolbar/articles/sending/index.html"
- name: "Messaging"
  description: "Message transmission and status reporting endpoints"
  externalDocs:
    description: "Find out more"
    url: "https://docs.quicksilva.info/toolbar/articles/sending/index.html"
- name: "GPConnect Messaging"
  description: "Message transmission and status reporting endpoints for GPConnect endpoints"
  externalDocs:
    description: "Find out more"
    url: "https://docs.quicksilva.info/toolbar/articles/sending/index.html"
- name: "Test"
  description: "Client connectivity and authentication test endpoint"
  externalDocs:
    description: "Find out more"
    url: "https://docs.quicksilva.info/toolbar/articles/sending/index.html"
- name: "Instant Messaging Access Control"
  description: "Control access to instant messaging functions"
schemes:
- "https"
- "http"
paths:
  /test:
    get:
      tags:
      - "Test"
      summary: "Simple test endpoint to allow verification of a clients ability to connect and authenticate."
      responses:
        "200":
          description: "Success (client is authorized)"
        "401":
          description: "Unauthorized"
      deprecated: false
      security:
      - ApiKey: []
    post:
      tags:
      - "Test"
      summary: "Simple test endpoint to allow verification of a clients ability to connect and authenticate."
      responses:
        "200":
          description: "Success (client is authorized)"
        "401":
          description: "Unauthorized"
      deprecated: false
      security:
      - ApiKey: []
  /topics:
    get:
      tags:
      - "topic"
      summary: "Retrieve list of available topics"
      operationId: "topics"
      produces:
      - "application/json"
      responses:
        "200":
          description: "Success"
          schema:
            type: "array"
            items:
              $ref: "#/definitions/Topic"
        "401":
          description: "Unauthorized"
        "403":
          description: "Forbidden.  Supplied authorization material is valid, but access to this resource is forbidden."
      security:
      - ApiKey: []
  /messages:
    post:
      tags:
      - "Messaging"
      summary: "Send a message intended for a target system."
      operationId: "sendMessage"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: |
          Message for transfer.
          For GP Connect messages you should use the /gpconnect/messages/ endpoint.
          There is a 5MB per attachment size limit as required by the receiving GP systems.
          You may send a maximum of up to 10 attachments per message.
          You may include SNOMED Coded Data Items which will be applied to the patient record *as* coded data.
        required: true
        schema:
          $ref: "#/definitions/TransferMessage"
      responses:
        "200":
          description: "Success"
          schema:
            $ref: "#/definitions/SendMessageResponse"
        "400":
          description: "Bad Request"
          schema:
            $ref: "#/definitions/InvalidParametersProblem"
        "401":
          description: "Unauthorized"
        "406":
          description: "Not Acceptable. Attachment failed virus scanning"
          schema:
            $ref: "#/definitions/Problem"
        "403":
          description: "Forbidden.  Supplied authorization material is valid, but access to this resource is forbidden."
      security:
      - ApiKey: []
  /gpconnect/messages:
    post:
      tags:
      - "GPConnect Messaging"
      summary: "Send a message via GP Connect"
      operationId: "sendGpConnectMessage"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: "Message for transfer via GPConnect. \n For GP Connect messages only, the additional information as detailed is required\n For GP Connect message only, the 'subject' must identified by an NHS Number\n For GP Connect only, the attachment must be a single, GP Connect Consultation Summary PDF\n For GP Connect only, 'body' must exist and should be used for a 'Human readable description of the activity being sent'\n"
        required: true
        schema:
          $ref: "#/definitions/TransferMessageGpConnect"
      responses:
        "200":
          description: "Success"
          schema:
            $ref: "#/definitions/SendMessageResponse"
        "400":
          description: "Bad Request"
          schema:
            $ref: "#/definitions/InvalidParametersProblem"
        "401":
          description: "Unauthorized"
        "406":
          description: "Not Acceptable. Attachment failed virus scanning"
          schema:
            $ref: "#/definitions/Problem"
        "403":
          description: "Forbidden.  Supplied authorization material is valid, but access to this resource is forbidden."
      security:
      - ApiKey: []
  /messages/instant:
    post:
      tags:
      - "Messaging"
      summary: "Sends an 'instant' message intended for a target system to be incorporated into the patient record without further review\nNB: This endpoint may only be used when the targeted recieving *user* has specifically authorised the sender to do so, \nAND the sender has an appropriate access token denoting that authorisation, carried in the additional security header detailed.\nThe access token alone will identify the intended recipient user.\n"
      operationId: "sendMessageInstant"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: |
          Message for transfer via previously authorised Instant messaging route.  Not suitable for GPConnect.
        required: true
        schema:
          allOf:
          - $ref: "#/definitions/TransferMessage"
          - type: object
          example: |
            {
              "messageId": "947639e3-a7c9-4010-b0a9-931e828b9d21",
              "type": "ToolbarInstantMessage",
              "topic": "DispenseEventNotification",
              "recipient": {
                "id": {
                  "value": "HSPT003",
                  "type": "OdsUserId"
                }
              },
              "subject": {
                "id": {
                  "value": "4879573981",
                  "type": "NHSNumber"
                }
              },
              "expiryDateTime": "2025-07-21T17:32:28+01:00",
              "body": {
                "mimeType": "text/plain",
                "content": "Dispense Event Notification: Copy of prescription form in attached PDF"
              },
              "attachments": [
                {
                  "mimeType": "application/pdf",
                  "fileName": "PatientInformation.pdf",
                  "content": "QW4gZXhhbXBsZSBvZiBhIHBheWxvYWQgYmVpbmcgZW5jb2RlZCBmb3IgdHJhbnNmZXIKVGhpcyBpcyBhIHNpbXBsZSB0ZXh0IHBheWxvYWQsIGJ1dCBjb3VsZCBiZSwgYW1vbmdzdCBvdGhlciBleGFtcGxlczsKLSBQREYKLSBKUEVHCi0gTVAz"
                }
              ],
              "codedDataItems": [
                {
                  "code": "399304008",
                  "value": 140,
                  "units": "mmHg",
                  "additionalText": "BP Systolic taken at consultation"
                }
              ]
            }
      responses:
        "200":
          description: "Success"
          schema:
            $ref: "#/definitions/SendMessageResponse"
        "400":
          description: "Bad Request"
          schema:
            $ref: "#/definitions/InvalidParametersProblem"
        "401":
          description: "Unauthorized"
        "406":
          description: "Not Acceptable. Attachment failed virus scanning"
          schema:
            $ref: "#/definitions/Problem"
        "403":
          description: "Forbidden.  Supplied authorization material is valid, but access to this resource is forbidden."
      security:
      - ApiKey: []
      - ConneqtInstantAccessToken: []
  /messages/{messageId}/status:
    get:
      tags:
      - "Messaging"
      summary: "Gets the status of the identified message. Will only return status for messages sent by the authenticated client system. Note, messages past their expiration date may be removed at any time."
      operationId: "getMessageStatus"
      produces:
      - "application/json"
      parameters:
      - name: "messageId"
        in: "path"
        description: "ID of message to retrieve status for (a UUID)."
        required: true
        type: "string"
        format: "uuid"
      responses:
        "200":
          description: "Successful operation"
          schema:
            $ref: "#/definitions/MessageStatus"
        "401":
          description: "Unauthorized"
        "403":
          description: "Forbidden. Supplied authorization material is valid, but access to this resource is forbidden"
        "404":
          description: "Message with ID not found, either overall or for your organisation"
      security:
      - ApiKey: []
  /gpconnect/messages/{messageId}/status:
    get:
      tags:
      - "GPConnect Messaging"
      summary: "Gets the status of the identified GP Connect message. Will only return status for messages sent by the authenticated client system. Note, messages past their expiration date may be removed at any time."
      operationId: "getGpConnectMessageStatus"
      produces:
      - "application/json"
      parameters:
      - name: "messageId"
        in: "path"
        description: "ID of message to retrieve status for (a UUID)."
        required: true
        type: "string"
        format: "uuid"
      responses:
        "200":
          description: "Successful operation"
          schema:
            $ref: "#/definitions/MessageStatus"
        "401":
          description: "Unauthorized"
        "403":
          description: "Forbidden. Supplied authorization material is valid, but access to this resource is forbidden"
        "404":
          description: "Message with ID not found, either overall or for your organisation"
      security:
      - ApiKey: []
  /messages/instant/access/token:
    post:
      tags:
      - "Instant Messaging Access Control"
      summary: "Use a valid, one-time access code to establish an instant messaginging permissive link between a message sending service and a toolbar user"
      operationId: "createAccessToken"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: "Instant messaging access token creation request."
        required: true
        schema:
          $ref: "#/definitions/AccessTokenCreationRequest"
      responses:
        "200":
          description: "Successful operation, instant messaging link established"
          schema:
            $ref: "#/definitions/InstantMessagingAccessToken"
        "400":
          description: "Bad Request.  The supplied access code is not valid"
          schema:
            $ref: "#/definitions/Problem"
        "401":
          description: "Unauthorized"
        "403":
          description: "Forbidden. Supplied authorization material is valid, but access to this resource is forbidden"
      security:
      - ApiKey: []
  /messages/instant/access/token/verify:
    get:
      tags:
      - "Instant Messaging Access Control"
      summary: "Verifies that the provided access token is current and valid"
      operationId: "verifyAccessToken"
      parameters:
      - name: "Conneqt-Instant-Access-Token"
        in: "header"
        description: "Access Token to verify"
        required: true
        type: "string"
        format: "uuid"
      responses:
        "200":
          description: "Successful operation, access token is valid"
        "401":
          description: "Unauthorized"
        "403":
          description: "Forbidden. Supplied authorization material is valid, but access to this resource is forbidden"
        "410":
          description: "Gone.  Access Token is not valid"
      security:
      - ApiKey: []
securityDefinitions:
  ApiKey:
    type: "apiKey"
    name: "ApiKey"
    in: "header"
  ConneqtInstantAccessToken:
    type: "apiKey"
    name: "Conneqt-Instant-Access-Token"
    in: header
    description: "'Instant' Messaging access token previously received as authorisation for sender to send instant messages."
definitions:
  Topic:
    type: "object"
    required:
    - "topicName"
    properties:
      topicName:
        type: "string"
        description: "The unique name of a topic"
        example: "DispenseEventNotification"
  TransferMessageBase:
    type: "object"
    required:
    - "messageId"
    - "topic"
    - "recipient"
    - "subject"
    - "attachments"
    properties:
      messageId:
        type: "string"
        format: "uuid"
        description: "Unique message ID used as reference for tracking and status retrieval. Must be a UUID."
        example: "947639e3-a7c9-4010-b0a9-931e828b9d21"
        minLength: 1
      type:
        type: "string"
        description: "Message Type. Optional field describing type of message being sent, if not specified ToolbarMessage will be used."
        $ref: "#/definitions/MessageType"
        default: "ToolbarMessage"
      topic:
        type: "string"
        description: "Message Topic.  Must be populated with a value available from the /topics endpoint"
        example: "DispenseEventNotification"
      recipient:
        type: "object"
        properties:
          id:
            $ref: "#/definitions/TypedIdentifier"
        description: "The target recipient of this message.  For toolbar messaging, Recipient must be known to service.  For GP Connect, may be set to 'UNK' or 'GPConnect' if not known. Specific ID type used is dependent on recipient's domain"
      subject:
        type: "object"
        properties:
          id:
            $ref: "#/definitions/TypedIdentifier"
        description: "The subject of the message.  For GPConnect MUST be NHS Number."
        example: {id: {value: "4879573981", type: NHSNumber}}
      expiryDateTime:
        type: "string"
        format: "date-time"
        description: |
          The Date and Time that the message will expire and no longer be eligible for delivery.
          Full RFC3339 format timestamps with 'Z' or offset must be used.
          If an expiry date is not specified, a default expiry period will be applied.
          Must be in the future.
        example: "2025-07-21T17:32:28+01:00"
      body:
        allOf:
        - $ref: "#/definitions/Content"
        - description: "Message content. For GP Connect only this should be a 'human readable description of the activity being sent'"
        - example:
            mimeType: "text/plain"
            content: "Dispense Event Notification: Copy of prescription form in attached PDF"
      attachments:
        type: "array"
        minItems: 1
        maxItems: 10
        items:
          allOf:
          - $ref: "#/definitions/Attachment"
          - description: "Message content"
  TransferMessage:
    allOf:
    - $ref: '#/definitions/TransferMessageBase'
    - type: object
    properties:
      codedDataItems:
        type: "array"
        minItems: 1
        items:
          allOf:
          - $ref: "#/definitions/SNOMEDCodedDataItem"
          - description: "A list of SNOMED Coded Data Items"
  TransferMessageGpConnect:
    allOf:
    - $ref: '#/definitions/TransferMessageBase'
    - type: object
      required:
      - "gpConnectAdditionalInformation"
      properties:
        gpConnectAdditionalInformation:
          type: "object"
          $ref: "#/definitions/GPConnectAdditionalInformation"
          description: "Optional information required if the message is intended for onwards tranmission via GPConnect"
      example: "{\n  \"messageId\": \"947639e3-a7c9-4010-b0a9-931e828b9d21\",\n  \"type\": \"GpConnectMessage\",\n  \"topic\": \"DispenseEventNotification\",\n  \"recipient\": {\n    \"id\": {\n      \"value\": \"HSPT003\",\n      \"type\": \"OdsUserId\"\n    }\n  },\n  \"subject\": {\n    \"id\": {\n      \"value\": \"4879573981\",\n      \"type\": \"NHSNumber\"\n    }\n  },\n  \"expiryDateTime\": \"2025-07-21T17:32:28+01:00\",\n  \"body\": {\n    \"mimeType\": \"text/plain\",\n    \"content\": \"Dispense Event Notification: Copy of prescription form in attached PDF\"\n  },\n  \"attachments\": [\n    {\n      \"mimeType\": \"application/pdf\",\n      \"fileName\": \"PatientInformation.pdf\",\n      \"content\": \"QW4gZXhhbXBsZSBvZiBhIHBheWxvYWQgYmVpbmcgZW5jb2RlZCBmb3IgdHJhbnNmZXIKVGhpcyBpcyBhIHNpbXBsZSB0ZXh0IHBheWxvYWQsIGJ1dCBjb3VsZCBiZSwgYW1vbmdzdCBvdGhlciBleGFtcGxlczsKLSBQREYKLSBKUEVHCi0gTVAz\"\n    }\n  ],\n  \"gpConnectAdditionalInformation\": {\n    \"recipientType\": \"For Action\",\n    \"senderReference\": \"Consultation-27542d94-26b3-4c2e-9056-5a951b659b60\",\n    \"confidentiality\": false,\n    \"relatesTo\": \"8c7b1cb4-51ff-49f0-a2be-c7c5592e94f1\",\n    \"versionNumber\": 1,\n    \"patient\": {\n      \"name\": {\n        \"family\": \"Jones\",\n        \"given\": \"Henry\"\n      },\n      \"dateOfBirth\": \"1975-11-20\"\n    },\n    \"practitioner\": {\n      \"name\": {\n        \"family\": \"Jones\",\n        \"given\": \"Henry\"\n      },\n      \"sdsUserId\": \"153632348546\",\n      \"telephone\": \"01249 751000\",\n      \"email\": \"example@test.com\"\n    },\n    \"organisation\": {\n      \"telephone\": \"01249 751000\",\n      \"email\": \"example@test.com\"\n    },\n    \"typeCode\": \"325871000000103\",\n    \"typeDisplay\": \"Remote consultation encounter type (record artifact)\"\n  }\n}    \n"
  SendMessageResponse:
    type: "object"
    required:
    - "messageStatusEndpoint"
    properties:
      messageStatusEndpoint:
        description: "Endpoint that may be used to retrieve status of identified message (by an authenticated client)"
        type: "string"
        example: "/api/v1/message/947639e3-a7c9-4010-b0a9-931e828b9d21/status"
  TypedIdentifier:
    type: "object"
    required:
    - "value"
    properties:
      value:
        type: "string"
        description: "Identifier value"
        example: "HSPT003"
        minLength: 1
      type:
        type: "string"
        description: "Type of Identifier.  Only required in event ID type requires specific handling"
        example: "OdsUserId"
        minLength: 1
  GPConnectAdditionalInformation:
    type: "object"
    required:
    - "recipientType"
    - "senderReference"
    - "confidentiality"
    - "versionNumber"
    - "patient"
    - "typeCode"
    - "typeDisplay"
    properties:
      recipientType:
        type: "string"
        enum:
        - For Information
        - For Action
        description: "GP Connect recipient type"
        example: "For Action"
      senderReference:
        type: "string"
        description: "A unique identifier of an encounter (i.e. consultation) by the sender"
        example: "Consultation-27542d94-26b3-4c2e-9056-5a951b659b60"
        minLength: 1
      confidentiality:
        type: "boolean"
        description: "If the message is confidential or not"
        example: "false"
      relatesTo:
        type: "string"
        format: "uuid"
        description: "ID of previously sent message being replaced"
        example: "8c7b1cb4-51ff-49f0-a2be-c7c5592e94f1"
      versionNumber:
        type: "integer"
        description: "version number of document, must be incremented when replacing previous document"
        example: "1"
        minLength: 1
      patient:
        type: "object"
        $ref: "#/definitions/Patient"
        description: "Patient subject additional information"
      practitioner:
        type: "object"
        $ref: "#/definitions/Practitioner"
        description: "GP Connect sending practitioner information. Must be provided if known"
      organisation:
        type: "object"
        $ref: "#/definitions/Organisation"
        description: "GP Connect sending organisation information"
      typeCode:
        type: "string"
        description: "A SNOMED code from the SNOMED Record composition type simple reference set (foundation metadata concept)."
        example: "325871000000103"
        minLength: 1
      typeDisplay:
        type: "string"
        description: "A SNOMED code display value from the SNOMED Record composition type simple reference set (foundation metadata concept)."
        example: "Remote consultation encounter type (record artifact)"
        minLength: 1
  Patient:
    type: "object"
    required:
    - "name"
    - "dateOfBirth"
    properties:
      name:
        type: "object"
        description: "Name of Patient"
        $ref: "#/definitions/Name"
      dateOfBirth:
        type: "string"
        format: "date"
        description: "The date of birth of the GP Connect Patient Subject"
        example: "1975-11-20"
  Name:
    type: "object"
    required:
    - "family"
    - "given"
    properties:
      family:
        type: "string"
        description: "Family name"
        example: "Jones"
        minLength: 1
      given:
        type: "string"
        description: "The first given name"
        example: "Henry"
        minLength: 1
  Practitioner:
    type: "object"
    required:
    - "name"
    properties:
      name:
        type: "object"
        description: "Name of Practitioner"
        $ref: "#/definitions/Name"
      sdsUserId:
        type: "string"
        description: "\"The SDS User ID of the practitioner. Must be provided *if known*\". \nIf not known, you may either omit this field, provide and empty string OR provide the value 'UNK'.\nIf omitted or blank, and in order to comply with NHS Guidance, \nthe conneQt service will insert the value UNK into the generated GP Connect message\n"
        example: "153632348546"
      telephone:
        type: "string"
        description: "The telephone number of the practitioner"
        example: "01249 751000"
        minLength: 1
        pattern: "^[\\d() +]+$"
      email:
        type: "string"
        description: "The email address of the practitioner"
        example: "example@test.com"
        minLength: 1
        pattern: "^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"
  Organisation:
    type: "object"
    properties:
      telephone:
        type: "string"
        description: "The telephone number of the practitioner"
        example: "01249 751000"
        minLength: 1
        pattern: "^[\\d() +]+$"
      email:
        type: "string"
        description: "The email address of the practitioner"
        example: "example@test.com"
        minLength: 1
        pattern: "^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"
  Content:
    type: "object"
    required:
    - "mimeType"
    - "content"
    properties:
      mimeType:
        type: "string"
        description: "The MIME Type of any included content. Currently supports only text/plain"
        example: "text/plain"
        enum:
        - "text/plain"
      content:
        type: "string"
        description: "Message Content"
        example: "Dispense Event Notification: Copy of prescription form in attached PDF"
  Attachment:
    type: "object"
    required:
    - "mimeType"
    - "fileName"
    - "content"
    description: "An actual file to be sent to the GP System, Base64 Encoded.   There is a 5MB size limit per attachment, as required by the receiving GP systems."
    properties:
      mimeType:
        type: "string"
        description: "The MIME Type of the attachment, supports PDF, TXT, JPEG and PNG.\n          #magic___^_^___line\nMIME type 'text/vnd.qxlva.conneqt.consultation' is to represent text that will be applied to the patient\nrecord as user searchable text, rather than as a file upload, but is otherwise to be treated as plain text. \nThe exact form this takes on the patient record is dependent on the GP System.\n"
        example: "application/pdf"
        enum:
        - "application/pdf"
        - "text/plain"
        - "image/png"
        - "image/jpeg"
        - "text/vnd.qxlva.conneqt.consultation"
      fileName:
        type: "string"
        description: "File name of attachment, must be valid Windows file name with extension and leading and/or trailing whitespace or periods are not allowed."
        example: "PatientInformation.pdf"
        minLength: 1
        pattern: "^(?![.\\s])(?=.*\\.)((?!(.*[.\\s]$|aux|clock\\$|con|nul|prn|com[1-9]|lpt[1-9]|AUX|CLOCK\\$|CON|NUL|PRN|COM[1-9]|LPT[1-9])(?:$|\\.))|\\s|[\\.]{2,})[^:*\\\"?/<>\\\\|\0-\a]{1,254}$"
      content:
        type: "string"
        description: "Base64 Encoded data content for transfer, e.g. a PDF, an image (PNG or JPEG) or text file"
        example: "QW4gZXhhbXBsZSBvZiBhIHBheWxvYWQgYmVpbmcgZW5jb2RlZCBmb3IgdHJhbnNmZXIKVGhpcyBpcyBhIHNpbXBsZSB0ZXh0IHBheWxvYWQsIGJ1dCBjb3VsZCBiZSwgYW1vbmdzdCBvdGhlciBleGFtcGxlczsKLSBQREYKLSBKUEVHCi0gTVAz"
        minLength: 1
  SNOMEDCodedDataItem:
    type: "object"
    required:
    - "code"
    description: "An individual SNOMED Coded Data Items"
    properties:
      code:
        type: "string"
        description: "The SNOMED code"
        example: "399304008"
        minLength: 1
        maxLength: 18
      value:
        type: "number"
        description: "The value of the coded data item. Optional if concept does not require a value"
        example: "140"
      units:
        type: "string"
        description: "Optional 'units' field"
        example: "mmHg"
      additionalText:
        type: "string"
        description: "Optional additional text field"
        example: "BP Systolic taken at consultation"
  MessageStatus:
    description: Status of a message within the transfer service
    type: object
    required:
    - "messageId"
    - "status"
    properties:
      messageId:
        type: string
        description: Message ID
        example: "947639e3-a7c9-4010-b0a9-931e828b9d21"
      status:
        type: string
        description: |
          Status of message, options are:
          * PENDING - Message accepted and document awaiting action by recipient
          * COMPLETED - Document imported into patient record
          * COMPLETED_WITH_ERRORS - Message accepted, but import to patient record had partial failures.  See substatus for details of the errors.
          * REJECTED - Document rejected by recipient
          * FAILED - Document failed to import
          * EXPIRED - Message expired before being downloaded by recipient
        enum:
        - PENDING
        - COMPLETED
        - COMPLETED_WITH_ERRORS
        - REJECTED
        - FAILED
        - EXPIRED
        example: "PENDING"
      subStatus:
        type: string
        description: Optional non enumerated message sub-status.
        example: "Awaiting delivery"
      comment:
        type: string
        description: Optional comment relating to status change
        example: "Patient update rejected due to missing information"
  Problem:
    description: A Problem Details object, as specified in RFC 7807
    type: object
    properties:
      type:
        type: string
        format: uri
        description: A URI reference [RFC3986] that identifies the problem type and may be de-referenced for a human readable explanation of the error type.
        default: about:blank
      title:
        type: string
        description: A short, human-readable summary of the problem type.  It SHOULD NOT change from occurrence to occurrence of the problem.
        example: Service Unavailable
      status:
        type: integer
        format: int32
        description: The HTTP status code generated by the origin server for this occurrence of the problem.
        minimum: 400
        maximum: 600
        exclusiveMaximum: true
        example: 503
      detail:
        type: string
        description: A human-readable explanation specific to this occurrence of the problem
      instance:
        type: string
        format: uri
        description: A URI reference that identifies the specific occurrence of the problem.  It may or may not yield further information if dereferenced. Please use as a reference in support queries.
  InvalidParametersProblem:
    description: Problem details for invalid input parameter(s)
    type: object
    allOf:
    - $ref: "#/definitions/Problem"
    properties:
      invalidParams:
        type: array
        description: An array of parameter OpenAPI violations
        items:
          $ref: "#/definitions/InvalidParameter"
    example: {"type": "https//qxlva.com/im1toolbar/documentation/api/v1/validation-error", "title": "Request Validation Error", "status": 400, "detail": "Invalid parameters", "instance": "22835b83-1050-49d2-9a46-ae71768150dc", "invalidParameters": [{"name": "recipient", "reason": "Unknown Recipient"}, {"name": "body.mimeType", "reason": "Must be 'text/plain'", "value": "text/plain"}]}
  InvalidParameter:
    type: object
    properties:
      name:
        description: Invalid parameter name
        type: string
      reason:
        description: A message detailing the nature of the invalidity
        type: string
      value:
        description: The value of the invalid parameter
  MessageType:
    type: string
    description: |
      Type of message, options are:
      * ToolbarMessage - Message for Toolbar recipient
      * ToolbarInstantMessage - Message for toolbar recipient, intended for 'instant' (without review) application to the patient record.
      * GPConnectMessage - Message for GP Connect recipient
    enum:
    - ToolbarMessage
    - GPConnectMessage
    - ToolbarInstantMessage
    example: "ToolbarMessage"
  InstantMessagingAccessToken:
    type: object
    description: Access token to be used when sending instant messages to the recipient the token was created for.
    required:
    - "token"
    properties:
      token:
        type: string
        description: "Access token value, v4 UUID"
        example: "ea4f820e-f352-4515-af73-630220045ef0"
        format: UUID
  AccessTokenCreationRequest:
    type: object
    description: Details of a request to create an instant messaging permissive access token based on a specified one-time access code
    required:
    - "accessCode"
    properties:
      accessCode:
        type: string
        description: "Access code value, 8 char alpha-numeric"
        example: "JH23MA1Z"
        minLength: 8
        maxLength: 8
externalDocs:
  description: "Find out more about IM1 Toolbar"
  url: "https://docs.quicksilva.info/toolbar/index.html"
