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

# Cancel Trip

POST https://heimdall.eka.io/apis/external/trips/cancel
Content-Type: application/json

### Cancel Trip

Cancels a trip. A trip that is already cancelled, or that has active bookings / claims attached, cannot be cancelled; cancel those bookings first. `remarks` is stored as the cancellation reason.

### Request Parameters

| Param | Required | Description |
| --- | --- | --- |
| tripId | Mandatory | Trip reference to cancel (as returned by Create Trip). |
| employeeCode | Conditional | Employee code of the trip owner. One of `employeeCode` or `employeeEmail` is mandatory; the code wins if both are sent. |
| employeeEmail | Conditional | Email of the trip owner. Used when `employeeCode` is not sent. |
| remarks | Optional | Reason for cancellation. Stored on the trip. |

Reference: https://open-api-docs.dice.tech/dice-standardized-ap-is-v-2-copy/trip/cancel-trip

## Servers

- `https://heimdall.eka.io` (https://heimdall.eka.io, default)
- `https://heimdall.eka.ioapis` (https://heimdall.eka.ioapis)

## Request

### Headers

- `DICE-APP-ID` (string, optional) — Company Code of client
- `X-CLIENT-ID` (string, optional) — API Client ID
- `X-CLIENT-SECRET` (string, optional) — API Client Secret

### Body (application/json)

This endpoint expects an object.

- `tripId` (string, required) — Trip reference to cancel (as returned by Create Trip).
- `employeeCode` (string, optional) — Employee code of the trip owner. **One of `employeeCode` / `employeeEmail` is mandatory**; the code wins if both are sent.
- `employeeEmail` (string, optional) — Email of the trip owner. Used when `employeeCode` is not sent.
- `remarks` (string, optional) — Reason for cancellation. Stored on the trip.

## Response

### 200

OK

- `success` (boolean, required) — `true` when the operation succeeded.
- `data` (ApisExternalTripsCancelPostResponsesContentApplicationJsonSchemaData, optional) — Reserved (internal envelope). Ignore.
- `safe` (boolean, optional) — Reserved. Ignore.

## Types

### ApisExternalTripsCancelPostResponsesContentApplicationJsonSchemaData

Reserved (internal envelope). Ignore.

## Examples

### Mandatory fields only

**Request**

```json
{
  "tripId": "EXT-TRIP-1001",
  "employeeEmail": "rahul.sharma@acme.com"
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "map": {}
  },
  "safe": false
}
```

**SDK Code**

```python Mandatory fields only
import requests

url = "https://heimdall.eka.io/apis/external/trips/cancel"

payload = {
    "tripId": "EXT-TRIP-1001",
    "employeeEmail": "rahul.sharma@acme.com"
}
headers = {
    "DICE-APP-ID": "{{Company Code}}",
    "X-CLIENT-ID": "{{API Client ID}}",
    "X-CLIENT-SECRET": "{{API Client Secret}}",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Mandatory fields only
const url = 'https://heimdall.eka.io/apis/external/trips/cancel';
const options = {
  method: 'POST',
  headers: {
    'DICE-APP-ID': '{{Company Code}}',
    'X-CLIENT-ID': '{{API Client ID}}',
    'X-CLIENT-SECRET': '{{API Client Secret}}',
    'Content-Type': 'application/json'
  },
  body: '{"tripId":"EXT-TRIP-1001","employeeEmail":"rahul.sharma@acme.com"}'
};

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

```go Mandatory fields only
package main

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

func main() {

	url := "https://heimdall.eka.io/apis/external/trips/cancel"

	payload := strings.NewReader("{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\"\n}")

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

	req.Header.Add("DICE-APP-ID", "{{Company Code}}")
	req.Header.Add("X-CLIENT-ID", "{{API Client ID}}")
	req.Header.Add("X-CLIENT-SECRET", "{{API Client Secret}}")
	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 Mandatory fields only
require 'uri'
require 'net/http'

url = URI("https://heimdall.eka.io/apis/external/trips/cancel")

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

request = Net::HTTP::Post.new(url)
request["DICE-APP-ID"] = '{{Company Code}}'
request["X-CLIENT-ID"] = '{{API Client ID}}'
request["X-CLIENT-SECRET"] = '{{API Client Secret}}'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\"\n}"

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

```java Mandatory fields only
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://heimdall.eka.io/apis/external/trips/cancel")
  .header("DICE-APP-ID", "{{Company Code}}")
  .header("X-CLIENT-ID", "{{API Client ID}}")
  .header("X-CLIENT-SECRET", "{{API Client Secret}}")
  .header("Content-Type", "application/json")
  .body("{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\"\n}")
  .asString();
```

```php Mandatory fields only
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://heimdall.eka.io/apis/external/trips/cancel', [
  'body' => '{
  "tripId": "EXT-TRIP-1001",
  "employeeEmail": "rahul.sharma@acme.com"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'DICE-APP-ID' => '{{Company Code}}',
    'X-CLIENT-ID' => '{{API Client ID}}',
    'X-CLIENT-SECRET' => '{{API Client Secret}}',
  ],
]);

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

```csharp Mandatory fields only
using RestSharp;

var client = new RestClient("https://heimdall.eka.io/apis/external/trips/cancel");
var request = new RestRequest(Method.POST);
request.AddHeader("DICE-APP-ID", "{{Company Code}}");
request.AddHeader("X-CLIENT-ID", "{{API Client ID}}");
request.AddHeader("X-CLIENT-SECRET", "{{API Client Secret}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Mandatory fields only
import Foundation

let headers = [
  "DICE-APP-ID": "{{Company Code}}",
  "X-CLIENT-ID": "{{API Client ID}}",
  "X-CLIENT-SECRET": "{{API Client Secret}}",
  "Content-Type": "application/json"
]
let parameters = [
  "tripId": "EXT-TRIP-1001",
  "employeeEmail": "rahul.sharma@acme.com"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://heimdall.eka.io/apis/external/trips/cancel")! 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()
```

### All fields

**Request**

```json
{
  "tripId": "EXT-TRIP-1001",
  "employeeCode": "EMP001",
  "employeeEmail": "rahul.sharma@acme.com",
  "remarks": "Client meeting postponed"
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "map": {}
  },
  "safe": false
}
```

**SDK Code**

```python All fields
import requests

url = "https://heimdall.eka.io/apis/external/trips/cancel"

payload = {
    "tripId": "EXT-TRIP-1001",
    "employeeCode": "EMP001",
    "employeeEmail": "rahul.sharma@acme.com",
    "remarks": "Client meeting postponed"
}
headers = {
    "DICE-APP-ID": "{{Company Code}}",
    "X-CLIENT-ID": "{{API Client ID}}",
    "X-CLIENT-SECRET": "{{API Client Secret}}",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript All fields
const url = 'https://heimdall.eka.io/apis/external/trips/cancel';
const options = {
  method: 'POST',
  headers: {
    'DICE-APP-ID': '{{Company Code}}',
    'X-CLIENT-ID': '{{API Client ID}}',
    'X-CLIENT-SECRET': '{{API Client Secret}}',
    'Content-Type': 'application/json'
  },
  body: '{"tripId":"EXT-TRIP-1001","employeeCode":"EMP001","employeeEmail":"rahul.sharma@acme.com","remarks":"Client meeting postponed"}'
};

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

```go All fields
package main

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

func main() {

	url := "https://heimdall.eka.io/apis/external/trips/cancel"

	payload := strings.NewReader("{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeCode\": \"EMP001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\",\n  \"remarks\": \"Client meeting postponed\"\n}")

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

	req.Header.Add("DICE-APP-ID", "{{Company Code}}")
	req.Header.Add("X-CLIENT-ID", "{{API Client ID}}")
	req.Header.Add("X-CLIENT-SECRET", "{{API Client Secret}}")
	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 All fields
require 'uri'
require 'net/http'

url = URI("https://heimdall.eka.io/apis/external/trips/cancel")

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

request = Net::HTTP::Post.new(url)
request["DICE-APP-ID"] = '{{Company Code}}'
request["X-CLIENT-ID"] = '{{API Client ID}}'
request["X-CLIENT-SECRET"] = '{{API Client Secret}}'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeCode\": \"EMP001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\",\n  \"remarks\": \"Client meeting postponed\"\n}"

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

```java All fields
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://heimdall.eka.io/apis/external/trips/cancel")
  .header("DICE-APP-ID", "{{Company Code}}")
  .header("X-CLIENT-ID", "{{API Client ID}}")
  .header("X-CLIENT-SECRET", "{{API Client Secret}}")
  .header("Content-Type", "application/json")
  .body("{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeCode\": \"EMP001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\",\n  \"remarks\": \"Client meeting postponed\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://heimdall.eka.io/apis/external/trips/cancel', [
  'body' => '{
  "tripId": "EXT-TRIP-1001",
  "employeeCode": "EMP001",
  "employeeEmail": "rahul.sharma@acme.com",
  "remarks": "Client meeting postponed"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'DICE-APP-ID' => '{{Company Code}}',
    'X-CLIENT-ID' => '{{API Client ID}}',
    'X-CLIENT-SECRET' => '{{API Client Secret}}',
  ],
]);

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

```csharp All fields
using RestSharp;

var client = new RestClient("https://heimdall.eka.io/apis/external/trips/cancel");
var request = new RestRequest(Method.POST);
request.AddHeader("DICE-APP-ID", "{{Company Code}}");
request.AddHeader("X-CLIENT-ID", "{{API Client ID}}");
request.AddHeader("X-CLIENT-SECRET", "{{API Client Secret}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"tripId\": \"EXT-TRIP-1001\",\n  \"employeeCode\": \"EMP001\",\n  \"employeeEmail\": \"rahul.sharma@acme.com\",\n  \"remarks\": \"Client meeting postponed\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift All fields
import Foundation

let headers = [
  "DICE-APP-ID": "{{Company Code}}",
  "X-CLIENT-ID": "{{API Client ID}}",
  "X-CLIENT-SECRET": "{{API Client Secret}}",
  "Content-Type": "application/json"
]
let parameters = [
  "tripId": "EXT-TRIP-1001",
  "employeeCode": "EMP001",
  "employeeEmail": "rahul.sharma@acme.com",
  "remarks": "Client meeting postponed"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://heimdall.eka.io/apis/external/trips/cancel")! 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()
```