> ## 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.

# 取得標籤的追蹤事件

> 返回標籤的目前追蹤狀態與檢查點歷史。可接受標籤 UUID 或 customerOrderNumber 作為路徑參數。



## OpenAPI

````yaml /flex-forward-zh-Hant.yaml get /tracking/{id}
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://api-staging.flexforwardship.com
    description: Staging
security: []
tags:
  - name: CreateLabels
    description: 建立配送標籤。
  - name: Labels
    description: 取得配送標籤與標籤文件。
  - name: Tracking
    description: 追蹤貨件狀態與檢查點。
  - name: Products
    description: 列出可用的配送產品。
paths:
  /tracking/{id}:
    get:
      tags:
        - Tracking
      summary: 取得標籤的追蹤事件
      description: 返回標籤的目前追蹤狀態與檢查點歷史。可接受標籤 UUID 或 customerOrderNumber 作為路徑參數。
      operationId: getTracking
      parameters:
        - schema:
            minLength: 1
            type: string
          example: f47ac10b-58cc-4372-a567-0e02b2c3d479
          in: path
          name: id
          required: true
          description: 標籤 UUID 或客戶訂單編號。
      responses:
        '200':
          description: 貨件的追蹤資訊。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrackingResponse'
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: 當標籤已建立但物流業者提交失敗時返回。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabelFailedResponse'
        '502':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
        - apiKey: []
          apiToken: []
components:
  schemas:
    TrackingResponse:
      additionalProperties: false
      description: 貨件的追蹤資訊。
      type: object
      required:
        - id
        - trackingNumber
        - tag
        - subtag
        - subtagMessage
        - slug
        - checkpoints
      properties:
        id:
          format: uuid
          description: 標籤識別碼。
          type: string
          example: f47ac10b-58cc-4372-a567-0e02b2c3d479
        trackingNumber:
          description: 物流業者指派的追蹤編號，尚未取得時為 null。
          anyOf:
            - type: string
            - type: 'null'
          example: YT2503010001CN
        tag:
          description: >-
            高階追蹤狀態。可能的值：Pending、InfoReceived、InTransit、Delivered、Exception、Cancelled、Unknown。
          type: string
          example: InTransit
        subtag:
          description: 詳細狀態子標籤。
          type: string
          example: InTransit_001
        subtagMessage:
          description: 子標籤的人類可讀描述。
          type: string
          example: In transit
        slug:
          description: 物流業者代碼。
          type: string
          example: yunexpress
        checkpoints:
          description: 依時間順序排列的追蹤事件清單。
          type: array
          items:
            additionalProperties: false
            description: 單一追蹤事件檢查點。
            type: object
            required:
              - checkpointTime
              - city
              - state
              - countryRegion
              - location
              - message
              - tag
              - subtag
              - subtagMessage
              - slug
            properties:
              checkpointTime:
                description: 追蹤事件的時間戳記。
                type: string
                example: '2025-03-02T10:30:00.000Z'
              city:
                description: 事件發生的城市。
                anyOf:
                  - type: string
                  - type: 'null'
                example: Shenzhen
              state:
                description: 州或省份。
                anyOf:
                  - type: string
                  - type: 'null'
                example: Guangdong
              countryRegion:
                description: ISO 3166-1 alpha-2 國家代碼。
                anyOf:
                  - type: string
                  - type: 'null'
                example: CN
              location:
                description: 詳細地點或設施名稱。
                anyOf:
                  - type: string
                  - type: 'null'
              message:
                description: 追蹤事件的人類可讀描述。
                type: string
                example: Shipment departed from sorting center
              tag:
                description: 此檢查點時的狀態標籤。
                type: string
                example: InTransit
              subtag:
                description: 詳細子標籤。
                type: string
                example: InTransit_001
              subtagMessage:
                description: 人類可讀的子標籤訊息。
                type: string
                example: In transit
              slug:
                description: 物流業者代碼。
                type: string
                example: yunexpress
    ErrorResponse:
      additionalProperties: false
      type: object
      required:
        - error
      properties:
        error:
          description: 人類可讀的錯誤訊息。
          type: string
          example: Shipping account not found
        code:
          description: 機器可讀的錯誤代碼。
          type: string
          example: COURIER_ERROR
    LabelFailedResponse:
      additionalProperties: false
      description: 當標籤已建立但物流業者提交失敗時返回。
      type: object
      required:
        - error
      properties:
        error:
          description: 錯誤摘要。
          type: string
          enum:
            - Label creation failed
        errorCode:
          description: 物流業者專屬錯誤代碼。
          type: string
          example: COURIER_ERROR
        errorMessage:
          description: 人類可讀的錯誤訊息。
          type: string
          example: Address validation failed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: x-rr-apikey
    apiToken:
      type: apiKey
      in: header
      name: x-rr-apitoken

````