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

# Calculate shipping fee

> Quote one or more service options for a given pickup → drop-off route, using a unified request shape regardless of provider.

**Per-provider requirements**

- **`gosend`** — `origin.{lat,lng}` and `destination.{lat,lng}` only. `options.paymentType` defaults to `3` (GoPay corporate). Returns the four GoSend service tiers (`Instant`, `SameDay`, `InstantCar`, `SameDayCar`).
- **`kirimin_aja`** — choose `options.serviceType`:
  - `EXPRESS` (default): requires `origin.districtId` + `destination.districtId` (look them up with `/shipping/coverage/districts`). `options.courier` defaults to all 12 supported couriers; pass a subset to narrow the quote. `options.insurance: true` includes insurance pricing.
  - `INSTANT`: requires geocoded coordinates plus addresses. `options.instantServices` defaults to `['gosend','borzo','grab_express']`; `options.vehicleType` chooses `TWO_WHEEL` (motor) vs `FOUR_WHEEL` (mobil).
- **`ride_blitz`** — `options.pickupCity` is required and **must** be one of the 46 allowed cities returned by `GET /shipping/coverage/cities?provider=ride_blitz`. `options.rideBlitzServiceTypes` defaults to all four tiers (`instant_1_hour` … `instant_4_hours`); each tier is quoted in parallel. `options.bikeFuelType` toggles `regular` vs `green` (electric).

**Response shape** is the same for every provider — an array of `options` with `serviceCode`, `serviceName`, `price`, `currency`, plus the raw provider payload under `raw` for advanced cases.



## OpenAPI

````yaml POST /shipping/calculate-fee
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/calculate-fee:
    post:
      tags:
        - Fee Calculation
      summary: Calculate shipping fee
      description: >-
        Quote one or more service options for a given pickup → drop-off route,
        using a unified request shape regardless of provider.


        **Per-provider requirements**


        - **`gosend`** — `origin.{lat,lng}` and `destination.{lat,lng}` only.
        `options.paymentType` defaults to `3` (GoPay corporate). Returns the
        four GoSend service tiers (`Instant`, `SameDay`, `InstantCar`,
        `SameDayCar`).

        - **`kirimin_aja`** — choose `options.serviceType`:
          - `EXPRESS` (default): requires `origin.districtId` + `destination.districtId` (look them up with `/shipping/coverage/districts`). `options.courier` defaults to all 12 supported couriers; pass a subset to narrow the quote. `options.insurance: true` includes insurance pricing.
          - `INSTANT`: requires geocoded coordinates plus addresses. `options.instantServices` defaults to `['gosend','borzo','grab_express']`; `options.vehicleType` chooses `TWO_WHEEL` (motor) vs `FOUR_WHEEL` (mobil).
        - **`ride_blitz`** — `options.pickupCity` is required and **must** be
        one of the 46 allowed cities returned by `GET
        /shipping/coverage/cities?provider=ride_blitz`.
        `options.rideBlitzServiceTypes` defaults to all four tiers
        (`instant_1_hour` … `instant_4_hours`); each tier is quoted in parallel.
        `options.bikeFuelType` toggles `regular` vs `green` (electric).


        **Response shape** is the same for every provider — an array of
        `options` with `serviceCode`, `serviceName`, `price`, `currency`, plus
        the raw provider payload under `raw` for advanced cases.
      operationId: calculateShippingFee
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CalculateFeeRequest'
            examples:
              gosend:
                summary: GoSend — Jakarta intra-city
                value:
                  provider: gosend
                  origin:
                    lat: -6.2087
                    lng: 106.8456
                  destination:
                    lat: -6.1751
                    lng: 106.865
                  package:
                    weight: 1500
              kiriminAjaExpress:
                summary: KiriminAja Express — JNE + J&T quote, Jakarta → Bandung
                value:
                  provider: kirimin_aja
                  origin:
                    lat: -6.2087
                    lng: 106.8456
                    districtId: 2412
                  destination:
                    lat: -6.9175
                    lng: 107.6191
                    districtId: 1981
                  package:
                    weight: 1500
                    length: 30
                    width: 20
                    height: 10
                    itemValue: 250000
                    itemQty: 1
                  options:
                    serviceType: EXPRESS
                    courier:
                      - jne
                      - jnt
                    insurance: true
              kiriminAjaInstant:
                summary: KiriminAja Instant — Borzo + GoSend quote
                value:
                  provider: kirimin_aja
                  origin:
                    lat: -6.2087
                    lng: 106.8456
                    address: Jl. Sudirman 1
                  destination:
                    lat: -6.1751
                    lng: 106.865
                    address: Jl. Thamrin 5
                  package:
                    weight: 2000
                    itemValue: 150000
                  options:
                    serviceType: INSTANT
                    instantServices:
                      - gosend
                      - borzo
                    vehicleType: TWO_WHEEL
              rideBlitzAll:
                summary: RideBlitz — quote all four tiers, Denpasar
                value:
                  provider: ride_blitz
                  origin:
                    lat: -8.6705
                    lng: 115.2126
                  destination:
                    lat: -8.6478
                    lng: 115.1378
                  package:
                    weight: 1000
                  options:
                    pickupCity: Kota Denpasar
                    bikeFuelType: green
      responses:
        '200':
          description: Quote successful.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CalculateFeeResponse'
              examples:
                gosendResponse:
                  summary: GoSend response
                  value:
                    data:
                      provider: gosend
                      currency: IDR
                      options:
                        - serviceCode: Instant
                          serviceName: GoSend Instant
                          serviceType: INSTANT
                          courierGroup: null
                          price: 28000
                          currency: IDR
                          estimatedDelivery: null
                          raw: {}
                        - serviceCode: SameDay
                          serviceName: GoSend Same Day
                          serviceType: EXPRESS
                          courierGroup: null
                          price: 18000
                          currency: IDR
                          estimatedDelivery: null
                          raw: {}
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    CalculateFeeRequest:
      type: object
      required:
        - provider
        - origin
        - destination
        - package
      properties:
        provider:
          type: string
          enum:
            - gosend
            - kirimin_aja
            - ride_blitz
        origin:
          type: object
          required:
            - lat
            - lng
          properties:
            lat:
              type: number
              format: double
            lng:
              type: number
              format: double
            address:
              type: string
            districtId:
              type: integer
              description: KiriminAja `kecamatan_id` — required for KA Express.
            subDistrictId:
              type: integer
        destination:
          type: object
          required:
            - lat
            - lng
          properties:
            lat:
              type: number
              format: double
            lng:
              type: number
              format: double
            address:
              type: string
            districtId:
              type: integer
            subDistrictId:
              type: integer
        package:
          $ref: '#/components/schemas/PackageInput'
        options:
          type: object
          description: >-
            Per-provider tuning. See endpoint description for which fields apply
            to which provider.
          properties:
            courier:
              type: array
              items:
                type: string
              description: 'KiriminAja Express: list of courier codes to quote.'
            instantServices:
              type: array
              items:
                type: string
              description: >-
                KiriminAja Instant: instant provider codes (`gosend`, `borzo`,
                `grab_express`).
            serviceType:
              $ref: '#/components/schemas/ServiceType'
            insurance:
              type: boolean
              description: 'KiriminAja: include insurance in the quote.'
            pickupCity:
              type: string
              description: 'RideBlitz: pickup city (must be from the allowed list).'
            rideBlitzServiceTypes:
              type: array
              items:
                type: string
                enum:
                  - instant_1_hour
                  - instant_2_hours
                  - instant_3_hours
                  - instant_4_hours
              description: 'RideBlitz: tiers to quote. Defaults to all four.'
            bikeFuelType:
              $ref: '#/components/schemas/BikeFuelType'
            paymentType:
              type: integer
              description: 'GoSend: defaults to `3`.'
            vehicleType:
              $ref: '#/components/schemas/VehicleType'
    CalculateFeeResponse:
      type: object
      properties:
        provider:
          type: string
          enum:
            - gosend
            - kirimin_aja
            - ride_blitz
        currency:
          type: string
        options:
          type: array
          items:
            $ref: '#/components/schemas/CalculateFeeOption'
    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
    ServiceType:
      type: string
      enum:
        - INSTANT
        - EXPRESS
      description: >-
        Service category. `INSTANT` = on-demand intra-city; `EXPRESS` =
        scheduled inter-city.
    BikeFuelType:
      type: string
      enum:
        - regular
        - green
      description: >-
        RideBlitz fuel preference. `green` = electric fleet (lower emissions,
        may have limited availability).
    VehicleType:
      type: string
      enum:
        - TWO_WHEEL
        - FOUR_WHEEL
      description: >-
        Vehicle requested for the pickup. `TWO_WHEEL` = motorcycle, `FOUR_WHEEL`
        = car.
    CalculateFeeOption:
      type: object
      properties:
        serviceCode:
          type: string
        serviceName:
          type: string
        serviceType:
          $ref: '#/components/schemas/ServiceType'
        courierGroup:
          type: string
          nullable: true
          description: >-
            KiriminAja Express: `regular`, `economy`, `one_day`, `cargo`,
            `next_day`.
        price:
          type: number
          format: double
          nullable: true
        currency:
          type: string
          default: IDR
        estimatedDelivery:
          type: string
          nullable: true
          description: >-
            Human-readable ETA when the provider returns one (e.g. `1-2 days`,
            `2 hours`).
        available:
          type: boolean
          description: >-
            RideBlitz only — `false` when a tier failed to quote (out of range,
            etc.).
        raw:
          type: object
          description: >-
            Pass-through of the provider's raw option payload for advanced
            consumers.
          additionalProperties: 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.
  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
  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`).

````