{
  "openapi": "3.0.1",
  "info": {
    "title": "Standard PACS Interface (SPI)",
    "description": "The SPI is a combination of a subset of ezyVet's API and the PACS provider's API that provides customers a consistent workflow experience.",
    "license": {
      "name": "ezyVet API license",
      "url": "https://www.ezyvet.com/private-api-terms-and-conditions"
    },
    "contact": {
      "email": "apisupport-ezyvet@idexx.com"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.ezyvet.com",
      "description": "ezyVet Production Environment"
    },
    {
      "url": "https://api.trial.ezyvet.com",
      "description": "ezyVet Trial Environment"
    }
  ],
  "security": [
    {
      "bearerAuth": [
        "read-diagnosticresult",
        "write-diagnosticresult",
        "read-attachment",
        "write-attachment",
        "read-separation"
      ]
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://api.ezyvet.com/v1/oauth/access_token",
            "scopes": {
              "read-diagnosticresult": "Read diagnostic result resources",
              "read-separation": "Read separation resources",
              "write-attachment": "Create and update attachment resources",
              "write-diagnosticresult": "Create and update diagnostic result resources"
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BadRequest"
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal Server Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InternalError"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found",
        "content": {
          "text/html": {
            "schema": {
              "$ref": "#/components/schemas/NotFound"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Too Many Requests",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/TooManyRequests"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Unauthorized"
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Unprocessable Entity",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/UnprocessableEntity"
            }
          }
        }
      }
    },
    "schemas": {
      "BadRequest": {
        "description": "Bad Request",
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_3YLvb0V7eXcHqgGauTjDy"
                },
                "status": {
                  "type": "string",
                  "example": "400"
                },
                "code": {
                  "type": "string",
                  "example": "100001"
                },
                "title": {
                  "type": "string",
                  "example": "The authorization grant type is not supported by the authorization server."
                },
                "detail": {
                  "type": "string",
                  "example": "The authorization grant type is not supported by the authorization server."
                }
              }
            }
          }
        }
      },
      "Breeds-Species": {
        "title": "Breeds & Species",
        "type": "object",
        "description": "A JSON object containing information related to breeds and species.",
        "properties": {
          "species": {
            "type": "array",
            "items": {
              "properties": {
                "code": {
                  "type": "string",
                  "description": "The code of the species.",
                  "example": "CANINE"
                },
                "name": {
                  "type": "string",
                  "description": "The name of the species.",
                  "example": "Canine"
                },
                "breeds": {
                  "type": "array",
                  "description": "A list of breeds associated to the species.",
                  "items": {
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "The code of the breed.",
                        "example": "LABRADOR_RETRIEVER"
                      },
                      "name": {
                        "type": "string",
                        "description": "The name of the breed.",
                        "example": "Labrador Retriever"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "DiagnosticResultItemv1": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "range_low": {
            "type": "string"
          },
          "range_high": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value",
          "range_low",
          "range_high",
          "unit"
        ]
      },
      "InternalError": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "error_5JBMuXC69QQoPpKDFoBow"
          },
          "status": {
            "type": "string",
            "example": "500"
          },
          "code": {
            "type": "string",
            "example": ""
          },
          "title": {
            "type": "string",
            "example": "An internal server error occurred"
          },
          "detail": {
            "type": "string",
            "example": "An error occured, please contact API support with the id, status and code provided with the response."
          }
        }
      },
      "Modalities": {
        "title": "modalities",
        "type": "object",
        "description": "A JSON object containing information related to breeds and species.",
        "properties": {
          "modalities": {
            "type": "array",
            "items": {
              "properties": {
                "name": {
                  "type": "string",
                  "description": "The name of the modality.",
                  "example": "Autorefraction"
                },
                "code": {
                  "type": "string",
                  "description": "The name of the modality.",
                  "example": "AR"
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "type": "string",
        "example": "No input file specified."
      },
      "PartnerAuthentication": {
        "properties": {
          "access_token": {
            "type": "string",
            "example": "CnKAVqSqp6UBq3Ei17e1UIj2U39UuOQI1i9Db3QT"
          },
          "token_type": {
            "type": "string",
            "example": "Bearer"
          }
        }
      },
      "TooManyRequests": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "error_5JBMuXC69QQoPpKDFoBow"
          },
          "status": {
            "type": "string",
            "example": "429"
          },
          "code": {
            "type": "string",
            "example": ""
          },
          "title": {
            "type": "string",
            "example": "Too Many Requests"
          },
          "detail": {
            "type": "string",
            "example": "Too Many Requests"
          }
        }
      },
      "Unauthorized": {
        "type": "object",
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "properties": {
                "level": {
                  "type": "string",
                  "example": "error"
                },
                "type": {
                  "type": "string",
                  "example": "InvalidRequestException"
                },
                "text": {
                  "type": "string",
                  "example": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \\\"access token\\\" parameter."
                },
                "fields": {
                  "type": "array",
                  "example": [],
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "UnprocessableEntity": {
        "title": "Unprocessable Entity",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "error_5JBMuXC69QQoPpKDFoBow"
          },
          "status": {
            "type": "string",
            "example": "422"
          },
          "code": {
            "type": "string",
            "example": ""
          },
          "title": {
            "type": "string",
            "example": "Unprocessable Entity"
          },
          "detail": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        }
      }
    }
  },
  "paths": {
    "/accesstoken": {
      "servers": [
        {
          "url": "https://partnerurl.com"
        }
      ],
      "post": {
        "security": [],
        "operationId": "get-partner-token",
        "tags": [
          "Partner Authentication"
        ],
        "summary": "Get an access token from the partner",
        "description": "This endpoint must be implemented by the Partner. \n\nThis endpoint will allow ezyVet to authenticate and use the Partner's web services\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "partner-clinic"
                  },
                  "client_secret": {
                    "type": "string",
                    "example": "partner-secret"
                  },
                  "grant_type": {
                    "type": "string",
                    "example": "client_credentials"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns an access token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerAuthentication"
                }
              }
            }
          },
          "400": {
            "description": "Error Message From Partner",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Cannot process this request."
                }
              }
            }
          }
        }
      }
    },
    "/v1/oauth/access_token": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Fetch a JWT bearer token",
        "operationId": "get-token",
        "servers": [
          {
            "url": "https://api.ezyvet.com",
            "description": "ezyVet production environment"
          },
          {
            "url": "https://api.trial.ezyvet.com",
            "description": "ezyVet trial environment"
          }
        ],
        "description": "Generates a valid access token, given client credentials. Access tokens have an 12-hour TTL.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "partner_id": {
                    "type": "string"
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  },
                  "grant_type": {
                    "type": "string",
                    "default": "client_credentials"
                  },
                  "scope": {
                    "type": "string"
                  },
                  "site_uid": {
                    "type": "string"
                  }
                },
                "required": [
                  "partner_id",
                  "client_id",
                  "client_secret",
                  "grant_type",
                  "scope",
                  "site_uid"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A JSON object containing the access token details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "token_type": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": []
      }
    },
    "/modalities": {
      "servers": [
        {
          "url": "https://partnerurl.com"
        }
      ],
      "get": {
        "operationId": "get-modalities",
        "tags": [
          "Modalities"
        ],
        "summary": "Get modalities",
        "description": "This endpoint must be implemented by the Partner. \n\nThis endpoint will allow ezyVet to get a list of supported modalities.\n",
        "responses": {
          "200": {
            "description": "Returns a list of supported modalities",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Modalities"
                }
              }
            }
          },
          "400": {
            "description": "Error Message From Partner",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Cannot process this request."
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/attachment": {
      "post": {
        "summary": "Creates a single Attachment",
        "description": "Creates a single Attachment that links to a Consult with an ID of `1`.",
        "operationId": "create-attachment",
        "tags": [
          "Attachment"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "record_type": {
                    "type": "string",
                    "description": "The record type the Attachment is for. E.g. Animal, Contact, Consult."
                  },
                  "record_id": {
                    "type": "number",
                    "description": "The ID number of the record the Attachment is linked to."
                  },
                  "notes": {
                    "type": "string",
                    "description": "Notes that are related to the Attachment"
                  },
                  "file_data": {
                    "type": "string",
                    "format": "binary",
                    "description": "The data of the file."
                  },
                  "file_id": {
                    "type": "string",
                    "description": "Create an Attachment using an existing file in ezyVet."
                  }
                },
                "required": [
                  "record_type",
                  "record_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "attachment": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "file_id": {
                                "type": "string"
                              },
                              "file_download_url": {
                                "type": "string"
                              },
                              "mime_type": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "primary_image": {
                                "type": "boolean"
                              },
                              "notes": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-attachment"
            ]
          }
        ]
      }
    },
    "/v2/separation": {
      "get": {
        "summary": "Fetch a Separation list",
        "description": "Fetches a list containing Separations.\nSeparations are a complex part of the ezyVet API and is important to understand. \nPlease read [this document](/guides/understanding-separations) to ensure you have an adequate understanding.",
        "operationId": "get-separationv2",
        "tags": [
          "Separations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The ID number used by the system to uniquely identify a [`Separation`](#get-separationv2)."
          },
          {
            "name": "uid",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The ID number used by the system to uniquely identify a [`Separation`](#get-separationv2) across all ezyVet sites."
          },
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "If **true**, the [`Separation`](#get-separationv2) is active and usable in ezyVet."
          },
          {
            "name": "created_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the [`Separation`](#get-separationv2) was created."
          },
          {
            "name": "modified_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the [`Separation`](#get-separationv2) was last modified."
          }
        ],
        "responses": {
          "200": {
            "description": "A list of separations",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "separation": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "uid": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "name": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "parent": {
                                "type": "number"
                              },
                              "child": {
                                "type": "number"
                              },
                              "separation_type": {
                                "type": "string"
                              },
                              "contact_id": {
                                "type": "number"
                              },
                              "contact_uid": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-separation"
            ]
          }
        ]
      }
    },
    "/breedsandspecies": {
      "servers": [
        {
          "url": "https://partnerurl.com"
        }
      ],
      "get": {
        "operationId": "get-dx-breeds+species",
        "tags": [
          "Breeds & Species"
        ],
        "summary": "Get species and breeds",
        "description": "This endpoint must be implemented by the Partner. \n\nThis endpoint will allow ezyVet to get a list of animal species and breeds.\n",
        "responses": {
          "200": {
            "description": "Returns a list of species & breeds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Breeds-Species"
                }
              }
            }
          },
          "400": {
            "description": "Error Message From Partner",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Cannot process this request."
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/diagnosticrequest": {
      "servers": [
        {
          "url": "https://partnerurl.com"
        }
      ],
      "post": {
        "operationId": "send-partner-pacs-request",
        "tags": [
          "Diagnostic Request"
        ],
        "summary": "Send a PACS request",
        "description": "This endpoint must be implemented by the partner. \n\nezyVet will push diagnostic (PACS) requests as they are made/updated/disabled to the partner's diagnostic request endpoint. \nThe partner must acknowledge the POST request with a HTTP 200 OK once they have received the diagnostic request successfully AND have been able to parse the information correctly.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer",
                    "example": 595
                  },
                  "active": {
                    "type": "boolean",
                    "example": true
                  },
                  "created_at": {
                    "type": "integer",
                    "example": 1529901719
                  },
                  "modified_at": {
                    "type": "integer",
                    "example": 1529901719
                  },
                  "timestamp": {
                    "type": "integer",
                    "example": 1529897843
                  },
                  "contact": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer",
                        "example": 76
                      },
                      "active": {
                        "type": "boolean",
                        "example": true
                      },
                      "created_at": {
                        "type": "integer",
                        "example": 1527011450
                      },
                      "modified_at": {
                        "type": "integer",
                        "example": 1527011450
                      },
                      "ownership_id": {
                        "type": "integer",
                        "example": 1
                      },
                      "code": {
                        "type": "string",
                        "example": "WendyTest"
                      },
                      "first_name": {
                        "type": "string",
                        "example": "Wendy"
                      },
                      "last_name": {
                        "type": "string",
                        "example": "Ww"
                      },
                      "business_name": {
                        "type": "string",
                        "example": ""
                      },
                      "is_business": {
                        "type": "boolean",
                        "example": false
                      },
                      "is_customer": {
                        "type": "boolean",
                        "example": true
                      },
                      "is_supplier": {
                        "type": "boolean",
                        "example": false
                      },
                      "is_vet": {
                        "type": "boolean",
                        "example": false
                      },
                      "is_syndicate": {
                        "type": "boolean",
                        "example": false
                      },
                      "is_staff_member": {
                        "type": "boolean",
                        "example": false
                      },
                      "stop_credit": {
                        "type": "string",
                        "example": "OK"
                      }
                    }
                  },
                  "animal": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer",
                        "example": 2
                      },
                      "name": {
                        "type": "string",
                        "example": "XiaoGouABC"
                      },
                      "code": {
                        "type": "string",
                        "example": "XGABC"
                      },
                      "sex": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 1
                          },
                          "active": {
                            "type": "boolean",
                            "example": true
                          },
                          "created_at": {
                            "type": "integer",
                            "example": 1467543440
                          },
                          "modified_at": {
                            "type": "integer",
                            "example": 1467543440
                          },
                          "name": {
                            "type": "string",
                            "example": "Male"
                          },
                          "abbreviation": {
                            "type": "string",
                            "example": "M"
                          },
                          "is_desexed": {
                            "type": "boolean",
                            "example": false
                          }
                        }
                      },
                      "is_dead": {
                        "type": "boolean",
                        "example": false
                      },
                      "is_hostile": {
                        "type": "string",
                        "example": ""
                      },
                      "animalcolour_id": {
                        "type": "integer",
                        "example": 34
                      },
                      "integrated_species": {
                        "deprecated": true,
                        "description": "**Deprecated.** Use the `species` field instead. This field is scheduled for removal after the sunset date of 1 January 2027.",
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 293
                          },
                          "active": {
                            "type": "boolean",
                            "example": true
                          },
                          "created_at": {
                            "type": "integer",
                            "example": 1528986101
                          },
                          "modified_at": {
                            "type": "integer",
                            "example": 1528986101
                          },
                          "code": {
                            "type": "string",
                            "example": "1"
                          },
                          "name": {
                            "type": "string",
                            "example": "Canine"
                          }
                        }
                      },
                      "integrated_breed": {
                        "deprecated": true,
                        "description": "**Deprecated.** Use the `breed` field instead. This field is scheduled for removal after the sunset date of 1 January 2027.",
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 5055
                          },
                          "active": {
                            "type": "boolean",
                            "example": true
                          },
                          "created_at": {
                            "type": "integer",
                            "example": 1528986101
                          },
                          "modified_at": {
                            "type": "integer",
                            "example": 1528986101
                          },
                          "code": {
                            "type": "string",
                            "example": "1"
                          },
                          "name": {
                            "type": "string",
                            "example": "AFFENPINSCHER"
                          }
                        }
                      },
                      "species": {
                        "type": "object",
                        "description": "The animal's species. Replaces the deprecated `integrated_species` field.",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "The species name as recorded in ezyVet.",
                            "example": "Feline (Cat)"
                          },
                          "integrated": {
                            "type": "object",
                            "description": "The integrated (partner-mapped) species details.",
                            "properties": {
                              "name": {
                                "type": "string",
                                "example": "Canine"
                              },
                              "code": {
                                "type": "string",
                                "example": "CANINE1"
                              }
                            }
                          }
                        }
                      },
                      "breed": {
                        "type": "object",
                        "description": "The animal's breed. Replaces the deprecated `integrated_breed` field.",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "The breed name as recorded in ezyVet.",
                            "example": "Ragamuffin"
                          },
                          "integrated": {
                            "type": "object",
                            "description": "The integrated (partner-mapped) breed details.",
                            "properties": {
                              "name": {
                                "type": "string",
                                "example": "Labrador Retriever"
                              },
                              "code": {
                                "type": "string",
                                "example": "LABRADOR_RETRIEVER"
                              }
                            }
                          }
                        }
                      },
                      "rabies_number": {
                        "type": "string",
                        "example": ""
                      },
                      "date_of_rabies_vaccination": {
                        "type": "integer",
                        "example": 0
                      },
                      "microchip_number": {
                        "type": "string",
                        "example": ""
                      },
                      "date_of_birth": {
                        "type": "integer",
                        "example": 1438524000
                      },
                      "is_estimated_date_of_birth": {
                        "type": "boolean",
                        "example": false
                      },
                      "date_of_death": {
                        "type": "integer",
                        "example": 0
                      },
                      "death_reason": {
                        "type": "string",
                        "example": ""
                      },
                      "date_of_desex": {
                        "type": "integer",
                        "example": 0
                      },
                      "referring_clinic_id": {
                        "type": "integer",
                        "example": 0
                      },
                      "referring_vet_id": {
                        "type": "integer",
                        "example": 0
                      },
                      "residence_contact_id": {
                        "type": "integer",
                        "example": 0
                      },
                      "weight_unit": {
                        "type": "string",
                        "example": "kg"
                      },
                      "weight": {
                        "type": "number",
                        "example": 3.499
                      },
                      "resuscitate": {
                        "type": "string",
                        "example": "Unspecified"
                      },
                      "notes": {
                        "type": "string",
                        "example": "Some notes."
                      }
                    }
                  },
                  "consult_id": {
                    "type": "integer",
                    "example": 55
                  },
                  "vet": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer",
                        "example": 31
                      },
                      "active": {
                        "type": "boolean",
                        "example": true
                      },
                      "created_at": {
                        "type": "integer",
                        "example": 1494879128
                      },
                      "modified_at": {
                        "type": "integer",
                        "example": 1522194348
                      },
                      "name": {
                        "type": "string",
                        "example": "Dr Vet"
                      },
                      "is_vet": {
                        "type": "boolean",
                        "example": true
                      },
                      "is_salesperson": {
                        "type": "boolean",
                        "example": true
                      }
                    }
                  },
                  "reference_number": {
                    "type": "string",
                    "example": "AU10674-DR595"
                  },
                  "specifics": {
                    "type": "string",
                    "example": ""
                  },
                  "modality": {
                    "type": "string",
                    "example": "DX"
                  },
                  "status": {
                    "type": "string",
                    "example": ""
                  },
                  "supplier_id": {
                    "type": "integer",
                    "example": 67
                  },
                  "ownership_id": {
                    "type": "integer",
                    "example": 2
                  },
                  "diagnostic_list": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": 958
                        },
                        "active": {
                          "type": "boolean",
                          "example": true
                        },
                        "created_at": {
                          "type": "integer",
                          "example": 1529901719
                        },
                        "modified_at": {
                          "type": "integer",
                          "example": 1529901719
                        },
                        "diagnostic_id": {
                          "type": "integer",
                          "example": 190
                        },
                        "name": {
                          "type": "string",
                          "example": "Cardio Ultrasound"
                        },
                        "code": {
                          "type": "string",
                          "example": "CardioUS"
                        },
                        "diagnostic_class": {
                          "type": "string",
                          "example": "Diagnostic"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "external_link": {
                      "type": "string",
                      "example": "https://www.externalimageviewer.example",
                      "description": "A link to the provider's external image viewer"
                    },
                    "status": {
                      "type": "string",
                      "example": "OK"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error Message From Partner",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Cannot process this lab request."
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/diagnosticresult": {
      "post": {
        "summary": "Create a Diagnostic Result",
        "security": [
          {
            "bearerAuth": [
              "read-diagnosticresult",
              "write-diagnosticresult"
            ]
          }
        ],
        "description": "Creates a single [`DiagnosticResult`](#diagnosticresult).",
        "operationId": "create-diagnosticresult",
        "tags": [
          "Diagnostic Result"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "active": {
                    "type": "string",
                    "default": "true"
                  },
                  "consult_id": {
                    "type": "string"
                  },
                  "animal_id": {
                    "type": "string"
                  },
                  "supplier_id": {
                    "type": "string"
                  },
                  "vet_id": {
                    "type": "string"
                  },
                  "diagnostic_request_id": {
                    "type": "string"
                  },
                  "timestamp": {
                    "type": "string",
                    "default": "Current epoch"
                  },
                  "specifics": {
                    "type": "string"
                  },
                  "outcome": {
                    "type": "string"
                  },
                  "diagnostic_result_item_list": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DiagnosticResultItemv1"
                    }
                  },
                  "external_link": {
                    "type": "string"
                  },
                  "study_uid": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "The DICOM Study Instance UID of the imaging study linked to this [`DiagnosticResult`](#diagnosticresult). Write-once — the value cannot be changed after it has been set.",
                    "example": "1.2.840.113619.2.62.994044785528.114289542805"
                  }
                },
                "required": [
                  "diagnostic_request_id",
                  "diagnostic_result_item_list"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "diagnosticresult": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "ownership_id": {
                                "type": "string"
                              },
                              "contact_id": {
                                "type": "string"
                              },
                              "consult_id": {
                                "type": "string"
                              },
                              "animal_id": {
                                "type": "string"
                              },
                              "vet_id": {
                                "type": "string"
                              },
                              "diagnostic_request_id": {
                                "type": "string"
                              },
                              "timestamp": {
                                "type": "string"
                              },
                              "specifics": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": "string"
                              },
                              "diagnostic_result_item_list": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/diagnosticresult/{id}": {
      "patch": {
        "summary": "Update a Diagnostic Result",
        "operationId": "update-diagnosticresult",
        "security": [
          {
            "bearerAuth": [
              "read-diagnosticresult",
              "write-diagnosticresult"
            ]
          }
        ],
        "tags": [
          "Diagnostic Result"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "ID of the DiagnosticResult to update",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the DiagnosticResult is active and usable in ezyVet.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "consult_id",
            "in": "query",
            "description": "Refers to the ID of the Consult where the DiagnosticResult is attached.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "animal_id",
            "in": "query",
            "description": "Refers to the ID of the Animal.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "supplier_id",
            "in": "query",
            "description": "Refers to the ID of the Contact (who is a supplier) of the diagnostic.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vet_id",
            "in": "query",
            "description": "Refers to the ID of the User (who is a vet) associated with the DiagnosticResult.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "diagnostic_request_id",
            "in": "query",
            "description": "Refers to the ID of the DiagnosticRequest linked to the DiagnosticResult.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamp",
            "in": "query",
            "description": "Generally refers to the date when the results of the diagnostic were released.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "specifics",
            "in": "query",
            "description": "Specifics/notes about the DiagnosticResult.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "description": "Notes about the result of the DiagnosticResult. This can be in markdown format.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "diagnostic_result_item_list",
            "in": "query",
            "description": "Contains a list of DiagnosticResultItem(s).",
            "schema": {
              "type": "array",
              "items": {
                "type": "number",
                "format": "int64"
              }
            }
          },
          {
            "name": "external_link",
            "in": "query",
            "description": "An external link for users to view any additional data.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "study_uid",
            "in": "query",
            "description": "The DICOM Study Instance UID of the imaging study linked to this DiagnosticResult. Write-once — it can be set on a DiagnosticResult that doesn't have one yet, but changing an existing value is rejected with a validation error.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/merge-patch+json": {
              "schema": {
                "type": "object",
                "properties": {
                  "specifics": {
                    "type": "string"
                  },
                  "external_link": {
                    "type": "string"
                  },
                  "study_uid": {
                    "type": "string",
                    "maxLength": 64,
                    "example": "1.2.840.113619.2.62.994044785528.114289542805"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful update",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "diagnosticresult": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "ownership_id": {
                                "type": "string"
                              },
                              "contact_id": {
                                "type": "string"
                              },
                              "consult_id": {
                                "type": "string"
                              },
                              "animal_id": {
                                "type": "string"
                              },
                              "vet_id": {
                                "type": "string"
                              },
                              "diagnostic_request_id": {
                                "type": "string"
                              },
                              "timestamp": {
                                "type": "string"
                              },
                              "specifics": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": "string"
                              },
                              "diagnostic_result_item_list": {
                                "type": "array",
                                "items": {
                                  "type": "number"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  }
}
