> ## Documentation Index
> Fetch the complete documentation index at: https://openapidocs.flexforwardship.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 取得訂單及其建立時使用的物流業者詳細資料

> 回傳已驗證帳戶範圍內的一筆訂單，以及建立標籤時提供的物流業者相關詳細資料。與僅回傳標籤文件的 GET /labels/:id 互為補充。



## OpenAPI

````yaml /flex-forward-zh-Hant.yaml get /orders/{orderId}
openapi: 3.1.0
info:
  title: Flex Forward Shipping API
  description: >-
    > **翻譯說明：** 此 API
    參考文件由英文翻譯而成。[英文版](/api-reference/labels/create-label)為官方權威來源。如翻譯內容有任何不一致之處，請以英文版為準。


    Flex Forward 提供統一的 API，用於建立配送標籤、取得標籤文件，以及追蹤多個物流業者的貨件。
  version: 1.0.0
servers:
  - url: https://api.flexforwardship.com
    description: Production
  - url: https://sandbox.flexforwardship.com
    description: Sandbox
security: []
tags:
  - name: Labels
    description: 取得配送標籤與標籤文件。
  - name: Tracking
    description: 追蹤貨件狀態與檢查點。
  - name: Products
    description: 列出可用的配送產品。
  - name: Couriers
    description: 列出可用的物流業者。
paths:
  /orders/{orderId}:
    get:
      tags:
        - Orders
      summary: 取得訂單及其建立時使用的物流業者詳細資料
      description: 回傳已驗證帳戶範圍內的一筆訂單，以及建立標籤時提供的物流業者相關詳細資料。與僅回傳標籤文件的 GET /labels/:id 互為補充。
      operationId: getOrder
      parameters:
        - schema:
            format: uuid
            type: string
          example: f47ac10b-58cc-4372-a567-0e02b2c3d479
          in: path
          name: orderId
          required: true
          description: 訂單識別碼。
      responses:
        '200':
          description: 預設回應
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderDetailResponse'
        '401':
          description: 缺少或無效的 x-rr-apikey / x-rr-apitoken。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: 憑證有效，但沒有存取此資源的權限。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: 此帳戶中沒有符合該識別碼的訂單。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            已超出此帳戶的請求速率限制。請等待 Retry-After
            標頭中指定的秒數後再重試。此處先行宣告速率限制，讓用戶端可在正式啟用前實作對應處理。
          headers:
            Retry-After:
              schema:
                type: integer
                minimum: 1
              description: 重試前需等待的秒數。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 非預期的伺服器錯誤。請使用指數退避重試。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKey: []
          apiToken: []
components:
  schemas:
    OrderDetailResponse:
      additionalProperties: false
      type: object
      required:
        - order
        - carrierDetails
      properties:
        order:
          $ref: '#/components/schemas/Order'
        carrierDetails:
          $ref: '#/components/schemas/OrderCarrierDetails'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          description: 人類可讀的錯誤訊息。
          type: string
          example: Shipping account not found
        code:
          description: 機器可讀的錯誤代碼。
          type: string
          example: COURIER_ERROR
    Order:
      additionalProperties: false
      description: 訂單及其貨件狀態。
      type: object
      required:
        - id
        - status
        - exceptionState
        - exceptionStateAt
        - exceptionReason
        - courier
        - customerOrderNumber
        - courierOrderNumber
        - courierTrackingNumber
        - serviceProductCode
        - shipToCountryCode
        - shipToPostalCode
        - shipFromCountryCode
        - parcelMeasurements
        - maskedRecipientName
        - error
        - createdAt
      properties:
        id:
          format: uuid
          description: 訂單識別碼。
          type: string
          example: f47ac10b-58cc-4372-a567-0e02b2c3d479
        status:
          description: >-
            貨件的運輸階段，依進程順序排列。目前的值：created、fetched、first_mile_received、transit_to_consolidation、arrive_consolidation、in_transit_last_mile、shipping_to_destination、delivered、failed。未來可能新增其他值。
          type: string
          example: created
        exceptionState:
          description: 一般情況下為 null，表示目前沒有任何例外狀態。
          anyOf:
            - description: >-
                訂單的商業狀態，與 `status`
                無關。目前的值：trashed、hold、carrier_hold、refund_requested、returned、refund_rejected。未來可能新增其他值。
              type: string
            - type: 'null'
          example: null
        exceptionStateAt:
          description: '`exceptionState` 最後變更的時間。當 `exceptionState` 為 null 時為 null。'
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
        exceptionReason:
          description: 目前例外狀態的原因，由客戶提供或由系統產生。
          anyOf:
            - type: string
            - type: 'null'
        courier:
          description: 此訂單使用的配送帳戶物流業者。
          type: string
          example: yunexpress-tw
        customerOrderNumber:
          minLength: 1
          description: 客戶訂單編號：若有提供則為 order.customerOrderNumber 的值，若未提供則為系統產生的值。
          type: string
          example: N2026-05-13-TEST-01
        courierOrderNumber:
          description: 物流業者自身的訂單編號（指派後）。
          anyOf:
            - type: string
            - type: 'null'
        courierTrackingNumber:
          description: 最後一哩配送的追蹤編號（指派後）。
          anyOf:
            - type: string
            - type: 'null'
        serviceProductCode:
          description: 物流業者服務產品代碼。
          anyOf:
            - type: string
            - type: 'null'
        shipToCountryCode:
          description: 目的地國家代碼（ISO 3166-1 alpha-2）。
          anyOf:
            - type: string
            - type: 'null'
        shipToPostalCode:
          description: 目的地郵遞區號。
          anyOf:
            - type: string
            - type: 'null'
        shipFromCountryCode:
          description: 出發地國家代碼（ISO 3166-1 alpha-2）。
          anyOf:
            - type: string
            - type: 'null'
        parcelMeasurements:
          description: 建立標籤時申報的包裹重量與尺寸。
          anyOf:
            - additionalProperties: false
              type: object
              required:
                - weightUnit
                - dimensionUnit
                - parcels
              properties:
                weightUnit:
                  anyOf:
                    - type: string
                    - type: 'null'
                dimensionUnit:
                  anyOf:
                    - type: string
                    - type: 'null'
                parcels:
                  type: array
                  items:
                    additionalProperties: false
                    type: object
                    required:
                      - parcelId
                      - weight
                      - dimension
                    properties:
                      parcelId:
                        anyOf:
                          - type: string
                          - type: 'null'
                      weight:
                        type: number
                      dimension:
                        anyOf:
                          - additionalProperties: false
                            type: object
                            required:
                              - length
                              - width
                              - height
                            properties:
                              length:
                                type: number
                              width:
                                type: number
                              height:
                                type: number
                          - type: 'null'
            - type: 'null'
        maskedRecipientName:
          description: 收件人姓名（部分遮罩）。
          anyOf:
            - type: string
            - type: 'null'
        error:
          description: 當向物流業者送出訂單失敗時才會出現。`message` 為物流業者的原始文字，原樣傳回。
          anyOf:
            - additionalProperties: false
              type: object
              required:
                - code
                - message
              properties:
                code:
                  type: string
                message:
                  type: string
            - type: 'null'
        createdAt:
          format: date-time
          description: 訂單建立的時間。
          type: string
    OrderCarrierDetails:
      additionalProperties: false
      type: object
      required:
        - integration
        - orderNumbers
        - customs
        - iossApplied
        - serviceOptions
        - courierOptions
      properties:
        integration:
          type: string
          enum:
            - yunexpress
        orderNumbers:
          additionalProperties: false
          description: 建立標籤時提供的訂單識別碼。
          type: object
          required:
            - platformOrderNumber
            - trackingNumber
            - referenceNumbers
          properties:
            platformOrderNumber:
              anyOf:
                - type: string
                - type: 'null'
            trackingNumber:
              anyOf:
                - type: string
                - type: 'null'
            referenceNumbers:
              type: array
              items:
                type: string
        customs:
          additionalProperties: false
          description: 由客戶提供的報關識別碼。
          type: object
          required:
            - taxNumber
            - ioss
            - vat
            - eori
          properties:
            taxNumber:
              anyOf:
                - type: string
                - type: 'null'
            ioss:
              anyOf:
                - type: string
                - type: 'null'
            vat:
              anyOf:
                - type: string
                - type: 'null'
            eori:
              anyOf:
                - type: string
                - type: 'null'
        iossApplied:
          anyOf:
            - type: string
            - type: 'null'
        serviceOptions:
          type: array
          items:
            additionalProperties: false
            type: object
            required:
              - code
              - value
              - cost
            properties:
              code:
                type: string
              value:
                anyOf:
                  - type: string
                  - type: 'null'
              cost:
                anyOf:
                  - type: number
                  - type: 'null'
        courierOptions:
          additionalProperties: false
          description: 由客戶提供的物流業者專屬選項。
          type: object
          required:
            - sourceCode
            - platformAccountCode
            - sensitiveType
            - signatureService
            - houseNumber
            - packageCount
            - senderUsci
            - platformName
            - platformState
            - platformAddress
            - platformPostalCode
            - platformPhone
            - platformEmail
            - platformSalesUrl
            - cargoType
            - paymentPlatform
            - paymentPlatformAccount
            - paymentTransactionNumber
            - labelUrl
          properties:
            sourceCode:
              anyOf:
                - type: string
                - type: 'null'
            platformAccountCode:
              anyOf:
                - type: string
                - type: 'null'
            sensitiveType:
              anyOf:
                - type: string
                - type: 'null'
            signatureService:
              anyOf:
                - type: string
                - type: 'null'
            houseNumber:
              anyOf:
                - type: string
                - type: 'null'
            packageCount:
              anyOf:
                - type: integer
                - type: 'null'
            senderUsci:
              anyOf:
                - type: string
                - type: 'null'
            platformName:
              anyOf:
                - type: string
                - type: 'null'
            platformState:
              anyOf:
                - type: string
                - type: 'null'
            platformAddress:
              anyOf:
                - type: string
                - type: 'null'
            platformPostalCode:
              anyOf:
                - type: string
                - type: 'null'
            platformPhone:
              anyOf:
                - type: string
                - type: 'null'
            platformEmail:
              anyOf:
                - type: string
                - type: 'null'
            platformSalesUrl:
              anyOf:
                - type: string
                - type: 'null'
            cargoType:
              anyOf:
                - type: string
                - type: 'null'
            paymentPlatform:
              anyOf:
                - type: string
                - type: 'null'
            paymentPlatformAccount:
              anyOf:
                - type: string
                - type: 'null'
            paymentTransactionNumber:
              anyOf:
                - type: string
                - type: 'null'
            labelUrl:
              anyOf:
                - type: string
                - type: 'null'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-rr-apikey
    apiToken:
      type: apiKey
      in: header
      name: x-rr-apitoken

````