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

# Update shipment

> Update one or more shipment fields. All body fields are optional — only fields you include are touched.

Use `triggerBooking: true` to request pickup with the carrier after persisting the update. Same behaviour as `POST /shipments` with `autoBook: true` but lets you split persist and book into two calls (useful when collecting recipient details first and confirming pickup later).



## OpenAPI

````yaml PATCH /shipping/shipments/{id}
openapi: 3.1.0
info:
  title: bitbybit Open API — Shipping
  description: >-
    Programmatic access to bitbybit shipping: store locations, provider
    discovery, coverage lookup, fee quoting, and the full shipment lifecycle
    (create, book, update, cancel, track) across GoSend, KiriminAja, and
    RideBlitz.
  version: 1.0.0
  contact:
    name: bitbybit Support
    url: https://bitbybit.studio
servers:
  - url: https://api.bitbybit.studio/customer/api/open/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Store Locations
    description: >-
      Manage warehouse / pickup origin addresses. Couriers pick up from these
      locations when a shipment is booked.
  - name: Providers
    description: Discover connected carriers and the services each carrier offers.
  - name: Coverage
    description: >-
      Look up the courier-specific province / city / district / sub-district
      dictionaries needed to populate addresses and quote fees.
  - name: Fee Calculation
    description: Quote shipping fees across carriers using one unified request shape.
  - name: Shipments
    description: >-
      Create, update, cancel, and track shipments. A shipment is always attached
      to an Order.
paths:
  /shipping/shipments/{id}:
    patch:
      tags:
        - Shipments
      summary: Update shipment
      description: >-
        Update one or more shipment fields. All body fields are optional — only
        fields you include are touched.


        Use `triggerBooking: true` to request pickup with the carrier after
        persisting the update. Same behaviour as `POST /shipments` with
        `autoBook: true` but lets you split persist and book into two calls
        (useful when collecting recipient details first and confirming pickup
        later).
      operationId: updateShipment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateShipmentInput'
            examples:
              markDelivered:
                summary: Mark a custom shipment as delivered
                value:
                  shippingStatus: delivered
                  awb: MANUAL-001
              triggerBooking:
                summary: Request pickup for an existing KA shipment
                value:
                  triggerBooking: true
      responses:
        '200':
          description: Updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Shipment'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    UpdateShipmentInput:
      type: object
      description: All fields optional — patch semantics.
      properties:
        name:
          type: string
          maxLength: 255
        fee:
          type: number
          format: double
          minimum: 0
        shippingStatus:
          $ref: '#/components/schemas/ShippingStatus'
        serviceName:
          type: string
        serviceType:
          $ref: '#/components/schemas/ServiceType'
        selectedExpedition:
          type: string
        selectedDelivery:
          type: string
        courierGroup:
          type: string
        vehicleType:
          $ref: '#/components/schemas/VehicleType'
        bikeFuelType:
          $ref: '#/components/schemas/BikeFuelType'
        packageHandover:
          $ref: '#/components/schemas/PackageHandover'
        pickupSchedule:
          type: string
          format: date-time
        sender:
          $ref: '#/components/schemas/AddressInput'
        delivery:
          $ref: '#/components/schemas/AddressInput'
        package:
          $ref: '#/components/schemas/PackageInput'
        insurance:
          type: boolean
        insuranceFee:
          type: number
          format: double
          minimum: 0
        insuranceAmount:
          type: number
          format: double
          minimum: 0
        discountAmount:
          type: number
          format: double
          minimum: 0
        discountPercentage:
          type: number
          format: double
          minimum: 0
          maximum: 100
        distance:
          type: number
          format: double
          minimum: 0
        trackingUrl:
          type: string
          format: uri
        awb:
          type: string
        orderNo:
          type: string
        bookingId:
          type: string
        pickupNumber:
          type: string
        paymentId:
          type: string
        paymentStatus:
          $ref: '#/components/schemas/PaymentStatus'
        statusCode:
          type: integer
        cancellationReason:
          type: string
        triggerBooking:
          type: boolean
          description: >-
            When `true`, request pickup with the carrier after persisting this
            update. Same outcome as creating the shipment with `autoBook: true`.
    Shipment:
      type: object
      properties:
        id:
          type: string
        orderId:
          type: string
          nullable: true
        provider:
          $ref: '#/components/schemas/ShippingProvider'
        providerLabel:
          type: string
          description: Human-readable provider name (e.g. `KiriminAja`).
        name:
          type: string
          nullable: true
        fee:
          type: number
          format: double
          nullable: true
        currency:
          type: string
          nullable: true
        shippingStatus:
          anyOf:
            - $ref: '#/components/schemas/ShippingStatus'
            - type: 'null'
        serviceType:
          anyOf:
            - $ref: '#/components/schemas/ServiceType'
            - type: 'null'
        serviceName:
          type: string
          nullable: true
        selectedExpedition:
          type: string
          nullable: true
        selectedDelivery:
          type: string
          nullable: true
        courierGroup:
          type: string
          nullable: true
        vehicleType:
          anyOf:
            - $ref: '#/components/schemas/VehicleType'
            - type: 'null'
        bikeFuelType:
          type: string
          nullable: true
        packageHandover:
          anyOf:
            - $ref: '#/components/schemas/PackageHandover'
            - type: 'null'
        pickupSchedule:
          type: string
          format: date-time
          nullable: true
        storeLocationId:
          type: string
          nullable: true
        sender:
          $ref: '#/components/schemas/AddressOutput'
        delivery:
          $ref: '#/components/schemas/AddressOutput'
        package:
          $ref: '#/components/schemas/PackageOutput'
        driver:
          anyOf:
            - type: object
              properties:
                name:
                  type: string
                  nullable: true
                phone:
                  type: string
                  nullable: true
                photo:
                  type: string
                  nullable: true
                licensePlate:
                  type: string
                  nullable: true
            - type: 'null'
        insurance:
          type: boolean
          nullable: true
        insuranceFee:
          type: number
          format: double
          nullable: true
        insuranceAmount:
          type: number
          format: double
          nullable: true
        discountAmount:
          type: number
          format: double
          nullable: true
        discountPercentage:
          type: number
          format: double
          nullable: true
        distance:
          type: number
          format: double
          nullable: true
        trackingUrl:
          type: string
          nullable: true
        awb:
          type: string
          nullable: true
          description: Carrier waybill / tracking number. Populated after booking.
        orderNo:
          type: string
          nullable: true
          description: >-
            Carrier order number (KA `kj_order_id`, GoSend `orderNo`, RB
            merchant order id).
        bookingId:
          type: string
          nullable: true
        pickupNumber:
          type: string
          nullable: true
          description: KiriminAja Express pickup batch number.
        paymentId:
          type: string
          nullable: true
        paymentStatus:
          type: string
          nullable: true
        statusCode:
          type: integer
          nullable: true
          description: Provider-specific status code.
        cancellationReason:
          type: string
          nullable: true
        cancelledBy:
          type: string
          nullable: true
        cancelledSource:
          type: string
          nullable: true
        eventTimestamp:
          type: string
          nullable: true
    ShippingStatus:
      type: string
      enum:
        - confirmed
        - allocated
        - out_for_pickup
        - picked
        - out_for_delivery
        - on_hold
        - cancelled
        - delivered
        - rejected
        - no_driver
        - awaiting
        - on_the_way_to_pickup
        - delivering
        - delivery_completed
        - canceled
        - processed_packages
        - shipped_packages
        - canceled_packages
        - finished_packages
        - returned_packages
        - return_finished_packages
        - created
        - midmile_pickup_done
        - midmile_pickup_failed
        - arrived_blitz_hub
        - allocation_failure
        - pickup_started
        - pickup_done
        - pickup_failed
        - pickup_failure
        - dropoff_started
        - dropoff_done
        - dropoff_failed
        - delivery_failure
        - cancelled_by_blitz
        - cancelled_by_business
        - returned_to_business
      description: >-
        Unified shipping status. Some values are provider-specific (e.g.
        `cancelled_by_blitz` is RideBlitz, `midmile_pickup_done` is KiriminAja
        Express).
    ServiceType:
      type: string
      enum:
        - INSTANT
        - EXPRESS
      description: >-
        Service category. `INSTANT` = on-demand intra-city; `EXPRESS` =
        scheduled inter-city.
    VehicleType:
      type: string
      enum:
        - TWO_WHEEL
        - FOUR_WHEEL
      description: >-
        Vehicle requested for the pickup. `TWO_WHEEL` = motorcycle, `FOUR_WHEEL`
        = car.
    BikeFuelType:
      type: string
      enum:
        - regular
        - green
      description: >-
        RideBlitz fuel preference. `green` = electric fleet (lower emissions,
        may have limited availability).
    PackageHandover:
      type: string
      enum:
        - PICKUP
        - DROPOFF
      description: >-
        How the merchant hands the package to the carrier. `PICKUP` = courier
        picks up from the store, `DROPOFF` = merchant drops off at carrier hub.
    AddressInput:
      type: object
      required:
        - name
        - phone
        - address
        - coordinates
      properties:
        name:
          type: string
          maxLength: 255
        phone:
          type: string
          maxLength: 32
          description: >-
            E.164 (e.g. `+6281234567890`) recommended; bitbybit normalizes to
            `62…` for GoSend.
        email:
          type: string
          format: email
        address:
          type: string
        notes:
          type: string
          maxLength: 2000
        city:
          type: string
        province:
          type: string
        country:
          type: string
        zip:
          type: string
        kecamatan:
          type: string
        kecamatanId:
          type: integer
          description: KiriminAja `kecamatan_id` — required for KA Express.
        kelurahan:
          type: string
        kelurahanId:
          type: integer
          description: KiriminAja `kelurahan_id` — required for KA Express.
        coordinates:
          $ref: '#/components/schemas/Coordinates'
    PackageInput:
      type: object
      required:
        - weight
      properties:
        weight:
          type: number
          format: double
          description: Weight in grams.
        length:
          type: number
          format: double
          description: Length in cm.
        width:
          type: number
          format: double
          description: Width in cm.
        height:
          type: number
          format: double
          description: Height in cm.
        itemName:
          type: string
        itemType:
          type: string
          description: >-
            KA categories: `fashion`, `peralatan_elektronik_gadget`,
            `pecah_belah`, `dokumen`, `dokumen_berharga`, etc.
        itemValue:
          type: number
          format: double
          description: Declared item value in IDR (used for insurance calculations).
        itemQty:
          type: integer
          minimum: 1
        notes:
          type: string
          maxLength: 2000
    PaymentStatus:
      type: string
      enum:
        - unpaid
        - paid
        - failed
    ShippingProvider:
      type: string
      enum:
        - gosend
        - kirimin_aja
        - ride_blitz
        - jne
        - custom
      description: >-
        Provider/courier code. `gosend`, `kirimin_aja`, and `ride_blitz` are
        externally integrated; `jne` is a passthrough placeholder; `custom` is
        for merchant-defined methods.
    AddressOutput:
      type: object
      properties:
        name:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
        address:
          type: string
          nullable: true
        notes:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        province:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        zip:
          type: string
          nullable: true
        kecamatan:
          type: string
          nullable: true
        kecamatanId:
          type: integer
          nullable: true
        kelurahan:
          type: string
          nullable: true
        kelurahanId:
          type: integer
          nullable: true
        coordinates:
          anyOf:
            - $ref: '#/components/schemas/Coordinates'
            - type: 'null'
    PackageOutput:
      type: object
      properties:
        weight:
          type: number
          format: double
          nullable: true
        length:
          type: number
          format: double
          nullable: true
        width:
          type: number
          format: double
          nullable: true
        height:
          type: number
          format: double
          nullable: true
        itemName:
          type: string
          nullable: true
        itemType:
          type: string
          nullable: true
        itemValue:
          type: number
          format: double
          nullable: true
        itemQty:
          type: integer
          nullable: true
        notes:
          type: string
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Machine-readable code, e.g. `VALIDATION_ERROR`, `NOT_FOUND`,
                `INTEGRATION_NOT_CONNECTED`, `PROVIDER_ERROR`, `BOOKING_FAILED`.
            message:
              type: string
              description: Human-readable error message.
    Coordinates:
      type: object
      required:
        - lat
        - lng
      properties:
        lat:
          type: number
          format: double
          minimum: -90
          maximum: 90
        lng:
          type: number
          format: double
          minimum: -180
          maximum: 180
  responses:
    ValidationError:
      description: Request validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: VALIDATION_ERROR
              message: origin.districtId is required for KiriminAja Express
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: UNAUTHORIZED
              message: Invalid API key
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: NOT_FOUND
              message: Shipment not found
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Create one in Settings > Developer. The key
        must have the `BITCRM` product scope and an `orders` resource scope;
        required action depends on the endpoint (`READ`, `WRITE`, or `DELETE`).

````