{
  "openapi": "3.0.1",
  "info": {
    "title": "API Endpoints",
    "description": "The API accepts URL params and JSON-formatted requests, and returns JSON-formatted responses.\n",
    "version": "1.0"
  },
  "security": [],
  "tags": [
    {
      "name": "Authentication",
      "description": "Authenticate with the ezyVet API"
    },
    {
      "name": "Authentication V2",
      "description": "Authenticate with the ezyVet API"
    }
  ],
  "x-tagGroups": [
    {
      "name": "Authentication",
      "tags": [
        "Authentication",
        "Authentication V2"
      ]
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://api.ezyvet.com/v1/oauth/access_token",
            "scopes": {}
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BadRequest"
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal error",
        "content": {
          "application/json": {
            "schema": {
              "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."
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found",
        "content": {
          "text/html": {
            "schema": {
              "type": "string",
              "example": "No input file specified."
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Too Many Requests",
        "content": {
          "application/json": {
            "schema": {
              "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": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "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": {
        "description": "Unprocessable Entity",
        "content": {
          "application/json": {
            "schema": {
              "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"
                }
              }
            }
          }
        }
      }
    },
    "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."
                }
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/v1/oauth/access_token": {
      "post": {
        "servers": [
          {
            "url": "https://api.ezyvet.com",
            "description": "ezyVet production environment"
          },
          {
            "url": "https://api.trial.ezyvet.com",
            "description": "ezyVet trial environment"
          }
        ],
        "tags": [
          "Authentication"
        ],
        "summary": "Fetch a JWT bearer token",
        "deprecated": false,
        "operationId": "get-token",
        "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"
                    }
                  },
                  "required": [
                    "access_token",
                    "token_type",
                    "expires_in"
                  ]
                }
              }
            }
          },
          "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": []
      }
    }
  }
}
