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

# Cancel a rate lock

POST https://api.crisscross.money/v1/rate-locks/{rateLockId}/cancel

Cancels an active lock before its expiry so it can no longer be used for new checkouts.
The lock moves to `cancelled` with `cancellationReason: requested` and stays readable via
[Get a rate lock](/api-reference/collect/rate-locks/get-rate-lock). Cancellation is
permanent and does not affect any transaction already in progress, which keeps its locked
rate. Idempotent: cancelling a lock that is already `cancelled` or `expired` returns its
current state unchanged.


Reference: https://docs.crisscross.money/api-reference/collect/rate-locks/cancel-rate-lock

## Authentication

- `Authorization` header (bearer token, required) — Token obtained via the login flow.

## Request

### Path parameters

- `rateLockId` (string, required)

## Response

### 200

The cancelled lock, or its current terminal state if it had already ended.

- `rateLockId` (string, required)
- `status` (enum, required) — - `active` — usable. - `expired` — past `expiresAt`. Terminal. - `cancelled` — invalidated before expiry; see `cancellationReason`. Terminal. `expired` and `cancelled` are permanent — a lock never returns to `active`. A lock at or past `expiresAt` is invalid even if `status` still reads `active`.
  - Allowed values: `active`, `expired`, `cancelled`
- `base` (string, required) — Base currency (ISO 4217).
- `quote` (string, required) — Quote currency (ISO 4217).
- `midRate` (string, required) — Reference mid-market rate the lock was priced from. `1 base = <midRate> quote`.
- `markupBps` (integer, required) — The markup applied over the mid, in basis points (100 bps = 1%).
- `allInRate` (string, required) — The rate you transact at: mid plus markup. This is the rate carried onto every transaction that uses the lock. `1 base = <allInRate> quote`.
- `createdAt` (datetime, required)
- `expiresAt` (datetime, required) — End of the lock's validity window. The lock is invalid from this time even if `status` still reads `active`.
- `cancellationReason` (enum, optional) — Why the lock was cancelled. Present only when `status` is `cancelled`. `market_drift` — the rate moved beyond the allowed tolerance. `requested` — you cancelled the lock yourself via the cancel endpoint.
  - Allowed values: `market_drift`, `requested`

## Errors

### 401 Unauthorized Error

Unauthorized — missing or invalid token.

- `message` (string, required) — Human-readable description of what went wrong. For logs and display — do not parse.
- `error` (string, required) — Error category, typically the HTTP reason phrase (e.g. "Bad Request", "Unauthorized", "Not Found", "Unprocessable Entity", "Service Unavailable").
- `statusCode` (integer, required) — HTTP status code, mirroring the response header. The response header is the source of truth.

### 404 Not Found Error

Resource not found.

- `message` (string, required) — Human-readable description of what went wrong. For logs and display — do not parse.
- `error` (string, required) — Error category, typically the HTTP reason phrase (e.g. "Bad Request", "Unauthorized", "Not Found", "Unprocessable Entity", "Service Unavailable").
- `statusCode` (integer, required) — HTTP status code, mirroring the response header. The response header is the source of truth.

## Examples

**Response**

```json
{
  "rateLockId": "rlk_550e8400-e29b-41d4-a716-446655440000",
  "status": "cancelled",
  "base": "USD",
  "quote": "KES",
  "midRate": "130.00",
  "markupBps": 200,
  "allInRate": "132.60",
  "createdAt": "2026-06-24T10:30:00Z",
  "expiresAt": "2026-06-24T22:30:00Z",
  "cancellationReason": "requested"
}
```

**SDK Code**

```python cancelRateLock_example
import requests

url = "https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel"

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

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

print(response.json())
```

```javascript cancelRateLock_example
const url = 'https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel';
const options = {method: 'POST', 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 cancelRateLock_example
package main

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

func main() {

	url := "https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel"

	req, _ := http.NewRequest("POST", 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 cancelRateLock_example
require 'uri'
require 'net/http'

url = URI("https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel")

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

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

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

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

HttpResponse<String> response = Unirest.post("https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp cancelRateLock_example
using RestSharp;

var client = new RestClient("https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift cancelRateLock_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.crisscross.money/v1/rate-locks/rlk_550e8400-e29b-41d4-a716-446655440000/cancel")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```