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

# Create a customer withdrawal

POST https://api.cheddar.biz/v1/withdraw
Content-Type: application/json

Sends funds from a customer balance to an address. `amount` is in base units unless `useDecimal` is true. A withdrawal needing approval emits a CUSTOMER_WITHDRAW_AWAITING_APPROVAL webhook; on broadcast, CUSTOMER_WITHDRAW.

Pass `idempotencyKey` (your own reference) to make retries safe: the same key with the same customer, mint, amount and address returns the original withdrawal (with its current `status`) even if it was later rejected or failed, so use a new key to try again; with anything different it is 409. The key is echoed on every withdrawal webhook. A 451 risk rejection does not reserve the key.

Reference: https://doc.cheddar.biz/api/api-reference/payments/create-a-customer-withdrawal

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.cheddar.biz/v1` (Production, default)
- `https://staging-api-aws.cheddar.biz/v1` (Staging)

## Request

### Body (application/json)

This endpoint expects an object.

- `mintId` (double, required)
- `customerId` (string, required)
- `amount` (string, required)
- `toAddress` (string, required)
- `useDecimal` (boolean, optional)
- `requireApproval` (boolean, optional) — When true, the withdraw is held for manual approval unless the customer's organizationExternalEmail matches an active entry on the merchant's withdrawal approval email allowlist (dashboard Organization security). An active allowlist entry also skips the customer USD withdraw-threshold approval hold. Destination-address whitelist, low-liquidity, and risk screening are not bypassed.
- `idempotencyKey` (string, optional) — Your own reference for this withdrawal (1-255 chars). Makes retries safe, and is returned as `idempotencyKey` on every withdrawal webhook.

## Response

### 200

Withdrawal created, or the existing one for this idempotencyKey

- `withdrawalId` (string, required)
- `customerId` (string, required)
- `mintId` (integer, required)
- `amount` (string, required)
- `toAddress` (string, required)
- `status` (enum, required) — Current status. On an idempotent replay this is the original withdrawal's status now (e.g. `REJECTED` / `FAILED`: nothing will be sent; use a new key).
  - Allowed values: `PENDING`, `CONFIRMED`, `FAILED`, `REJECTED`, `AWAITING_CONFIRMATION`, `FLAGGED`, `PREFUNDING`
- `idempotencyKey` (string, required, nullable) — The idempotencyKey you sent, or null.

## Errors

### 400 Bad Request Error

Bad request

- `error` (string, required)

### 401 Unauthorized Error

Unauthorized — missing or invalid API key

- `error` (string, required)

### 403 Forbidden Error

Forbidden — the request IP address is not whitelisted

- `error` (string, required)

### 409 Conflict Error

idempotencyKey already used for a different withdrawal

- `error` (string, required)

### 451 Unavailable for Legal Reasons Error

Blocked — destination flagged by risk screening

- `error` (string, required)
- `withdrawalId` (string, required) — The rejected withdrawal, recorded with status REJECTED.
- `entityType` (string, optional, nullable)
- `entityName` (string, optional, nullable)
- `idempotencyKey` (string, optional, nullable)

## Examples

**Request**

```json
{
  "mintId": 1.1,
  "customerId": "string",
  "amount": "string",
  "toAddress": "string"
}
```

**Response**

```json
{
  "withdrawalId": "string",
  "customerId": "string",
  "mintId": 1,
  "amount": "string",
  "toAddress": "string",
  "status": "PENDING",
  "idempotencyKey": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.cheddar.biz/v1/withdraw"

payload = {
    "mintId": 1.1,
    "customerId": "string",
    "amount": "string",
    "toAddress": "string"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.cheddar.biz/v1/withdraw';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"mintId":1.1,"customerId":"string","amount":"string","toAddress":"string"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cheddar.biz/v1/withdraw"

	payload := strings.NewReader("{\n  \"mintId\": 1.1,\n  \"customerId\": \"string\",\n  \"amount\": \"string\",\n  \"toAddress\": \"string\"\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
require 'uri'
require 'net/http'

url = URI("https://api.cheddar.biz/v1/withdraw")

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  \"mintId\": 1.1,\n  \"customerId\": \"string\",\n  \"amount\": \"string\",\n  \"toAddress\": \"string\"\n}"

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.post("https://api.cheddar.biz/v1/withdraw")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"mintId\": 1.1,\n  \"customerId\": \"string\",\n  \"amount\": \"string\",\n  \"toAddress\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cheddar.biz/v1/withdraw', [
  'body' => '{
  "mintId": 1.1,
  "customerId": "string",
  "amount": "string",
  "toAddress": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.cheddar.biz/v1/withdraw");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"mintId\": 1.1,\n  \"customerId\": \"string\",\n  \"amount\": \"string\",\n  \"toAddress\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "mintId": 1.1,
  "customerId": "string",
  "amount": "string",
  "toAddress": "string"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cheddar.biz/v1/withdraw")! 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()
```