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

# Test Cancellation Endpoint

GET https://api.etera.dev/account/bookings/cancel/test


Test endpoint to verify cancellation functionality with mock data.

This endpoint returns mock cancellation responses to help developers understand the expected response format and test the cancellation flow without making actual API calls.

## Use Cases
- **Development Testing**: Verify cancellation response structure
- **Integration Testing**: Test client-side cancellation handling
- **Documentation**: Understand expected response format
- **API Validation**: Ensure cancellation logic works correctly

## Mock Data
Returns realistic mock responses for all three booking types (Restaurant, Experience, Hotel) with sample cancellation details, refund information, and timestamps.

## Response Format
The mock response follows the same structure as the actual cancellation endpoint, including:
- Success status and message
- Booking and cancellation IDs
- Refund amount and status
- Cancellation timestamp
- Additional booking details
        

Reference: https://docs.etera.dev/platform/account/account-api/test/cancellation-endpoint

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.etera.dev/account` (Production, default)
- `https://api-stage.etera.dev/account` (Staging)
- `https://api-dev.etera.dev/account` (Development)

## Response

### 200

Mock cancellation data returned successfully

- `success` (boolean, optional)
- `message` (string, optional)
- `mockResponse` (BookingsCancelTestGetResponsesContentApplicationJsonSchemaMockResponse, optional) — Sample cancellation response
- `endpoint` (string, optional)
- `requiredBody` (BookingsCancelTestGetResponsesContentApplicationJsonSchemaRequiredBody, optional)
- `exampleRequest` (BookingsCancelTestGetResponsesContentApplicationJsonSchemaExampleRequest, optional)
- `timestamp` (datetime, optional)

## Errors

### 500 Internal Server Error

Internal Server Error

- `success` (boolean, optional)
- `error` (string, optional)
- `timestamp` (datetime, optional)

## Types

### BookingsCancelTestGetResponsesContentApplicationJsonSchemaMockResponse

Sample cancellation response

- `success` (boolean, optional)
- `message` (string, optional)
- `bookingId` (string, optional)
- `dataType` (enum, optional)
  - Allowed values: `RESTAURANT`, `EXPERIENCE`, `HOTEL`
- `cancellationId` (string, optional)
- `refundAmount` (double, optional)
- `refundStatus` (string, optional)
- `cancelledAt` (datetime, optional)
- `data` (BookingsCancelTestGetResponsesContentApplicationJsonSchemaMockResponseData, optional)

### BookingsCancelTestGetResponsesContentApplicationJsonSchemaRequiredBody

- `dataType` (string, optional)
- `reason` (string, optional)

### BookingsCancelTestGetResponsesContentApplicationJsonSchemaExampleRequest

- `url` (string, optional)
- `headers` (BookingsCancelTestGetResponsesContentApplicationJsonSchemaExampleRequestHeaders, optional)
- `body` (BookingsCancelTestGetResponsesContentApplicationJsonSchemaExampleRequestBody, optional)

### BookingsCancelTestGetResponsesContentApplicationJsonSchemaMockResponseData

### BookingsCancelTestGetResponsesContentApplicationJsonSchemaExampleRequestHeaders

### BookingsCancelTestGetResponsesContentApplicationJsonSchemaExampleRequestBody

## Examples

**Response**

```json
{
  "success": true,
  "message": "Cancellation endpoint is working",
  "mockResponse": {
    "success": true,
    "message": "string",
    "bookingId": "string",
    "dataType": "RESTAURANT",
    "cancellationId": "string",
    "refundAmount": 1.1,
    "refundStatus": "string",
    "cancelledAt": "2024-01-15T09:30:00Z",
    "data": {}
  },
  "endpoint": "POST /bookings/{bookingId}/cancel",
  "requiredBody": {
    "dataType": "string",
    "reason": "string"
  },
  "exampleRequest": {
    "url": "string",
    "headers": {},
    "body": {}
  },
  "timestamp": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.etera.dev/account/bookings/cancel/test"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.etera.dev/account/bookings/cancel/test';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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

```go
package main

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

func main() {

	url := "https://api.etera.dev/account/bookings/cancel/test"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://api.etera.dev/account/bookings/cancel/test")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.get("https://api.etera.dev/account/bookings/cancel/test")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.etera.dev/account/bookings/cancel/test', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.etera.dev/account/bookings/cancel/test");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.etera.dev/account/bookings/cancel/test")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```