{
  "openapi": "3.0.1",
  "info": {
    "title": "Spreetail Delivery Tracking API",
    "termsOfService": "https://www.spreetaildelivery.com/terms",
    "version": "1.0"
  },
  "paths": {
    "/api/v1/aftership/{trackingNumber}": {
      "get": {
        "tags": [
          "Aftership"
        ],
        "summary": "Retrieves Tracking data for the requested Spreetail Delivery Tracking number for Aftership",
        "parameters": [
          {
            "name": "trackingNumber",
            "in": "path",
            "description": "Spreetail Delivery Tracking number",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AftershipTrackingResult"
                }
              }
            }
          },
          "204": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized"
          },
          "400": {
            "description": "The trackingNumber form is invalid, must match ^[Ss][Dd][A-Za-z]{2}\\\\d{10}$"
          }
        }
      }
    },
    "/api/v1/shiptrack": {
      "post": {
        "tags": [
          "Amazon ShipTrack API 4.0"
        ],
        "summary": "Retrieves tracking data in the format required for Amazon ShipTrack integration",
        "description": "\n\r\n  <b>\r\n                     [Amazon Consumption Only]\r\n                 </b>\r\n\r\n             ERROR Codes\r\n            \r\n             Data Error Codes\r\n               Event Code    Event                                       Text Description\r\n            \r\n               ERROR_101     INVALID TRACKING NUMBER                     Request contains an invalid tracking number\r\n               ERROR_102     NO TRACKING INFO FOUND                      No data exists in the carrier’s system for the given tracking number\r\n            \r\n            \r\n             Validation Error Codes\r\n               Event Code    Event                                       Text Description\r\n            \r\n               ERROR_201     INVALID USERID/PASSWORD                     Request contains an invalid user ID or password\r\n               ERROR_202     INVALID API VERSION                         Request contains an incompatible API version\r\n               ERROR_203     XML DOCUMENT NOT WELL FORMED                Request is not a well-formed XML document\r\n               ERROR_204     XML DOCUMENT NOT VALID                      Request is not a valid XML document\r\n            \r\n            \r\n             Service Error Codes\r\n               Event Code    Event                                       Text Description\r\n            \r\n               ERROR_301     TRACKING SERVICE NOT AVAILABLE              Generic error code to handle any situation where Amazon can contact the service,\r\n                                                                         but tracking data cannot retrieved",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AmazonTrackingRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AmazonTrackingRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AmazonTrackingRequest"
              }
            },
            "application/xml": {
              "schema": {
                "$ref": "#/components/schemas/AmazonTrackingRequest"
              }
            },
            "text/xml": {
              "schema": {
                "$ref": "#/components/schemas/AmazonTrackingRequest"
              }
            },
            "application/*+xml": {
              "schema": {
                "$ref": "#/components/schemas/AmazonTrackingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/AmazonTrackingResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/frontdoor/listen-fdc": {
      "post": {
        "tags": [
          "FrontDoor"
        ],
        "summary": "Webhook handler for Front Door events",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PackageStatusEvent"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/spreetail/{trackingNumber}": {
      "get": {
        "tags": [
          "Spreetail"
        ],
        "summary": "Retrieves Tracking data for the requested Spreetail Delivery Tracking number",
        "parameters": [
          {
            "name": "trackingNumber",
            "in": "path",
            "description": "Spreetail Delivery Tracking number",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpreetailTrackingResult"
                }
              }
            }
          },
          "204": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized"
          },
          "400": {
            "description": "The trackingNumber form is invalid, must match ^[Ss][Dd][A-Za-z]{2}\\\\d{10}$"
          }
        }
      }
    },
    "/api/v1/track/{trackingNumber}": {
      "get": {
        "tags": [
          "Spreetail Delivery"
        ],
        "summary": "Retrieves Tracking data for the requested Spreetail Delivery Tracking number",
        "parameters": [
          {
            "name": "trackingNumber",
            "in": "path",
            "description": "Spreetail Delivery Tracking number",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackingResponse"
                }
              }
            }
          },
          "204": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized"
          },
          "400": {
            "description": "The trackingNumber format is invalid, must match ^[Ss][Dd][A-Za-z]{2}\\\\d{10}$"
          }
        },
        "deprecated": true
      }
    }
  },
  "components": {
    "schemas": {
      "AftershipTrackingDirection": {
        "type": "object",
        "properties": {
          "From": {
            "type": "string",
            "description": "Gets or sets sender.",
            "nullable": true
          },
          "To": {
            "type": "string",
            "description": "Gets or sets recipient.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Aftership sender and recipient information"
      },
      "AftershipTrackingEvent": {
        "type": "object",
        "properties": {
          "Name": {
            "type": "string",
            "description": "Gets or sets the name.",
            "nullable": true
          },
          "Code": {
            "type": "string",
            "description": "Gets or sets the code.",
            "nullable": true
          },
          "Date": {
            "type": "string",
            "description": "Gets or sets the date.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Aftership tracking event"
      },
      "AftershipTrackingResult": {
        "type": "object",
        "properties": {
          "TrackingNumber": {
            "type": "string",
            "description": "Gets or sets the tracking number.",
            "nullable": true
          },
          "Direction": {
            "$ref": "#/components/schemas/AftershipTrackingDirection"
          },
          "Events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AftershipTrackingEvent"
            },
            "description": "Gets or sets the events.",
            "nullable": true
          },
          "proof_of_delivery": {
            "type": "string",
            "description": "URI for the proof of delivery image",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingRequest": {
        "type": "object",
        "properties": {
          "Validation": {
            "$ref": "#/components/schemas/AmazonTrackingRequestValidation"
          },
          "APIVersion": {
            "type": "number",
            "format": "float"
          },
          "TrackingNumber": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingRequestValidation": {
        "type": "object",
        "properties": {
          "UserID": {
            "type": "string",
            "nullable": true
          },
          "Password": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponse": {
        "type": "object",
        "properties": {
          "APIVersion": {
            "type": "number",
            "format": "float"
          },
          "PackageTrackingInfo": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfo"
            },
            "nullable": true
          },
          "TrackingErrorInfo": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AmazonTrackingResponseTrackingErrorInfo"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfo": {
        "type": "object",
        "properties": {
          "TrackingNumber": {
            "type": "string",
            "nullable": true
          },
          "PackageDestinationLocation": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoPackageDestinationLocation"
          },
          "PackageDeliveryDate": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoPackageDeliveryDate"
          },
          "TrackingEventHistory": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoTrackingEventHistory"
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoPackageDeliveryDate": {
        "type": "object",
        "properties": {
          "ScheduledDeliveryDate": {
            "type": "string",
            "format": "date-time"
          },
          "ScheduledDeliveryDateSpecified": {
            "type": "boolean"
          },
          "ReScheduledDeliveryDate": {
            "type": "string",
            "format": "date-time"
          },
          "ReScheduledDeliveryDateSpecified": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoPackageDestinationLocation": {
        "type": "object",
        "properties": {
          "Street1": {
            "type": "string",
            "nullable": true
          },
          "Street2": {
            "type": "string",
            "nullable": true
          },
          "City": {
            "type": "string",
            "nullable": true
          },
          "StateProvince": {
            "type": "string",
            "nullable": true
          },
          "PostalCode": {
            "type": "string",
            "nullable": true
          },
          "CountryCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoTrackingEventHistory": {
        "type": "object",
        "properties": {
          "TrackingEventDetail": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetail"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetail": {
        "type": "object",
        "properties": {
          "EventStatus": {
            "type": "string",
            "nullable": true
          },
          "EventReason": {
            "type": "string",
            "nullable": true
          },
          "EventDateTime": {
            "type": "string",
            "format": "date-time"
          },
          "EventLocation": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailEventLocation"
          },
          "EstimatedDeliveryDate": {
            "type": "string",
            "format": "date-time"
          },
          "EstimatedDeliveryDateSpecified": {
            "type": "boolean"
          },
          "AdditionalLocationInfo": {
            "type": "string",
            "nullable": true
          },
          "SignedForByName": {
            "type": "string",
            "nullable": true
          },
          "PickupStoreInfo": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailPickupStoreInfo"
          },
          "DeliveryAppointmentWindow": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailDeliveryAppointmentWindow"
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailDeliveryAppointmentWindow": {
        "type": "object",
        "properties": {
          "Day": {
            "type": "string",
            "format": "date-time"
          },
          "StartTime": {
            "type": "string",
            "nullable": true
          },
          "EndTime": {
            "type": "string",
            "nullable": true
          },
          "TimeZone": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailEventLocation": {
        "type": "object",
        "properties": {
          "Street1": {
            "type": "string",
            "nullable": true
          },
          "Street2": {
            "type": "string",
            "nullable": true
          },
          "City": {
            "type": "string",
            "nullable": true
          },
          "StateProvince": {
            "type": "string",
            "nullable": true
          },
          "PostalCode": {
            "type": "string",
            "nullable": true
          },
          "CountryCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailPickupStoreInfo": {
        "type": "object",
        "properties": {
          "StoreName": {
            "type": "string",
            "nullable": true
          },
          "LocationID": {
            "type": "string",
            "nullable": true
          },
          "PickupID": {
            "type": "string",
            "nullable": true
          },
          "PickupDueDateDetails": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailPickupStoreInfoPickupDueDateDetails"
          },
          "StoreLocation": {
            "$ref": "#/components/schemas/AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailPickupStoreInfoStoreLocation"
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailPickupStoreInfoPickupDueDateDetails": {
        "type": "object",
        "properties": {
          "Date": {
            "type": "string",
            "format": "date-time"
          },
          "UTCOffset": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponsePackageTrackingInfoTrackingEventHistoryTrackingEventDetailPickupStoreInfoStoreLocation": {
        "type": "object",
        "properties": {
          "Street1": {
            "type": "string",
            "nullable": true
          },
          "Street2": {
            "type": "string",
            "nullable": true
          },
          "City": {
            "type": "string",
            "nullable": true
          },
          "StateProvince": {
            "type": "string",
            "nullable": true
          },
          "PostalCode": {
            "type": "string",
            "nullable": true
          },
          "CountryCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponseTrackingErrorInfo": {
        "type": "object",
        "properties": {
          "TrackingNumber": {
            "type": "string",
            "nullable": true
          },
          "TrackingErrorDetail": {
            "$ref": "#/components/schemas/AmazonTrackingResponseTrackingErrorInfoTrackingErrorDetail"
          }
        },
        "additionalProperties": false
      },
      "AmazonTrackingResponseTrackingErrorInfoTrackingErrorDetail": {
        "type": "object",
        "properties": {
          "ErrorDetailCode": {
            "type": "string",
            "nullable": true
          },
          "ErrorDetailCodeDesc": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GeoJSONPoint": {
        "type": "object",
        "properties": {
          "Coordinates": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "Coordinates of this point as [longitude, latitide]",
            "nullable": true
          },
          "AdditionalProperties": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PackageStatusEvent": {
        "type": "object",
        "properties": {
          "EventId": {
            "type": "integer",
            "description": "Unique identifier of the package within the FDC system",
            "format": "int32"
          },
          "TrackingNumber": {
            "type": "string",
            "description": "Tracking number as provided by the carrier",
            "nullable": true
          },
          "StatusTimestamp": {
            "type": "string",
            "description": "Timestamp of when the scanner triggered the event (UTC)",
            "nullable": true
          },
          "FdcEventId": {
            "type": "string",
            "description": "fdc_event_id associated with the event.",
            "nullable": true
          },
          "EventDetails": {
            "type": "string",
            "description": "The details of the event occoured.",
            "nullable": true
          },
          "Location": {
            "$ref": "#/components/schemas/GeoJSONPoint"
          },
          "PodImages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProofOfDeliveryImage"
            },
            "description": "Image URL for a signature or photo (Proof of Delivery)",
            "nullable": true
          },
          "AdditionalProperties": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProofOfDelivery": {
        "type": "object",
        "properties": {
          "Type": {
            "$ref": "#/components/schemas/ProofType"
          },
          "Url": {
            "type": "string",
            "description": "Gets or sets public URL the proof can be accessed at",
            "nullable": true
          },
          "AvailableUntil": {
            "type": "string",
            "description": "Gets or sets the date the proof will be available until",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Proof of delivery descriptor class"
      },
      "ProofOfDeliveryImage": {
        "type": "object",
        "properties": {
          "Type": {
            "type": "string",
            "description": "Proof of delivery image type",
            "nullable": true
          },
          "Url": {
            "type": "string",
            "description": "URL to access the image",
            "nullable": true
          },
          "AdditionalProperties": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProofType": {
        "enum": [
          0,
          1
        ],
        "type": "integer",
        "description": "Types of proof of delivery",
        "format": "int32"
      },
      "SpreetailTrackingDirection": {
        "type": "object",
        "properties": {
          "From": {
            "$ref": "#/components/schemas/SpreetailTrackingLocation"
          },
          "To": {
            "$ref": "#/components/schemas/SpreetailTrackingLocation"
          }
        },
        "additionalProperties": false
      },
      "SpreetailTrackingEvent": {
        "type": "object",
        "properties": {
          "Name": {
            "type": "string",
            "nullable": true
          },
          "Code": {
            "type": "string",
            "nullable": true
          },
          "Date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SpreetailTrackingLocation": {
        "type": "object",
        "properties": {
          "StateOrProvince": {
            "type": "string",
            "nullable": true
          },
          "PostalCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SpreetailTrackingResult": {
        "type": "object",
        "properties": {
          "TrackingNumber": {
            "type": "string",
            "nullable": true
          },
          "Direction": {
            "$ref": "#/components/schemas/SpreetailTrackingDirection"
          },
          "Events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpreetailTrackingEvent"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TrackingEvent": {
        "type": "object",
        "properties": {
          "Date": {
            "type": "string",
            "description": "Gets or sets the date of the event.",
            "format": "date-time"
          },
          "Type": {
            "type": "string",
            "description": "Gets or sets the type.",
            "nullable": true
          },
          "Location": {
            "$ref": "#/components/schemas/TrackingLocation"
          },
          "Notes": {
            "type": "string",
            "description": "Gets or sets the notes.",
            "nullable": true
          },
          "StatusId": {
            "type": "integer",
            "description": "Gets or sets the Spreetail package status ID, used to look up carrier-specific status codes.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Tracking Event"
      },
      "TrackingLocation": {
        "type": "object",
        "properties": {
          "City": {
            "type": "string",
            "description": "Gets or sets the city.",
            "nullable": true
          },
          "State": {
            "type": "string",
            "description": "Gets or sets the state.",
            "nullable": true
          },
          "PostalCode": {
            "type": "string",
            "description": "Gets or sets the postal code.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Tracking Location {City, State, PostalCode}"
      },
      "TrackingResponse": {
        "type": "object",
        "properties": {
          "TrackingNumber": {
            "type": "string",
            "description": "Gets or sets the tracking number.",
            "nullable": true
          },
          "EstimatedDelivery": {
            "type": "string",
            "description": "Gets or sets the estimated delivery.",
            "format": "date-time",
            "nullable": true
          },
          "ActualDelivery": {
            "type": "string",
            "description": "Gets or sets the actual delivery.",
            "format": "date-time",
            "nullable": true
          },
          "ProofOfDelivery": {
            "$ref": "#/components/schemas/ProofOfDelivery"
          },
          "OriginLocation": {
            "$ref": "#/components/schemas/TrackingLocation"
          },
          "DeliveryLocation": {
            "$ref": "#/components/schemas/TrackingLocation"
          },
          "Events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrackingEvent"
            },
            "description": "Gets or sets the events.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Spreetail Delivery tracking response"
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "JWT Authorization header using the Bearer scheme. \\r\\n\\r\\n\n                          Enter 'Bearer' [space] and then your token in the text input below.\n                          \\r\\n\\r\\nExample: 'Bearer 12345abcdef'",
        "name": "Authorization",
        "in": "header"
      },
      "Client-Id": {
        "type": "apiKey",
        "description": "Client-Id Example: 'Client-Id'",
        "name": "Client-Id",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ],
      "Client-Id": [ ]
    }
  ]
}