> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.feryrides.co.in/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.feryrides.co.in/_mcp/server.

# Integration flow

> End-to-end booking flow between DMRC and Fery

# Integration flow

```text
1. POST /ride/fare-estimate     → fare quotes (scooty / cab)
2. POST /ride/create-order      → orderId, otp
      include user + webhookURL + serviceType
3. Receive webhooks on webhookURL
      status: accepted → arrived → started → dropped
      location: location_updated
4. POST /ride/cancel            → optional
5. POST /ride/feedback          → optional
```

## 1. Fare estimate

Call `POST /ride/fare-estimate` with pickup and drop coordinates.

* Omit `serviceType` to receive both `scooty` and `cab` quotes
* Use `quotes[].totalAmount` and `quotes[].eta` in your UI

## 2. Create order

Call `POST /ride/create-order` after the rider selects a service type.

### Rider details

Send rider details in the create order request:

```json
"user": {
  "mobile": "9999999999",
  "firstName": "Asha",
  "lastName": "Sharma",
  "gender": "female"
}
```

There is no separate user registration API.

### Webhook URL

Send your webhook URL in the same request:

```json
"webhookURL": "https://your-domain.com/fery/updates"
```

Fery stores this URL on the ride and uses it for:

1. Status updates
2. Partner location updates

Include your own reference in `metadata` if needed. Example:

```json
"metadata": {
  "partnerOrderId": "DMRC-ORDER-1001"
}
```

### Response

* Use `orderId` for cancel, feedback, and correlating webhooks
* Show `otp` to the rider
* If `code` is `USER_HAVE_ACTIVE_RIDE`, use the returned existing `orderId`

## 3. Webhooks

Implement your webhook endpoint as described in [Webhooks](./webhooks).

Respond with HTTP `200` or `201` for each event.

Happy-path status sequence:

`accepted` → `arrived` → `started` → `dropped`

Location events use `status: location_updated` on the same URL.

## 4. Cancel

Call `POST /ride/cancel` with `orderId` when the customer cancels.

Fery also sends webhook status `customer_cancelled`.

## 5. Feedback

Optionally call `POST /ride/feedback` after the ride is completed.