# Get Service

> List the delivery services available for a route and shop. Call this first, then pass a returned `service_id` (or `service_type_id`) into Calculate Fee and Create Order.

## Endpoint

| Environment | URL |
| --- | --- |
| Production | `https://online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/available-services` |
| Staging | `https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/available-services` |

**Method**: `POST`

## Headers

| Header | Required | Description |
| --- | --- | --- |
| `Content-Type` | Yes | `application/json` |
| `Token` | Yes | Shop token (issued by GHN) — [get a token](https://developer.ghn.vn/en/docs/token/get-token.md) |
| `ShopId` | Yes | Shop ID (int) |

## Parameters

- **shop_id** (Int): The shop whose contract/pricing determines the available services. This is a **body field** (distinct from the `ShopId` header)
- **from_district** (Int): Pickup district ID (from [Get District](https://developer.ghn.vn/en/docs/master-data/get-district.md))
- **to_district** (Int): Delivery district ID (from [Get District](https://developer.ghn.vn/en/docs/master-data/get-district.md))

## Request Example

```bash
curl -X POST https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/available-services \
  -H "Token: 5c1d8a9e-2f4b-11ed-..." \
  -H "ShopId: 92837" \
  -H "Content-Type: application/json" \
  -d '{
    "shop_id": 196560,
    "from_district": 1452,
    "to_district": 1444
  }'
```

## Response

### Success (HTTP 200)

_Captured from a real Staging-environment call._

```json
{
  "code": 200,
  "message": "Success",
  "data": [
    {
      "service_id": 53320,
      "short_name": "Hàng nhẹ",
      "service_type_id": 2
    },
    {
      "service_id": 100039,
      "short_name": "Hàng nặng",
      "service_type_id": 5
    }
  ]
}
```

### Response Fields

`data` is an array of available services.

| Field | Type | Description |
| --- | --- | --- |
| `service_id` | Int | Service ID — pass it to [Calculate Fee](https://developer.ghn.vn/en/docs/order/calculate-fee.md) and [Create Order](https://developer.ghn.vn/en/docs/order/create.md) |
| `short_name` | String | Service display name, e.g. "Hàng nhẹ" (light goods) or "Hàng nặng" (heavy goods) |
| `service_type_id` | Int | Service type, chosen by weight:<br>`2`: total weight **under 20 kg**<br>`5`: total weight **20 kg or more**, or multi-parcel orders |

## Notes

- **An empty response means the shop was not found.** If the `shop_id` you send does not exist, GHN returns HTTP 200 with an **empty body** (not a JSON error). Treat an empty body as "shop not found".

## Error Codes

| code_message | HTTP | When |
| --- | --- | --- |
| `USER_ERR_COMMON` | 400 | Missing `shop_id` / `from_district` / `to_district` |
| `WARD_IS_INVALID` | 400 | A new-format address could not be mapped to a district |
| `SERVER_ERROR_COMMON` | 500 | Internal error |
