openapi: 3.0.3
info:
  version: 1.0.0
  title: Goods API
  description: "Goods API enables querying for delivery options available, as well as scheduling and tracking of deliveries. All dates and times are in UTC."
  termsOfService: "https://goodsdelivery.io/tos.pdf"
  contact:
    name: Goods API Development Team
    url: "https://docs.goodsdelivery.io/"
    email: developers@goodsdelivery.io
  license:
    name: Proprietary
    url: "https://goodsdelivery.io/license"
servers:
  - url: "https://api.goodsdelivery.io/v1"
    description: Production
  - url: "https://api-sandbox.goodsdelivery.io/v1"
    description: Sandbox
paths:
  /deliveries:
    post:
      operationId: CreateDelivery
      summary: Create Delivery
      description: "To create a delivery, use this endpoint. Your request body should include a JSON object with several required fields. The endpoint also checks whether the provided zip codes for pick-up and destination are within the Goods coverage area."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateJobRequest"
            examples:
              Example:
                value:
                  jobDetails:
                    serviceType: SAME_DAY
                    externalId: G2345234
                    brandId: JEzWQD3cLni3mdzMURHh
                    packagesTotalValueUsd: 349
                    packages:
                      - volumeFt3: 1.33
                        weightLbs: 4.5
                        lengthIn: 16
                        widthIn: 12
                        heightIn: 12
                    addons:
                      - EXTRA_INSURANCE
                    contactlessPreferred: true
                  consumer:
                    firstName: Bill
                    lastName: Walther
                    phone: "+13476138055"
                    email: bill.walther@mail.com
                  pickUp:
                    name: Great Store 1
                    address1: 206 Mercer St
                    city: New York
                    zipCode: "10012"
                    state: NY
                    country: US
                  dropOff:
                    name: Holm House
                    address1: 331 East 5th Street
                    address2: APT F3
                    city: New York
                    zipCode: "10003"
                    state: NY
                    country: US
                    note: Feel free to leave the package in the lobby.
      responses:
        "201":
          description: "If all required fields are provided and the zip codes are valid, a success response with a code of 201, as well as an ID and Short ID, will be returned. Short ID of the delivery, which is more readable and human friendly ID primarily used in consumer communication."
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/CreateJobResponse"
                    required:
                      - object
              examples:
                Example:
                  value:
                    success: true
                    object:
                      id: 9vSVMvvj8VKLLUWuPZTG
                      shortId: D23D21
                      trackingUrl: "https://tracking.goodsdelivery.io/D23D21"
                      labelUrl: "https://storage.googleapis.com/goods-sandbox.appspot.com/labels%2FNjY2MWIyMTZkNjYxNmViZGM4NmI4YzMz"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Delivery
    put:
      operationId: UpdateDelivery
      summary: Update Delivery
      description: |
        To update an existing delivery issue a PUT request. Your body should include a JSON object with the requested changes, where you use the `ShortId` or `ID` in the request as the ID of the delivery in order to match your request with an existing delivery.
      requestBody:
        description: In the request you can provide values only for the properties that you want to update
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateJobRequest"
      responses:
        "200":
          description: "If the request is valid, a successful response will be provided."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Can not update
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Return not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Delivery
  /returns:
    post:
      operationId: CreateReturn
      summary: Create Return
      description: "To create a return pick-up, use this endpoint. Your request body should include a JSON object with several required fields. The endpoint also checks whether the provided zip codes for pick-up and destination are within the Goods coverage area."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateJobRequest"
      responses:
        "201":
          description: "If all required fields are provided and the zip codes are valid, a success response with a code of 201, as well as an ID and Short ID, will be returned."
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/CreateJobResponse"
                    required:
                      - object
              examples:
                Example:
                  value:
                    success: true
                    object:
                      id: 7vSVMvvj8VKLLUWuPZTa
                      shortId: R23D21
                      trackingUrl: "https://tracking.goodsdelivery.io/R23D21"
                      labelUrl: "https://storage.googleapis.com/goods-sandbox.appspot.com/labels%2FNjY2MWIyMTZkNjYxNmViZGM4NmI4YzMz"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Return
    put:
      operationId: UpdateReturn
      summary: Update Return
      description: |
        To update an existing return issue a PUT request. Your body should include a JSON object with the requested changes, where you use the `ShortId` or `ID` in the request as the ID of the return in order to match your request with an existing return.
      requestBody:
        description: In the request you can provide values only for the properties that you want to update
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateJobRequest"
      responses:
        "200":
          description: "If the request is valid, a successful response will be provided."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SuccessResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Can not update
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Return not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Return
  "/deliveries/{id}":
    get:
      operationId: GetDelivery
      summary: Get Delivery
      description: To request the details of an existing delivery use the ShortId or ID in the request as the ID of the delivery.
      parameters:
        - name: id
          in: path
          description: Delivery ID or ShortId.
          required: true
          schema:
            type: string
      responses:
        "200":
          description: |
            If the request if valid, the a success response will contain detailed information about the delivery divided in four overall objects:
            - **jobDetails** such as pickup-, drop-off address, consumer information, package details etc.
            - **deliveryDetails** such as current delivery status, ETA, courier information, live coordinates and route information
            - **historyDetails** such as earlier statuses with timestamps
            - **completionDetails** such as proof of delivery, completion notes and -time
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/GetJobResponse"
                    required:
                      - object
              examples:
                Scheduled Delivery:
                  value:
                    success: true
                    object:
                      jobDetails:
                        id: aEqsjjvDNKeGSO8Jn1jz
                        shortId: DLIE7D
                        brandId: XOEdJIxIRal8cVyTDcM5
                        externalId: A1234
                        brandName: Goods6
                        brandLogoUrl: "https://example.com/image"
                        consumer:
                          phone: "+13476138055"
                          lastName: Lee
                          firstName: Elizabeth
                          email: niels.thomsen@goodsdelivery.io
                        pickUp:
                          name: Holm House
                          address1: 40 Mercer St
                          address2: test
                          zipCode: "10006"
                          city: New York
                          state: NY
                          country: US
                        dropOff:
                          name: John Doe
                          address1: 320 East 49th Street
                          address2: "42"
                          zipCode: "10006"
                          city: New York
                          state: NY
                          country: United States
                        serviceType: SAME_DAY
                        contactlessPreferred: false
                        addons:
                          - SIGNATURE_REQUIRED
                        packagesTotalValueUsd: 83.27
                        packages:
                          - weightLbs: 0.5
                            heightIn: 0
                            widthIn: 0
                            lengthIn: 0
                        createdAt: "2023-06-02T06:47:26.003Z"
                        updatedAt: "2023-06-02T06:47:29.021Z"
                      deliveryDetails:
                        pickUpTimeSlot:
                          earliest: "2023-06-02T20:00:00.000Z"
                          latest: "2023-06-02T22:00:00.000Z"
                        dropOffTimeSlot:
                          earliest: "2023-06-02T22:00:00.000Z"
                          latest: "2023-06-03T02:00:00.000Z"
                        courier:
                          name: ""
                          phone: ""
                          vehicleType: ""
                          vehicleImage: ""
                          realTimeCoordinates:
                            lat: 0
                            lng: 0
                        status:
                          currentStatus: SCHEDULED
                          trackingUrl: ""
                          totalStops: 0
                          stopNumber: 0
                          courierAtStop: 0
                      historyDetails:
                        earlierStatuses: []
                      completionDetails:
                        completionTime: ""
                        proofOfDelivery:
                          photoUrls: []
                          signatureUrl: ""
                        coordinatesAtCompletion:
                          lat: 0
                          lng: 0
                        completionNote: ""
                Delivery in progress:
                  value:
                    success: true
                    object:
                      jobDetails:
                        id: iY10fXlPvBI0Gla9E9Bs
                        shortId: D09FQL
                        brandId: XOEdJIxIRal8cVyTDcM5
                        externalId: "1234"
                        brandName: Goods6
                        brandLogoUrl: "https://example.com/image"
                        consumer:
                          phone: "+13476138055"
                          lastName: Lee
                          firstName: Elizabeth
                          email: niels.thomsen@goodsdelivery.io
                        pickUp:
                          name: Grand Shop
                          address1: 40 Mercer St
                          address2: test
                          zipCode: "10006"
                          city: New York
                          state: NY
                          country: US
                        dropOff:
                          name: John Smith
                          address1: 320 East 49th Street
                          address2: "42"
                          zipCode: "10006"
                          city: New York
                          state: NY
                          country: United States
                        serviceType: SAME_DAY
                        contactlessPreferred: false
                        addons:
                          - SIGNATURE_REQUIRED
                        packagesTotalValueUsd: 83.27
                        packages:
                          - weightLbs: 0.5
                            heightIn: 0
                            widthIn: 0
                            lengthIn: 0
                        createdAt: "2023-06-07T07:27:24.599Z"
                        updatedAt: "2023-06-07T07:28:37.248Z"
                      deliveryDetails:
                        pickUpTimeSlot:
                          earliest: "2023-06-07T20:00:00.000Z"
                          latest: "2023-06-07T22:00:00.000Z"
                        dropOffTimeSlot:
                          earliest: "2023-06-07T22:00:00.000Z"
                          latest: "2023-06-08T02:00:00.000Z"
                        courier:
                          name: Roger Beans
                          photo: "+16105579117"
                          phone: "+16105579117"
                          vehicleType: BICYCLE
                          vehicleImage: ""
                          realTimeCoordinates:
                            lat: 31.471459167250536
                            lng: 74.27190847341404
                        status:
                          currentStatus: OUT_FOR_DROP_OFF
                          eta: "2023-06-18T06:10:38.354Z"
                          trackingUrl: "https://t.goodsdelivery.io/D5f79f"
                          totalStops: 8
                          stopNumber: 4
                          courierAtStop: 2
                      historyDetails:
                        earlierStatuses:
                          - status: PICKED_UP
                            changedAt: "2023-06-07T07:28:18.233Z"
                            courierName: Roger Beans
                          - status: AT_HUB
                            changedAt: "2023-06-07T07:28:27.050Z"
                            courierName: Roger Beans
                      completionDetails:
                        completionTime: ""
                        proofOfDelivery:
                          photoUrls: []
                          signatureUrl: ""
                        coordinatesAtCompletion:
                          lat: 54.32343
                          lng: -12.4343
                        completionNote: ""
                Delivery completion:
                  value:
                    success: true
                    object:
                      jobDetails:
                        id: 2vgwCvpSEEdzjDDBrpgb
                        shortId: DMYRK5
                        brandId: XOEdJIxIRal8cVyTDcM5
                        externalId: "1234"
                        brandName: Goods6
                        brandLogoUrl: "https://example.com/image"
                        consumer:
                          phone: "+13476138055"
                          lastName: Lee
                          firstName: Elizabeth
                          email: niels.thomsen@goodsdelivery.io
                        pickUp:
                          name: Great Store
                          address1: 40 Mercer St
                          address2: test
                          zipCode: "10006"
                          city: New York
                          state: NY
                          country: US
                        dropOff:
                          name: John Smith
                          address1: 320 East 49th Street
                          address2: "42"
                          zipCode: "10006"
                          city: New York
                          state: NY
                          country: United States
                        serviceType: SAME_DAY
                        contactlessPreferred: false
                        packagesTotalValueUsd: 83.27
                        packages:
                          - weightLbs: 0.5
                            heightIn: 0
                            widthIn: 0
                            lengthIn: 0
                        createdAt: "2023-06-07T07:17:04.262Z"
                        updatedAt: "2023-06-07T07:22:56.371Z"
                      deliveryDetails:
                        pickUpTimeSlot:
                          earliest: "2023-06-07T20:00:00.000Z"
                          latest: "2023-06-07T22:00:00.000Z"
                        dropOffTimeSlot:
                          earliest: "2023-06-07T22:00:00.000Z"
                          latest: "2023-06-08T02:00:00.000Z"
                        courier:
                          name: Roger Beans
                          photo: "+16105579117"
                          phone: "+16105579117"
                          vehicleType: BICYCLE
                          vehicleImage: ""
                          realTimeCoordinates:
                            lat: 0
                            lng: 0
                        status:
                          trackingUrl: "https://example.com"
                          currentStatus: COMPLETED
                          eta: ""
                          totalStops: 0
                          stopNumber: 0
                          courierAtStop: 0
                      historyDetails:
                        earlierStatuses:
                          - status: PICKED_UP
                            changedAt: "2023-06-07T07:21:07.802Z"
                            courierName: Roger Beans
                          - status: AT_HUB
                            changedAt: "2023-06-07T07:21:16.973Z"
                            courierName: Roger Beans
                          - status: COMPLETED
                            changedAt: "2023-06-07T07:22:54.969Z"
                            courierName: Roger Beans
                      completionDetails:
                        completionTime: "2023-06-07T07:22:54.969Z"
                        proofOfDelivery:
                          photoUrls:
                            - "https://d15p8tr8p0vffz.cloudfront.net/5d8fb30635dbfad2544a90aa/800x.png"
                          signatureUrl: ""
                        coordinatesAtCompletion:
                          lat: 31.47146863128758
                          lng: 74.27196253517279
                        completionNote: ""
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Delivery not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security: []
      tags:
        - Delivery
    delete:
      operationId: DeleteDelivery
      summary: Delete Delivery
      description: |
        To cancel an existing delivery issue a DELETE request, where you use the `ShortId` or `ID` in the request as the ID of the delivery in order to match your request with an existing delivery.
      parameters:
        - name: id
          in: path
          description: ID of the delivery to delete
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "If the request is valid, a successful response will be provided."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SuccessResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Can not delete
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Delivery not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Delivery
  /deliveries/duplicate:
    post:
      operationId: DuplicateDelivery
      summary: Duplicate Delivery
      description: Duplicate Delivery
      requestBody:
        description: Request body
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DuplicateJobRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/CreateJobResponse"
                    required:
                      - object
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Delivery
  "/deliveries/brands/{brandId}/all":
    get:
      operationId: GetAllDeliveries
      summary: Get All Deliveries
      description: To request the details of an all delivery tasks for a specific brand
      parameters:
        - name: brandId
          in: path
          description: Brand ID.
          required: true
          schema:
            type: string
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/pageNumber"
        - $ref: "#/components/parameters/orderBy"
        - $ref: "#/components/parameters/orderDirection"
        - $ref: "#/components/parameters/search"
        - $ref: "#/components/parameters/filters"
      responses:
        "200":
          description: |
            If the request if valid, the a success response will contain array containing detailed information about each delivery divided in four overall objects:

            - **jobDetails** such as pickup-, drop-off address, consumer information, package details etc.
            - **deliveryDetails** such as current delivery status, ETA, courier information, live coordinates and route information
            - **historyDetails** such as earlier statuses with timestamps
            - **completionDetails** such as proof of delivery, completion note and -time
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ObjectsResponse"
                  - type: object
                    properties:
                      objects:
                        type: array
                        items:
                          $ref: "#/components/schemas/GetJobResponse"
                    required:
                      - objects
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Delivery
  "/deliveries/externalId/{externalId}":
    get:
      operationId: GetDeliveriesByExternalId
      summary: Get Deliveries by ExternalId
      description: Get Deliveries by ExternalId
      parameters:
        - name: externalId
          in: path
          description: external Id.
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Object with list of deliveries
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ObjectsResponse"
                  - type: object
                    properties:
                      objects:
                        type: array
                        items:
                          $ref: "#/components/schemas/GetJobResponse"
                    required:
                      - objects
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Delivery
  "/returns/{id}":
    get:
      operationId: GetReturn
      summary: Get Return
      description: To request the details of an existing return use the ShortId or ID in the request as the ID of the return.
      parameters:
        - name: id
          in: path
          description: Return ID or ShortId.
          required: true
          schema:
            type: string
      responses:
        "200":
          description: |
            If the request if valid, the a success response will contain detailed information about the return divided in four overall objects:

            - **jobDetails** such as pickup-, drop-off address, consumer information, package details etc.
            - **deliveryDetails** such as current delivery status, ETA, courier information, live coordinates and route information
            - **historyDetails** such as earlier statuses with timestamps
            - **completionDetails** such as proof of delivery, completion note and -time
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/GetJobResponse"
                    required:
                      - object
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Return not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security: []
      tags:
        - Return
    delete:
      operationId: DeleteReturn
      summary: Delete Return
      description: |
        To cancel a scheduled return pick-up issue a DELETE request, where you use the `ShortId` or `ID` in the request as the ID of the return in order to match your request with an return delivery.
      parameters:
        - name: id
          in: path
          description: ID of the return to delete
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "If the request is valid, a successful response will be provided."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SuccessResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Can not delete
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Return not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Return
  "/returns/brands/{brandId}/all":
    get:
      operationId: GetAllReturns
      summary: Get All Returns
      description: To request the details of an all return tasks for a specific brand
      parameters:
        - name: brandId
          in: path
          description: Brand ID.
          required: true
          schema:
            type: string
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/pageNumber"
        - $ref: "#/components/parameters/orderBy"
        - $ref: "#/components/parameters/orderDirection"
        - $ref: "#/components/parameters/search"
        - $ref: "#/components/parameters/filters"
      responses:
        "200":
          description: |
            If the request if valid, the a success response will contain array containing detailed information about each return divided in four overall objects:

            - **jobDetails** such as pickup-, drop-off address, consumer information, package details etc.
            - **deliveryDetails** such as current delivery status, ETA, courier information, live coordinates and route information
            - **historyDetails** such as earlier statuses with timestamps
            - **completionDetails** such as proof of delivery, completion note and -time
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ObjectsResponse"
                  - type: object
                    properties:
                      objects:
                        type: array
                        items:
                          $ref: "#/components/schemas/GetJobResponse"
                    required:
                      - objects
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Return
  "/returns/externalId/{externalId}":
    get:
      operationId: GetDReturnsByExternalId
      summary: Get Returns by ExternalId
      description: Get Returns by ExternalId
      parameters:
        - name: externalId
          in: path
          description: external Id.
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Object with list of returns
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ObjectsResponse"
                  - type: object
                    properties:
                      objects:
                        type: array
                        items:
                          $ref: "#/components/schemas/GetJobResponse"
                    required:
                      - objects
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Return
  /returns/duplicate:
    post:
      operationId: DuplicateReturn
      summary: Duplicate Return
      description: Duplicate Return
      requestBody:
        description: Request body
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DuplicateJobRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/CreateJobResponse"
                    required:
                      - object
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Return
  /webhooks:
    post:
      operationId: CreateWebhook
      summary: Create Webhook
      description: |
        You can create webhooks to receive notifications about specific events related to objects like deliveries and returns. After creating a webhook, your configured endpoint will start receiving POST requests. This allows your application to execute code and/or trigger actions, instead of making periodic API calls.

        When consuming webhook notifications, it is required that you respond with a status code of `200`. We use this response as confirmation that the notification has reached your endpoint. If a webhook notification receives a response with a status code other than `200`, we will disable the webhook after a number of re-attempts.

        Currently we have released so you can create webhooks on the following events:

        - DELIVERY_STATUS_UPDATED
        - RETURN_STATUS_UPDATED
        - ETA_AND_COORDINATES
        - DELIVERY_CREATED
        - RETURN_CREATED
      requestBody:
        description: Create a webhook for Goods to send updates about deliveries/returns to.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateWebhookRequest"
            examples:
              Example:
                value:
                  url: "https://your-domain.com/goodsWebhook"
                  brandId: HDYZkzx5htgbitz3x4ij
                  scopes:
                    - DELIVERY_STATUS_UPDATED
                  additionalHeaders:
                    - key: authorization
                      value: Bearer dnweiuhfsknfsuiehfweiafbuise
      responses:
        "201":
          description: |
            If the webhook request is valid, a 201 response will include the ID of the requested webhook, along with its scope and brand.

            If the webhook request is invalid, an error response will be provided that explains the specific problem. For example, webhooks must use HTTPS, the specified domain cannot be used as a webhook endpoint, or the specified scope is not valid.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/Webhook"
                    required:
                      - object
              examples:
                Example:
                  value:
                    success: true
                    object:
                      id: AEYZkzx5htgbitz3x456
                      url: "https://your-domain.com/goodsWebhook"
                      brandId: HDYZkzx5htgbitz3x4ij
                      scopes:
                        - DELIVERY_STATUS_UPDATED
                      additionalHeaders:
                        - key: authorization
                          value: Bearer dnweiuhfsknfsuiehfweiafbuise
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Webhook
  "/webhooks/{webhookId}":
    delete:
      operationId: DeleteWebhook
      summary: Delete Webhook
      description: Use this endpoint to delete any webhook that you no longer require.
      parameters:
        - name: webhookId
          in: path
          description: The ID of the webhook.
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "If the request is valid, a successful response will be provided."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SuccessResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Webhook not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Webhook
  "/brands/{brandId}/webhooks":
    get:
      operationId: GetWebhooks
      summary: Get Webhooks
      description: Use this endpoint to list all created webhooks for your brand.
      parameters:
        - name: brandId
          in: path
          description: The ID of the brand.
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "If the request if valid, the a success response will contain a full list of all webhooks associated with the requested brand."
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      objects:
                        type: array
                        items:
                          $ref: "#/components/schemas/Webhook"
                    required:
                      - objects
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Webhook
  /label:
    post:
      operationId: GenerateLabel
      summary: Generate Label
      description: |
        Use this endpoint to generate a shipping label for a specific delivery or return using the `ID`. 

        While labels are not required by default, they are expected. However, when creating deliveries and returns, you may add "WITHOUT_LABEL" as an add-on to indicate that the delivery will not have a label.

        The endpoint currently only supports the following formats and sizes:

        - Format: `pdf` or `html`
        - Size:
            - Width: `4` inches
            - Height: `6` inches

        If you prefer a different size or format, please don’t hesitate to reach out to us at niels.thomsen@goodsdelivery.io. We're happy to add additional options upon request.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateLabelRequest"
      responses:
        "200":
          description: |
            If the request is valid, a successful response will contain the requested shipping label. 

            If the request is invalid, the error response will include an error code and a helpful error message, such as, "The requested delivery does not exist.”
          content:
            application/pdf:
              schema:
                type: string
                format: binary
            text/html:
              schema:
                type: string
                format: binary
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Label
  /csv/import:
    post:
      operationId: CsvImport
      summary: CSV Import
      description: |
        Use this endpoint to bulk create deliveries or returns from CSV. Required a CSV file with headers: 

        jobType,serviceType,brandId,externalId,packagesTotalValueUsd,addons,note,scheduledDate,customerFirstName,customerLastName,customerPhone,customerEmail,pickUpName,pickUpAddress1,pickUpAddress2,pickUpCity,pickUpZipCode,pickUpState,pickUpCountry,pickUpNote,dropOffName,dropOffAddress1,dropOffAddress2,dropOffCity,dropOffZipCode,dropOffState,dropOffCountry,dropOffNote

        Some headers are optional - the same as rules as in CreateDelivery/CreateReturn endpoints apply.
      requestBody:
        required: true
        content:
          text/csv:
            schema:
              type: string
      responses:
        "200":
          description: Response with created IDs and list of errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CsvImportResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Csv
  /quote:
    post:
      operationId: GenerateQuote
      summary: Generate Quote
      description: "Use this endpoint to check whether we are able to deliver a specific order. If delivery is possible, the endpoint will provide information on available services, delivery times (including cutoff times), pickup times, associated rates, and possible add-ons."
      requestBody:
        description: Request a quote for a delivery
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GenerateQuoteSchema"
      responses:
        "201":
          description: |
            If the request is valid, a successful response will contain a list of available services for the particular delivery including a list of associated rates.

            If the request is invalid, the error response will include an error code and a useful error message, such as “The destination address is outside of our current service area”.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/Quote"
                    required:
                      - object
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Quote not available
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Quote
  /coverage:
    get:
      operationId: GetCoverage
      summary: Get Coverage
      description: |
        Use this endpoint to receive a complete list of supported zip codes in which our delivery services are offered.

        This endpoint has many use cases, including:

        - Add a filtering facet to category pages that shows products available for same-day delivery from our stores
        - Update your application to reflect the list of applicable zip codes
      responses:
        "200":
          description: "If the request is valid, a successful response will contain a complete list of supported zip codes."
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ObjectsResponse"
                  - type: object
                    properties:
                      objects:
                        type: array
                        items:
                          $ref: "#/components/schemas/Coverage"
                    required:
                      - objects
              examples:
                Example:
                  value:
                    success: true
                    objects:
                      - name: New York
                        pickUpZipCodes:
                          - "10005"
                          - "10006"
                        dropOffZipCodes:
                          - "10005"
                          - "10007"
                        services:
                          - serviceType: SAME_DAY
                            jobType: DELIVERY
                          - serviceType: NEXT_DAY
                            jobType: DELIVERY
                          - serviceType: SAME_DAY
                            jobType: RETURN
                          - serviceType: NEXT_DAY
                            jobType: RETURN
                        operatingDays:
                          - monday
                          - tuesday
                          - wednesday
                          - thursday
                          - friday
                          - saturday
                          - sunday
                      - name: Los Angeles
                        pickUpZipCodes:
                          - "90046"
                          - "90047"
                          - "90048"
                        dropOffZipCodes:
                          - "90046"
                          - "90047"
                          - "90049"
                        services:
                          - serviceType: SAME_DAY
                            jobType: DELIVERY
                          - serviceType: NEXT_DAY
                            jobType: DELIVERY
                          - serviceType: SAME_DAY
                            jobType: RETURN
                          - serviceType: NEXT_DAY
                            jobType: RETURN
                        operatingDays:
                          - monday
                          - tuesday
                          - wednesday
                          - thursday
                          - friday
        "404":
          description: No coverage found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Coverage
  "/coverage/{zipCodes}":
    get:
      operationId: CheckZipCodes
      summary: Check Zip Codes
      description: |
        Use this endpoint to check if we support a specific zip-code or several zip-codes.
      parameters:
        - name: zipCodes
          in: path
          description: "List of zip codes, comma separated"
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "If the request is valid, the response will contain a list with the status of each requested zip code."
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      object:
                        $ref: "#/components/schemas/Coverage"
                    required:
                      - object
              examples:
                Example:
                  value:
                    success: true
                    object:
                      name: New York
                      pickUpZipCodes:
                        - "10005"
                        - "10006"
                      dropOffZipCodes:
                        - "10005"
                        - "10007"
                      services:
                        - serviceType: SAME_DAY
                          jobType: DELIVERY
                        - serviceType: NEXT_DAY
                          jobType: DELIVERY
                        - serviceType: SAME_DAY
                          jobType: RETURN
                        - serviceType: NEXT_DAY
                          jobType: RETURN
                      operatingDays:
                        - monday
                        - tuesday
                        - wednesday
                        - thursday
                        - friday
        "404":
          description: No coverage found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - APIKeyHeader:
            - brand
        - AuthorizationHeader:
            - brand
      tags:
        - Coverage
components:
  parameters:
    filters:
      in: query
      name: filters
      description: "Filters array. The array item is an object with 3 properties - field, operator and value. It uses format like in npm library 'qs'. See the example."
      required: false
      example: "filters[0][field]=consumer.email&filters[0][operator]=eq&filters[0][value]=test@gmail.com"
      style: deepObject
      schema:
        type: array
        items:
          type: object
          additionalProperties:
            type: object
            required:
              - field
              - operator
              - value
            properties:
              field:
                type: string
              operator:
                type: string
                enum:
                  - eq
                  - neq
                  - gt
                  - lt
                  - in
              value:
                type: string
    orderBy:
      in: query
      name: orderBy
      description: The field name of sorting the results
      required: false
      schema:
        type: string
        default: created_at
    orderDirection:
      in: query
      name: orderDirection
      description: The sorting direction. ASC or DESC
      required: false
      schema:
        type: string
        default: ASC
        enum:
          - ASC
          - DESC
    pageNumber:
      in: query
      name: pageNumber
      description: The page number. Indexed from 1
      required: false
      schema:
        type: integer
        default: 1
    pageSize:
      in: query
      name: pageSize
      description: The number of objects to return per page.
      required: false
      schema:
        type: integer
        default: 10
    search:
      in: query
      name: search
      description: The search phrase
      required: false
      schema:
        type: string
  schemas:
    JobType:
      type: string
      enum:
        - DELIVERY
        - RETURN
    CreateJobRequest:
      type: object
      properties:
        jobDetails:
          $ref: "#/components/schemas/CreateJobRequestJobDetails"
        consumer:
          $ref: "#/components/schemas/Consumer"
        pickUp:
          $ref: "#/components/schemas/Address"
        dropOff:
          $ref: "#/components/schemas/Address"
      required:
        - jobDetails
        - consumer
        - pickUp
        - dropOff
    CreateJobRequestJobDetails:
      type: object
      properties:
        serviceType:
          $ref: "#/components/schemas/ServiceType"
        scheduledDate:
          description: Required if serviceType is SCHEDULED. Date in ISO 8601 format
          type: string
          format: date-time
          example: "2023-06-02"
        externalId:
          description: External reference - an ID that uniquely identifies the order in your systems.
          type: string
        brandId:
          description: This is the Goods-provided brand ID. It represents the brand for which the delivery is being made and may vary for multi-brand setups.
          type: string
        packagesTotalValueUsd:
          description: Total package value (USD).
          type: number
          format: double
        packages:
          type: array
          items:
            $ref: "#/components/schemas/Package"
        addons:
          description: Optional add-ons specifically for the delivery. Please note that these add-ons typically incur an additional cost.
          type: array
          items:
            $ref: "#/components/schemas/Addon"
        note:
          description: "These are optional notes regarding the specific delivery. However, please note that any specific pick-up, drop-off, or delivery instructions belong in separate sections."
          type: string
        contactlessPreferred:
          description: Defines if the consumer prefers contactless delivery.
          type: boolean
      required:
        - serviceType
        - externalId
        - brandId
        - packagesTotalValueUsd
    UpdateJobRequest:
      type: object
      properties:
        id:
          description: ID of the job
          type: string
        pickUp:
          $ref: "#/components/schemas/Address"
        dropOff:
          $ref: "#/components/schemas/Address"
        consumer:
          $ref: "#/components/schemas/Consumer"
        contactlessPreferred:
          description: Defines if the costumer prefer contactless delivery
          type: boolean
        addons:
          description: Add-ons for the delivery service
          type: array
          items:
            $ref: "#/components/schemas/Addon"
        serviceType:
          $ref: "#/components/schemas/ServiceType"
        scheduledDate:
          description: Required if serviceType is SCHEDULED. Date in ISO 8601 format
          type: string
          format: date-time
          example: "2023-06-02"
      required:
        - id
    CreateJobResponse:
      type: object
      properties:
        id:
          description: Unique ID of the delivery.
          type: string
        shortId:
          description: The short ID is a more readable and consumer-friendly delivery ID.
          type: string
        trackingUrl:
          type: string
        labelUrl:
          type: string
      required:
        - id
        - shortId
        - trackingUrl
        - labelUrl
    CreateWebhookRequest:
      allOf:
        - $ref: "#/components/schemas/WebhookBase"
    Webhook:
      allOf:
        - type: object
          properties:
            id:
              description: Webhook ID
              type: string
          required:
            - id
        - $ref: "#/components/schemas/WebhookBase"
    WebhookBase:
      type: object
      properties:
        url:
          description: Where should we send notifications to.
          type: string
          format: url
        brandId:
          description: "ID of the related brand. If provided, only notifications related to this brand will be send out. For non-internal uses, the responses will be limited by brandId associated with authenticated account."
          type: string
        scopes:
          description: What types of events do we want to subscribe to.
          type: array
          items:
            type: string
            enum:
              - DELIVERY_STATUS_UPDATED
              - RETURN_STATUS_UPDATED
              - DELIVERY_CREATED
              - RETURN_CREATED
              - ETA_AND_COORDINATES
        additionalHeaders:
          type: array
          items:
            $ref: "#/components/schemas/WebhookHeader"
      required:
        - brandId
        - url
        - scopes
    WebhookHeader:
      type: object
      properties:
        key:
          type: string
        value:
          type: string
      required:
        - key
        - value
    CreateLabelRequest:
      type: object
      properties:
        jobId:
          description: ID or Short ID of delivery or return
          type: string
        externalId:
          description: External ID of delivery or return
          type: string
        brandId:
          description: Unique identifier of the brand
          type: string
        format:
          type: string
          enum:
            - pdf
            - html
        labelSize:
          type: object
          properties:
            width:
              type: number
              maximum: 10
              minimum: 4
            height:
              type: number
              maximum: 10
              minimum: 5
    CsvImportResponse:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: "#/components/schemas/CsvImportRowResponse"
      required:
        - rows
    CsvImportRowResponse:
      type: object
      properties:
        success:
          type: boolean
        rowNumber:
          type: integer
        createdId:
          type: string
        createdShortId:
          type: string
        errors:
          type: array
          items:
            type: string
      required:
        - success
        - rowNumber
    DuplicateJobRequest:
      type: object
      properties:
        brandId:
          type: string
        externalId:
          type: string
      required:
        - brandId
        - externalId
    Address:
      type: object
      properties:
        name:
          description: Company name
          type: string
        address1:
          type: string
        address2:
          type: string
        city:
          type: string
        zipCode:
          type: string
        state:
          description: 2 letter state code - ISO 3166-2
          type: string
        country:
          description: 2 letter country code - ISO 3166-2
          type: string
        note:
          description: "Address note - how to get there, etc."
          type: string
      required:
        - address1
        - city
        - zipCode
        - state
        - country
    Consumer:
      type: object
      properties:
        firstName:
          type: string
        lastName:
          type: string
        phone:
          description: Phone is required when email is not provided
          type: string
          format: phone
        email:
          description: Email is required when phone is not provided
          type: string
          format: email
      required:
        - firstName
        - lastName
    Addon:
      description: Add-ons for the delivery service
      type: string
      enum:
        - EXTRA_INSURANCE
        - SIGNATURE_REQUIRED
        - WITHOUT_LABEL
    ServiceType:
      description: "Determine the delivery date, including pick-up and drop-off times."
      type: string
      enum:
        - SAME_DAY
        - NEXT_DAY
        - SCHEDULED
    ErrorResponse:
      type: object
      properties:
        message:
          description: Human readable error message.
          type: string
        code:
          description: Machine readable error message.
          type: string
        more:
          description: More help on the error here.
          type: string
          format: url
      required:
        - message
        - code
    Package:
      type: object
      properties:
        volumeFt3:
          description: "Volume of the package in cubic foot (ft3), if known"
          type: number
        weightLbs:
          description: "Package weight in pounds (lbs), if known."
          type: number
        lengthIn:
          description: "Length of the pack in inches, if known."
          type: number
        widthIn:
          description: "Width of the pack in inches, if known."
          type: number
        heightIn:
          description: "Height of the pack in inches, if known."
          type: number
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
      required:
        - success
    Coordinates:
      type: object
      properties:
        lat:
          type: number
        lng:
          type: number
      required:
        - lat
        - lng
    AddressWithCoordinates:
      allOf:
        - $ref: "#/components/schemas/Address"
        - type: object
          properties:
            coordinates:
              $ref: "#/components/schemas/Coordinates"
    GetJobResponseJobDetails:
      type: object
      properties:
        id:
          type: string
        shortId:
          type: string
        externalId:
          type: string
        brandId:
          type: string
        brandName:
          type: string
        brandLogoUrl:
          type: string
        consumer:
          $ref: "#/components/schemas/Consumer"
        pickUp:
          $ref: "#/components/schemas/AddressWithCoordinates"
        dropOff:
          $ref: "#/components/schemas/AddressWithCoordinates"
        serviceType:
          $ref: "#/components/schemas/ServiceType"
        contactlessPreferred:
          type: boolean
        addons:
          description: Add-ons for the delivery service
          type: array
          items:
            $ref: "#/components/schemas/Addon"
        packagesTotalValueUsd:
          type: number
        packages:
          type: array
          items:
            $ref: "#/components/schemas/Package"
        savedCo2Kg:
          description: Estimated amount of CO2 the delivery will save the environment
          type: number
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - shortId
        - externalId
        - brandId
        - brandName
        - brandLogoUrl
        - consumer
        - pickUp
        - dropOff
        - serviceType
    TimeSlot:
      type: object
      properties:
        earliest:
          type: string
        latest:
          type: string
      required:
        - earliest
        - latest
    Courier:
      type: object
      properties:
        name:
          type: string
        phone:
          type: string
        photo:
          type: string
        vehicleType:
          type: string
        vehicleImage:
          type: string
        realTimeCoordinates:
          $ref: "#/components/schemas/Coordinates"
    Status:
      type: object
      properties:
        currentStatus:
          type: string
        eta:
          description: Future date string with estimated time of arrival
          type: string
          format: date-time
        trackingUrl:
          type: string
        totalStops:
          type: number
        stopNumber:
          type: number
        courierAtStop:
          type: number
      required:
        - currentStatus
        - trackingUrl
    GetJobResponseDeliveryDetails:
      type: object
      properties:
        pickUpTimeSlot:
          $ref: "#/components/schemas/TimeSlot"
        dropOffTimeSlot:
          $ref: "#/components/schemas/TimeSlot"
        courier:
          $ref: "#/components/schemas/Courier"
        status:
          $ref: "#/components/schemas/Status"
      required:
        - pickUpTimeSlot
        - dropOffTimeSlot
        - status
    EarlierStatus:
      type: object
      properties:
        status:
          type: string
        changedAt:
          type: string
          format: date-time
        courierName:
          type: string
        courierPhotoUrl:
          type: string
      required:
        - status
        - changedAt
    GetJobResponseHistoryDetails:
      type: object
      properties:
        earlierStatuses:
          type: array
          items:
            $ref: "#/components/schemas/EarlierStatus"
        failedAttempts:
          type: number
    ProofOfDelivery:
      type: object
      properties:
        photoUrls:
          type: array
          items:
            type: string
        signatureUrl:
          type: string
    GetJobResponseCompletionDetails:
      type: object
      properties:
        completionTime:
          type: string
          format: date-time
        proofOfDelivery:
          $ref: "#/components/schemas/ProofOfDelivery"
        coordinatesAtCompletion:
          $ref: "#/components/schemas/Coordinates"
        completionNote:
          type: string
        feedback:
          type: string
        rating:
          type: number
      required:
        - completionTime
        - proofOfDelivery
        - coordinatesAtCompletion
    GetJobResponse:
      type: object
      properties:
        jobDetails:
          $ref: "#/components/schemas/GetJobResponseJobDetails"
        deliveryDetails:
          $ref: "#/components/schemas/GetJobResponseDeliveryDetails"
        historyDetails:
          $ref: "#/components/schemas/GetJobResponseHistoryDetails"
        completionDetails:
          $ref: "#/components/schemas/GetJobResponseCompletionDetails"
      required:
        - jobDetails
        - deliveryDetails
        - historyDetails
    ObjectsResponse:
      type: object
      properties:
        pagesCount:
          type: number
        page:
          type: number
        objectsCount:
          type: number
      required:
        - pagesCount
        - page
        - objectsCount
    GenerateQuoteSchema:
      description: Delivery information for the requested quote
      type: object
      properties:
        brandId:
          description: Unique identifier of the brand.
          type: string
        orderValueUsd:
          description: Total value of the order in USD
          type: number
        pickUp:
          $ref: "#/components/schemas/GenerateQuoteSchemaAddress"
        dropOff:
          $ref: "#/components/schemas/GenerateQuoteSchemaAddress"
        addons:
          description: Add-ons for the delivery service
          type: array
          items:
            $ref: "#/components/schemas/Addon"
      required:
        - brandId
        - pickUp
        - dropOff
    Quote:
      description: Quote with available services and prices
      type: object
      properties:
        availableServices:
          type: array
          items:
            $ref: "#/components/schemas/Service"
      required:
        - availableServices
    GenerateQuoteSchemaAddress:
      description: Address data
      type: object
      properties:
        address1:
          type: string
        address2:
          type: string
        city:
          type: string
        zipCode:
          type: string
        state:
          description: 2 letter state code - ISO 3166-2
          type: string
        country:
          description: 2 letter country code - ISO 3166-2
          type: string
        company:
          type: string
      required:
        - zipCode
    Service:
      type: object
      properties:
        serviceType:
          $ref: "#/components/schemas/ServiceType"
        jobType:
          $ref: "#/components/schemas/JobType"
        cutOffTime:
          type: string
          format: date-time
        pickUpEarliestTime:
          type: string
          format: date-time
        pickUpLatestTime:
          type: string
          format: date-time
        dropOffEarliestTime:
          type: string
          format: date-time
        dropOffLatestTime:
          type: string
          format: date-time
        consumerSettings:
          $ref: "#/components/schemas/ConsumerSettingsWithPrice"
      required:
        - serviceType
        - jobType
        - pickUpEarliestTime
        - pickUpLatestTime
        - dropOffEarliestTime
        - dropOffLatestTime
    ConsumerSettings:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
      required:
        - name
        - description
    ConsumerSettingsWithPrice:
      allOf:
        - $ref: "#/components/schemas/ConsumerSettings"
        - type: object
          required:
            - priceUsd
          properties:
            priceUsd:
              type: number
    Coverage:
      type: object
      properties:
        name:
          type: string
        pickUpZipCodes:
          type: array
          items:
            type: string
        dropOffZipCodes:
          type: array
          items:
            type: string
        operatingDays:
          type: array
          items:
            $ref: "#/components/schemas/WeekDay"
        services:
          type: array
          items:
            type: object
            required:
              - serviceType
              - jobType
            properties:
              serviceType:
                $ref: "#/components/schemas/ServiceType"
              jobType:
                $ref: "#/components/schemas/JobType"
        timeZone:
          type: string
      required:
        - name
        - pickUpZipCodes
        - dropOffZipCodes
        - services
        - operatingDays
        - timeZone
    WeekDay:
      type: string
      enum:
        - monday
        - tuesday
        - wednesday
        - thursday
        - friday
        - saturday
        - sunday
    AddressWithPhoneAndCoordinates:
      allOf:
        - $ref: "#/components/schemas/AddressWithCoordinates"
        - type: object
          properties:
            phone:
              type: string
          required:
            - phone
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
    AuthorizationHeader:
      type: http
      scheme: bearer
tags:
  - name: Quote
    x-displayName: Quote
  - name: Delivery
    x-displayName: Delivery
  - name: Return
    x-displayName: Return
  - name: Webhook
    x-displayName: Webhook
  - name: Label
    x-displayName: Label
  - name: Csv
    x-displayName: Csv
  - name: Coverage
    x-displayName: Coverage
x-tagGroups:
  - name: "1"
    tags:
      - Delivery
      - Return
      - Webhook
      - Label
      - Csv
  - name: "2"
    tags:
      - Quote
      - Coverage
