{
  "openapi": "3.0.4",
  "info": {
    "title": "Evri Classic API",
    "description": "",
    "version": "v1.0"
  },
  "paths": {
    "/oauth/token": {
      "post": {
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "schema": {
              "type": "string",
              "nullable": true
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "schema": {
              "type": "string",
              "nullable": true
            }
          },
          {
            "name": "client_secret",
            "in": "query",
            "schema": {
              "type": "string",
              "nullable": true
            }
          },
          {
            "name": "code",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grant_type",
            "in": "query",
            "schema": {
              "type": "string",
              "nullable": true
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "response_type": {
                    "type": "string"
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "grant_type": {
                    "type": "string"
                  }
                }
              },
              "encoding": {
                "response_type": {
                  "style": "form"
                },
                "client_id": {
                  "style": "form"
                },
                "client_secret": {
                  "style": "form"
                },
                "code": {
                  "style": "form"
                },
                "grant_type": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/authorize": {
      "get": {
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "audience",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prompt",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organization",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invitation",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/customers": {
      "get": {
        "tags": [
          "Customer"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/labels/{barcode}": {
      "get": {
        "tags": [
          "Label"
        ],
        "summary": "Returns a label of a given barcode.",
        "parameters": [
          {
            "name": "barcode",
            "in": "path",
            "description": "The barcode that uniquely represents a parcel.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "description": "The format of the label.. Defaults to DEFAULT.",
            "schema": {
              "$ref": "#/components/schemas/LabelType"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns response based on media type in Accept header.\n'application/json' returns the response shown in the example.\nThe other three return a standard file result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelResponse"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/LabelResponse"
                }
              },
              "image/png": {
                "schema": {
                  "$ref": "#/components/schemas/LabelResponse"
                }
              },
              "image/png;base64=true": {
                "schema": {
                  "$ref": "#/components/schemas/LabelResponse"
                }
              },
              "application/pdf;base64=true": {
                "schema": {
                  "$ref": "#/components/schemas/LabelResponse"
                }
              }
            }
          },
          "400": {
            "description": "If the format query string param is unrecognised."
          },
          "401": {
            "description": "If the user cannot be authenticated."
          },
          "404": {
            "description": "If the barcode is not found within our system."
          },
          "406": {
            "description": "If the Accept header specifies a response format which is not supported."
          }
        }
      }
    },
    "/api/parcels": {
      "post": {
        "tags": [
          "Parcel"
        ],
        "summary": "Creates new parcels for the customer who is associated with the OAuth access token.",
        "requestBody": {
          "description": "The parcels.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ParcelCollection"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ParcelCollection"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ParcelCollection"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ParcelCollection"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/vnd.myhermes.parcelsummaries-v1+json": {
                "schema": {
                  "$ref": "#/components/schemas/ParcelSummaryCollection"
                }
              }
            }
          },
          "400": {
            "description": "If there is a missing or duplicate clientUid, or if there are issues with the authenticated customer.",
            "content": {
              "application/vnd.myhermes.parcelsummaries-v1+json": {
                "schema": {
                  "$ref": "#/components/schemas/ParcelResponseError"
                }
              }
            }
          },
          "401": {
            "description": "If the user cannot be authenticated.",
            "content": {
              "application/vnd.myhermes.parcelsummaries-v1+json": {
                "schema": {
                  "$ref": "#/components/schemas/ParcelResponseError"
                }
              }
            }
          },
          "406": {
            "description": "If the Accept header specifies a response format which is not supported."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AddressModel": {
        "title": "Address",
        "type": "object",
        "properties": {
          "line1": {
            "maxLength": 32,
            "minLength": 1,
            "type": "string",
            "description": "Address line 1.",
            "nullable": true
          },
          "line2": {
            "maxLength": 32,
            "type": "string",
            "description": "Address line 2.",
            "nullable": true
          },
          "line3": {
            "maxLength": 32,
            "type": "string",
            "description": "Address line 3.",
            "nullable": true
          },
          "line4": {
            "maxLength": 32,
            "type": "string",
            "description": "Address line 4.",
            "nullable": true
          },
          "postcode": {
            "maxLength": 10,
            "minLength": 1,
            "type": "string",
            "description": "Must be valid UK postcode. Spaces allowed but not required.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DeliveryDetailsModel": {
        "title": "DeliveryDetails",
        "required": [
          "deliveryAddress"
        ],
        "type": "object",
        "properties": {
          "deliveryAddress": {
            "$ref": "#/components/schemas/AddressModel"
          },
          "firstName": {
            "maxLength": 32,
            "type": "string",
            "description": "Delivery contact's first name.",
            "nullable": true
          },
          "lastName": {
            "maxLength": 32,
            "minLength": 1,
            "type": "string",
            "description": "Delivery contact's last name.",
            "nullable": true
          },
          "email": {
            "maxLength": 80,
            "type": "string",
            "description": "Delivery contact's email address. Must be valid email format.",
            "nullable": true
          },
          "telephone": {
            "maxLength": 32,
            "type": "string",
            "description": "Delivery contact's telephone number.\nWill be truncated if longer than 15 characters.",
            "nullable": true
          },
          "signatureRequired": {
            "type": "boolean",
            "description": "Flag stating whether a signature is required on delivery.\nForced to true if above threshold for the compensation level requested, otherwise defaults to false if not specified.",
            "nullable": true
          },
          "deliveryInstructions": {
            "maxLength": 32,
            "type": "string",
            "description": "Special delivery instructions, if applicable.",
            "nullable": true
          },
          "deliverySafePlace": {
            "maxLength": 32,
            "type": "string",
            "description": "Delivery safe place, in case recipient unable to directly accept delivery.",
            "nullable": true
          },
          "nextDay": {
            "type": "boolean",
            "description": "Next day delivery. Defaults to false. This option is only available for certain users.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetTokenRequest": {
        "type": "object",
        "properties": {
          "responseType": {
            "type": "string",
            "nullable": true
          },
          "clientId": {
            "type": "string",
            "nullable": true
          },
          "clientSecret": {
            "type": "string",
            "nullable": true
          },
          "authorizationCode": {
            "minLength": 1,
            "type": "string",
            "nullable": true
          },
          "grantType": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LabelResponse": {
        "type": "object",
        "properties": {
          "weight": {
            "type": "number",
            "format": "double"
          },
          "orderItemReference": {
            "type": "string",
            "nullable": true
          },
          "itemDescription": {
            "type": "string",
            "nullable": true
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "postcode": {
            "type": "string",
            "nullable": true
          },
          "addressLine1": {
            "type": "string",
            "nullable": true
          },
          "addressLine2": {
            "type": "string",
            "nullable": true
          },
          "addressLine3": {
            "type": "string",
            "nullable": true
          },
          "addressLine4": {
            "type": "string",
            "nullable": true
          },
          "deliveryInstructions": {
            "type": "string",
            "nullable": true
          },
          "deliverySafePlace": {
            "type": "string",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          },
          "labelType": {
            "type": "string",
            "nullable": true
          },
          "clientName": {
            "type": "string",
            "nullable": true
          },
          "carrier": {
            "type": "string",
            "nullable": true
          },
          "depotName": {
            "type": "string",
            "nullable": true
          },
          "depotCode": {
            "type": "string",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "Collection date.",
            "nullable": true
          },
          "vanName": {
            "type": "string",
            "nullable": true
          },
          "vanCode": {
            "type": "string",
            "nullable": true
          },
          "dropName": {
            "type": "string",
            "nullable": true
          },
          "dropCode": {
            "type": "string",
            "nullable": true
          },
          "courierRoundDescription": {
            "type": "string",
            "nullable": true
          },
          "courierRound": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LabelType": {
        "enum": [
          "DEFAULT",
          "THERMAL",
          "TWO_PER_PAGE"
        ],
        "type": "string"
      },
      "ParcelCollection": {
        "type": "object",
        "properties": {
          "parcels": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ParcelModel"
            },
            "description": "List of Parcels.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ParcelDetailsModel": {
        "title": "ParcelDetails",
        "type": "object",
        "properties": {
          "weightKg": {
            "minimum": 0,
            "type": "number",
            "description": "Weight of the parcel contents (in kilograms).",
            "format": "double",
            "nullable": true
          },
          "itemDescription": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string",
            "description": "Description of the parcel contents.",
            "nullable": true
          },
          "deliveryReference": {
            "maxLength": 32,
            "type": "string",
            "description": "Reference that will appear on the label. Should be 20 characters or fewer; any after the first 20 will be discarded.",
            "nullable": true
          },
          "estimatedParcelValuePounds": {
            "type": "number",
            "description": "Estimated value for the parcel contents (in £). If not specified, defaults to the level of compensation\nrequested, or £0 if neither specified.",
            "format": "double",
            "nullable": true
          },
          "compensationRequiredPounds": {
            "minimum": 0,
            "type": "number",
            "description": "Level of compensation required (in £). Defaults to £0.",
            "format": "double",
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/ParcelType"
          }
        },
        "additionalProperties": false
      },
      "ParcelError": {
        "type": "object",
        "properties": {
          "error_paths": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of property paths representing the offending request properties for the error."
          },
          "error": {
            "type": "string",
            "description": "Error code for the parcel request violation."
          },
          "error_description": {
            "type": "string",
            "description": "Description of the parcel request violation.\n\n"
          }
        },
        "additionalProperties": false,
        "description": "Allowed values for error, error_description:\n<hr />\nmissing_property, Property value is missing or null\n\ninvalid_property, Property value exceeds maximum length\n\ninvalid_property, Property value outside of supported range\n\ninvalid_property, Property value is an invalid email address\n\noverweight_weightKg, Weight '{weight}' is over limit for POSTABLE\n\ninvalid_property, Weight value is unsupported for the Customer\n\nunknown_error, An unexpected error occurred.\n<hr />"
      },
      "ParcelModel": {
        "title": "Parcel",
        "required": [
          "deliveryDetails",
          "parcelDetails"
        ],
        "type": "object",
        "properties": {
          "clientUID": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string",
            "description": "Client-defined unique reference.",
            "nullable": true
          },
          "parcelDetails": {
            "$ref": "#/components/schemas/ParcelDetailsModel"
          },
          "deliveryDetails": {
            "$ref": "#/components/schemas/DeliveryDetailsModel"
          }
        },
        "additionalProperties": false
      },
      "ParcelResponseError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "description": "Allowed values for error, error_description:\n<hr />\nmissing_clientUID, Parcel at position '{i}' missing required property 'clientUID', or has a null or empty value\n\nduplicate_clientUID, Parcel at position '{i}' contains duplicate 'clientUID' property [value: {duplicateValue}}]\n\nmissing_property, Property value is missing or null\n\ninvalid_credentials, The customer was not found\n\ninvalid_credentials, The customer does not have the required permissions to pay on account\n\ninvalid_address, The customer has no collection adddress set\n\ninvalid_address, The customer's collection adddress is invalid\n\ninvalid_address, The customer's collection address is not in the UK\n\nunknown_error, An unexpected error occurred.\n<hr />"
      },
      "ParcelSummaryCollection": {
        "type": "object",
        "properties": {
          "parcelSummaries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ParcelSummaryModel"
            },
            "description": "List of Parcel Summaries."
          }
        },
        "additionalProperties": false
      },
      "ParcelSummaryModel": {
        "title": "ParcelSummary",
        "type": "object",
        "properties": {
          "clientUID": {
            "type": "string",
            "description": "Client-defined unique reference, matching that provided by the client on creation."
          },
          "barcode": {
            "type": "string",
            "description": "The parcel's label barcode, if the parcel is successfully created (see status).",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/ParcelSummaryStatus"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ParcelError"
            },
            "description": "The parcel's validation violations, if applicable (see status).",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ParcelSummaryStatus": {
        "enum": [
          "CREATED",
          "INVALID"
        ],
        "type": "string",
        "description": "The Parcel's status."
      },
      "ParcelType": {
        "enum": [
          "STANDARD",
          "POSTABLE"
        ],
        "type": "string",
        "description": "Can be STANDARD (the default) or POSTABLE (under 1kg and 23cm x 35cm x 3cm)."
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://auth.backoffice.parcel2go.com/connect/token",
            "scopes": { }
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": [ ]
    }
  ],
  "tags": [
    {
      "name": "Parcel",
      "description": "Operations for Parcels."
    },
    {
      "name": "Label",
      "description": "Operations for Labels."
    }
  ]
}