# Get rates

`POST /v2/rates`

**Base URLs:**

- Sandbox: `https://api.sandbox.bobgo.co.za`
- Production: `https://api.bobgo.co.za`

**Authentication:** Bearer token required (see the Authentication page).

## Example request

```bash
curl -X POST 'https://api.sandbox.bobgo.co.za/v2/rates' \
  -H "content-type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
  "collection_address": {
    "type": "business",
    "company": "Bob Go",
    "street_address": "24 Rothesay Avenue",
    "local_area": "Craighall Park",
    "city": "Johannesburg",
    "zone": "Gauteng",
    "country": "ZA",
    "code": "2196"
  },
  "delivery_address": {
    "type": "residential",
    "street_address": "5 Long Street",
    "local_area": "Cape Town City Centre",
    "city": "Cape Town",
    "zone": "Western Cape",
    "country": "ZA",
    "code": "8001"
  },
  "parcels": [
    {
      "submitted_length_cm": 30,
      "submitted_width_cm": 20,
      "submitted_height_cm": 10,
      "submitted_weight_kg": 2,
      "description": "Box of books"
    }
  ],
  "declared_value": 1500,
  "timeout": 25000,
  "collection_contact_full_name": "Jane Seller",
  "collection_contact_mobile_number": "0821234567",
  "collection_contact_email": "seller@example.com",
  "delivery_contact_full_name": "John Buyer",
  "delivery_contact_mobile_number": "0839876543",
  "delivery_contact_email": "buyer@example.com"
}'
```

Asks every courier enabled on your account to quote for a set of parcels moving
between two addresses, and returns their answers in one response.

The call is synchronous: Bob Go fans the request out to the couriers and waits
for them, up to `timeout` milliseconds. A courier that fails or times out is
reported on its own entry and does not fail the request.

> **Always send `timeout` explicitly.** Omit it and Bob Go checks once, after
> about 200 ms, so the response comes back with most rates still `pending`.
> Send `25000` for the full wait. See below.

## Request

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `collection_address` | object | yes | Where the parcels are collected. See [address fields](../4_Important%20concepts/README.md#addresses). Not needed when you send `collection_pickup_point_location_id`. |
| `delivery_address` | object | yes | Where the parcels are delivered. Not needed when you send `delivery_pickup_point_location_id`. |
| `parcels` | array | yes | At least one parcel. See [parcel fields](../4_Important%20concepts/README.md#parcels). |
| `declared_value` | number | no | Value of the contents in ZAR. Drives insurance and, for some couriers, the rate. |
| `providers` | array of string | no | Restrict the quote to these provider slugs. Defaults to every provider enabled on the account. |
| `service_levels` | array of string | no | Restrict the quote to these service level codes. |
| `timeout` | integer | **send it** | Milliseconds to wait for couriers, capped at `25000`. Defaults to `0`, which means a single check after about 200 ms, not the maximum. |
| `requested_collection_date` | timestamp | no | The date you intend to hand the parcels over. Affects couriers that price by lead time. |
| `collection_contact_full_name` | string | no | |
| `collection_contact_mobile_number` | string | no | |
| `collection_contact_email` | string | no | |
| `delivery_contact_full_name` | string | no | |
| `delivery_contact_mobile_number` | string | no | |
| `delivery_contact_email` | string | no | |
| `collection_pickup_point_location_id` | integer | no | Collect from a pickup point instead of an address. Needs `pickup_point_provider_slug`. |
| `delivery_pickup_point_location_id` | integer | no | Deliver to a pickup point / locker instead of an address. |
| `pickup_point_provider_slug` | string | with a collection pickup point | The provider the pickup points belong to. Required with `collection_pickup_point_location_id`, and send it with `delivery_pickup_point_location_id` too. It restricts the quote to that provider, overriding `providers`, and it is what makes Bob Go check that the location is available and the parcels fit. Without it a delivery pickup point is not checked at all. See [Pickup points](../12_Pickup%20points/locations.md). |

Couriers charge on the greater of actual and volumetric weight, so dimensions
matter as much as weight.

## Response

```json
{
  "id": 90881234,
  "account_id": 1234,
  "collection_address": { "...": "..." },
  "delivery_address": { "...": "..." },
  "parcels": [
    {
      "submitted_length_cm": 30,
      "submitted_width_cm": 20,
      "submitted_height_cm": 10,
      "submitted_weight_kg": 2
    }
  ],
  "declared_value": 1500,
  "total_submitted_weight_kg": 2,
  "timeout": 25000,
  "time_created": "2026-09-05T08:30:00Z",
  "provider_rate_requests": [
    {
      "rate_response_id": 55512345,
      "provider_id": 4,
      "provider_slug": "tcg",
      "provider_name": "The Courier Guy",
      "status": "success",
      "failed_reason": "",
      "responses": [
        {
          "service_level_code": "ECO",
          "service_level": { "...": "..." },
          "rate_amount": 96.45,
          "rate_amount_excl_vat": 83.87,
          "charged_weight_kg": 2,
          "status": "success"
        }
      ]
    }
  ]
}
```

Keep the top-level `id`: that is the `selected_rate_request_id` you pass when
you create the shipment.

### How long the call actually waits

`timeout` is the budget for the whole request, and Bob Go reserves the last
five seconds of it to build and return the response. So `timeout: 25000` polls
the couriers for roughly 20 seconds, not 25, and stops early once every courier
has answered. Anything above `25000`, or below `0`, is clamped to `25000`.

Omitting `timeout` is not the same as sending the maximum. Anything up to 5000
leaves no polling budget, so Bob Go checks once after about 200 ms and returns
a `200` with whatever has come back, usually most providers still `pending`.
Either send a real timeout, or send a short one and poll
[`GET /v2/rates?id=…`](rate_request.md).

### Rate statuses

`status` appears both per provider and per rate:

| Status | Meaning |
| --- | --- |
| `success` | The rate is bookable. |
| `success-no-rates` | The courier answered but does not service this lane. |
| `pending` | Still waiting when the timeout elapsed. |
| `failed-will-retry` | A transient failure at the courier. |
| `failed-indefinitely` | The courier rejected the request, or Bob Go did: the parcels are over the service level's weight or size limit, or your balance does not cover the rate. `failed_reason` says why. |
| `unimplemented` | The courier does not support this kind of quote. |

Only offer rates with `status: "success"` to your customers.

## Notes

- Rates are quotes, not reservations. Prices can move between quoting and
  booking; the amount actually charged is the one on the shipment.
- `rate_amount` is what Bob Go will charge you for the shipment, VAT included,
  and `rate_amount_excl_vat` is the same price without VAT. Both include the
  markup on your Bob Go plan, unless the service level is set to exclude it.
  None of your rates-at-checkout markups or checkout rules apply here.
- On a courier account connected with your own credentials, Bob Go adds
  nothing: both amounts are the courier's price as the courier quotes it, so
  they are equal.
- A rate request with no usable rates is a `200`, not an error, so check the
  statuses.
