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

# Create ride order

POST https://uat.feryrides.co.in/dmrc/ride/create-order
Content-Type: application/json

Creates a ride for a metro user.

- Rider details are sent in this request. There is no separate user registration API.
- `webhookURL` is required. Fery saves it on the ride and uses the same URL for status and location updates.
- `pickupOtp` is optional. If omitted, Fery generates a 4-digit OTP and returns it.


Reference: https://docs.feryrides.co.in/api-reference/orders/create-order

## Authentication

- `x-api-key` header (required) — API key provided by Fery for DMRC integration.

## Request

### Body (application/json)

This endpoint expects a CreateOrderRequest.

- `user` (CreateOrderUser, required)
- `pickupLocation` (Location, required)
- `dropLocation` (Location, required)
- `webhookURL` (string, required) — HTTPS URL for status and location webhooks. Saved on the ride.
- `serviceType` (enum, optional, default: scooty)
  - Allowed values: `scooty`, `cab`
- `paymentMode` (enum, optional, default: Cash) — Cash only for now. Optional; Fery always stores payment.mode as Cash with status pending until collected.
  - Allowed values: `Cash`
- `pickupOtp` (string, optional) — Optional 4-digit OTP. Generated by Fery if omitted.
- `couponCode` (string, optional, nullable)
- `metadata` (map from string to any, optional) — Your reference data. Echoed on webhooks when present.

## Response

### 200

User already has an active ride

- `statusCode` (integer, optional)
- `success` (boolean, optional)
- `message` (string, optional)
- `data` (ActiveRideResponseData, optional)

### 201

Order created

- `statusCode` (integer, optional)
- `success` (boolean, optional)
- `message` (string, optional)
- `data` (CreateOrderResponseData, optional)

## Errors

### 400 Bad Request Error

Validation or business rule error

- `statusCode` (integer, optional)
- `success` (boolean, optional)
- `message` (string, optional)
- `errors` (map from string to any, optional)

### 401 Unauthorized Error

Missing or invalid API key

- `statusCode` (integer, optional)
- `success` (boolean, optional)
- `message` (string, optional)
- `errors` (map from string to any, optional)

### 500 Internal Server Error

Unexpected server error

- `statusCode` (integer, optional)
- `success` (boolean, optional)
- `message` (string, optional)
- `errors` (map from string to any, optional)

## Types

### CreateOrderUser

- `mobile` (string, required)
- `firstName` (string, required)
- `lastName` (string, required)
- `gender` (string, optional, nullable)

### Location

- `lat` (double, required)
- `lng` (double, required)
- `address` (string, optional, nullable)

### ActiveRideResponseData

- `orderId` (string, optional)
- `requestId` (string, optional)
- `status` (string, optional)
- `code` (string, optional)

### CreateOrderResponseData

- `orderId` (string, optional)
- `requestId` (string, optional)
- `status` (string, optional)
- `otp` (string, optional)
- `price` (double, optional)
- `serviceType` (string, optional)
- `code` (string, optional)

## Examples

### Orders_createOrder_example

**Request**

```json
{
  "user": {
    "mobile": "9999999999",
    "firstName": "Asha",
    "lastName": "Sharma",
    "gender": "female"
  },
  "pickupLocation": {
    "lat": 28.459119,
    "lng": 77.072912,
    "address": "Metro Station Exit A"
  },
  "dropLocation": {
    "lat": 28.475482,
    "lng": 77.088265,
    "address": "Destination"
  },
  "webhookURL": "https://your-domain.com/fery/updates",
  "serviceType": "scooty",
  "paymentMode": "Cash",
  "pickupOtp": "1234",
  "metadata": {
    "partnerOrderId": "DMRC-ORDER-1001"
  }
}
```

**Response**

```json
{
  "statusCode": 200,
  "success": true,
  "message": "You already have an active ride.",
  "data": {
    "orderId": "1717235676225158",
    "requestId": "1717235676225158",
    "status": "partnerConfirmed",
    "code": "USER_HAVE_ACTIVE_RIDE"
  }
}
```

**SDK Code**

```python Orders_createOrder_example
import requests

url = "https://uat.feryrides.co.in/dmrc/ride/create-order"

payload = {
    "user": {
        "mobile": "9999999999",
        "firstName": "Asha",
        "lastName": "Sharma",
        "gender": "female"
    },
    "pickupLocation": {
        "lat": 28.459119,
        "lng": 77.072912,
        "address": "Metro Station Exit A"
    },
    "dropLocation": {
        "lat": 28.475482,
        "lng": 77.088265,
        "address": "Destination"
    },
    "webhookURL": "https://your-domain.com/fery/updates",
    "serviceType": "scooty",
    "paymentMode": "Cash",
    "pickupOtp": "1234",
    "metadata": { "partnerOrderId": "DMRC-ORDER-1001" }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Orders_createOrder_example
const url = 'https://uat.feryrides.co.in/dmrc/ride/create-order';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"user":{"mobile":"9999999999","firstName":"Asha","lastName":"Sharma","gender":"female"},"pickupLocation":{"lat":28.459119,"lng":77.072912,"address":"Metro Station Exit A"},"dropLocation":{"lat":28.475482,"lng":77.088265,"address":"Destination"},"webhookURL":"https://your-domain.com/fery/updates","serviceType":"scooty","paymentMode":"Cash","pickupOtp":"1234","metadata":{"partnerOrderId":"DMRC-ORDER-1001"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Orders_createOrder_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://uat.feryrides.co.in/dmrc/ride/create-order"

	payload := strings.NewReader("{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Orders_createOrder_example
require 'uri'
require 'net/http'

url = URI("https://uat.feryrides.co.in/dmrc/ride/create-order")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Orders_createOrder_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://uat.feryrides.co.in/dmrc/ride/create-order")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}")
  .asString();
```

```php Orders_createOrder_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://uat.feryrides.co.in/dmrc/ride/create-order', [
  'body' => '{
  "user": {
    "mobile": "9999999999",
    "firstName": "Asha",
    "lastName": "Sharma",
    "gender": "female"
  },
  "pickupLocation": {
    "lat": 28.459119,
    "lng": 77.072912,
    "address": "Metro Station Exit A"
  },
  "dropLocation": {
    "lat": 28.475482,
    "lng": 77.088265,
    "address": "Destination"
  },
  "webhookURL": "https://your-domain.com/fery/updates",
  "serviceType": "scooty",
  "paymentMode": "Cash",
  "pickupOtp": "1234",
  "metadata": {
    "partnerOrderId": "DMRC-ORDER-1001"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Orders_createOrder_example
using RestSharp;

var client = new RestClient("https://uat.feryrides.co.in/dmrc/ride/create-order");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Orders_createOrder_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "user": [
    "mobile": "9999999999",
    "firstName": "Asha",
    "lastName": "Sharma",
    "gender": "female"
  ],
  "pickupLocation": [
    "lat": 28.459119,
    "lng": 77.072912,
    "address": "Metro Station Exit A"
  ],
  "dropLocation": [
    "lat": 28.475482,
    "lng": 77.088265,
    "address": "Destination"
  ],
  "webhookURL": "https://your-domain.com/fery/updates",
  "serviceType": "scooty",
  "paymentMode": "Cash",
  "pickupOtp": "1234",
  "metadata": ["partnerOrderId": "DMRC-ORDER-1001"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://uat.feryrides.co.in/dmrc/ride/create-order")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Orders_createOrder_example

**Request**

```json
{
  "user": {
    "mobile": "9999999999",
    "firstName": "Asha",
    "lastName": "Sharma",
    "gender": "female"
  },
  "pickupLocation": {
    "lat": 28.459119,
    "lng": 77.072912,
    "address": "Metro Station Exit A"
  },
  "dropLocation": {
    "lat": 28.475482,
    "lng": 77.088265,
    "address": "Destination"
  },
  "webhookURL": "https://your-domain.com/fery/updates",
  "serviceType": "scooty",
  "paymentMode": "Cash",
  "pickupOtp": "1234",
  "metadata": {
    "partnerOrderId": "DMRC-ORDER-1001"
  }
}
```

**Response**

```json
{
  "statusCode": 201,
  "success": true,
  "message": "Ride order created successfully.",
  "data": {
    "orderId": "1717235676225158",
    "requestId": "1717235676225158",
    "status": "notStarted",
    "code": "RIDE_CREATED",
    "otp": "1234",
    "price": 52,
    "serviceType": "scooty"
  }
}
```

**SDK Code**

```python Orders_createOrder_example
import requests

url = "https://uat.feryrides.co.in/dmrc/ride/create-order"

payload = {
    "user": {
        "mobile": "9999999999",
        "firstName": "Asha",
        "lastName": "Sharma",
        "gender": "female"
    },
    "pickupLocation": {
        "lat": 28.459119,
        "lng": 77.072912,
        "address": "Metro Station Exit A"
    },
    "dropLocation": {
        "lat": 28.475482,
        "lng": 77.088265,
        "address": "Destination"
    },
    "webhookURL": "https://your-domain.com/fery/updates",
    "serviceType": "scooty",
    "paymentMode": "Cash",
    "pickupOtp": "1234",
    "metadata": { "partnerOrderId": "DMRC-ORDER-1001" }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Orders_createOrder_example
const url = 'https://uat.feryrides.co.in/dmrc/ride/create-order';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"user":{"mobile":"9999999999","firstName":"Asha","lastName":"Sharma","gender":"female"},"pickupLocation":{"lat":28.459119,"lng":77.072912,"address":"Metro Station Exit A"},"dropLocation":{"lat":28.475482,"lng":77.088265,"address":"Destination"},"webhookURL":"https://your-domain.com/fery/updates","serviceType":"scooty","paymentMode":"Cash","pickupOtp":"1234","metadata":{"partnerOrderId":"DMRC-ORDER-1001"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Orders_createOrder_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://uat.feryrides.co.in/dmrc/ride/create-order"

	payload := strings.NewReader("{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Orders_createOrder_example
require 'uri'
require 'net/http'

url = URI("https://uat.feryrides.co.in/dmrc/ride/create-order")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Orders_createOrder_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://uat.feryrides.co.in/dmrc/ride/create-order")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}")
  .asString();
```

```php Orders_createOrder_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://uat.feryrides.co.in/dmrc/ride/create-order', [
  'body' => '{
  "user": {
    "mobile": "9999999999",
    "firstName": "Asha",
    "lastName": "Sharma",
    "gender": "female"
  },
  "pickupLocation": {
    "lat": 28.459119,
    "lng": 77.072912,
    "address": "Metro Station Exit A"
  },
  "dropLocation": {
    "lat": 28.475482,
    "lng": 77.088265,
    "address": "Destination"
  },
  "webhookURL": "https://your-domain.com/fery/updates",
  "serviceType": "scooty",
  "paymentMode": "Cash",
  "pickupOtp": "1234",
  "metadata": {
    "partnerOrderId": "DMRC-ORDER-1001"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Orders_createOrder_example
using RestSharp;

var client = new RestClient("https://uat.feryrides.co.in/dmrc/ride/create-order");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"user\": {\n    \"mobile\": \"9999999999\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Sharma\",\n    \"gender\": \"female\"\n  },\n  \"pickupLocation\": {\n    \"lat\": 28.459119,\n    \"lng\": 77.072912,\n    \"address\": \"Metro Station Exit A\"\n  },\n  \"dropLocation\": {\n    \"lat\": 28.475482,\n    \"lng\": 77.088265,\n    \"address\": \"Destination\"\n  },\n  \"webhookURL\": \"https://your-domain.com/fery/updates\",\n  \"serviceType\": \"scooty\",\n  \"paymentMode\": \"Cash\",\n  \"pickupOtp\": \"1234\",\n  \"metadata\": {\n    \"partnerOrderId\": \"DMRC-ORDER-1001\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Orders_createOrder_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "user": [
    "mobile": "9999999999",
    "firstName": "Asha",
    "lastName": "Sharma",
    "gender": "female"
  ],
  "pickupLocation": [
    "lat": 28.459119,
    "lng": 77.072912,
    "address": "Metro Station Exit A"
  ],
  "dropLocation": [
    "lat": 28.475482,
    "lng": 77.088265,
    "address": "Destination"
  ],
  "webhookURL": "https://your-domain.com/fery/updates",
  "serviceType": "scooty",
  "paymentMode": "Cash",
  "pickupOtp": "1234",
  "metadata": ["partnerOrderId": "DMRC-ORDER-1001"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://uat.feryrides.co.in/dmrc/ride/create-order")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```