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

# Prepare token approval

POST https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/{breakdownId}/approval
Content-Type: application/json

Prepare token approval.

**Credential:** Customer session

**Before you call**

- A customer session for the same partner, integration, customer, wallet and chain.
- Use the original `preparationId` and the customer's registered wallet.
- Keep the signed bytes and any known hashes if you need to recover an uncertain submission.
- Set an Idempotency-Key and reuse it for an identical retry.

Prepares the token approval transactions that a SELL needs before escrow creation. Use the owning customer session. Sinbad may reuse an allowance snapshot for up to 30 seconds and invalidates it after a confirmed approval or reset. A snapshot is advisory, because Sinbad always simulates the current chain state before it broadcasts.

The response holds no transactions when the customer needs no approval: on a BUY, or when the allowance is already enough. On a SELL, it returns the exact approval, preceded by an allowance reset when a non-zero allowance is too small.

Run the transactions in order and wait for each to be `CONFIRMED` before the next. You can execute them with the wallet, submit the signed bytes of an ordinary wallet transaction to `POST /v1/transactions`, or broadcast externally and report the hash there. An approval does not create a trade and does not extend the breakdown's deadline.



> Confirm with Sinbad that this endpoint is enabled in your environment.

**Errors**

| Status | Code | What to do |
| --- | --- | --- |
| 400 | `VALIDATION_ERROR` | Correct the fields reported in details before retrying. |
| 401 | `UNAUTHENTICATED` | Create a new customer session or use a valid server credential. |
| 403 | `FORBIDDEN` | Check credential ownership, integration and the supplied Origin. |
| 404 | `NOT_FOUND` | Check the resource ID. A resource that belongs to someone else also returns 404. |
| 409 | `CONFLICT` | Read the current state again before you prepare or retry. |
| 503 | `UPSTREAM_ERROR` | Retry with backoff; preserve the same idempotency key for a repeated mutation. |

Reference: https://docs.getsinbad.com/api-reference/transactions/prepare-token-approval

## Authentication

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

## Request

### Path parameters

- `breakdownId` (string, required)

### Headers

- `Idempotency-Key` (string, required)

## Response

### 200

Separate approval calls in execution order.

- `approvalRequired` (boolean, required)
- `approval` (offers_quotes__ApprovalState, required)
- `transactions` (list of offers_quotes__PreparedTransactionCall, required)

## Errors

### 400 Bad Request Error

The request is invalid.

- `error` (V1TradeBreakdownsBreakdownIdApprovalPostResponsesContentApplicationJsonSchemaError, required)

### 401 Unauthorized Error

Authentication is required.

- `error` (V1TradeBreakdownsBreakdownIdApprovalPostResponsesContentApplicationJsonSchemaError, required)

### 403 Forbidden Error

You do not have permission to perform this action.

- `error` (V1TradeBreakdownsBreakdownIdApprovalPostResponsesContentApplicationJsonSchemaError, required)

### 404 Not Found Error

The requested resource was not found.

- `error` (V1TradeBreakdownsBreakdownIdApprovalPostResponsesContentApplicationJsonSchemaError, required)

### 409 Conflict Error

The request conflicts with the current state of the resource.

- `error` (V1TradeBreakdownsBreakdownIdApprovalPostResponsesContentApplicationJsonSchemaError, required)

### 503 Service Unavailable Error

Service temporarily unavailable.

- `error` (V1TradeBreakdownsBreakdownIdApprovalPostResponsesContentApplicationJsonSchemaError, required)

## Types

### offers_quotes__ApprovalState

- `required` (boolean, required)
- `tokenAddress` (string, required)
- `spender` (string, required)
- `requiredAmount` (string, required) — Required allowance in atomic token units (USDT has 6 decimals).
- `allowance` (string, required) — Observed allowance in atomic token units.

### offers_quotes__PreparedTransactionCall

- `preparationId` (string, required)
- `purpose` (enum, required)
  - Allowed values: `approval`, `approvalReset`, `createEscrow`, `markPaid`, `release`, `cancelPrePaid`, `openDispute`, `mutualResolveDispute`
- `chainId` (integer, required)
- `from` (string, required)
- `to` (string, required)
- `data` (string, required)
- `value` (enum, required)
  - Allowed values: `0`
- `expiresAt` (datetime, required, nullable) — Null for lifecycle actions; checkout calls retain their fixed funding deadline.

### V1TradeBreakdownsBreakdownIdApprovalPostResponsesContentApplicationJsonSchemaError

- `code` (string, required)
- `numericId` (integer, required)
- `message` (string, required)
- `requestId` (string, optional)
- `details` (map from string to any, optional)

## Examples

### Default

**Request**

```json
{}
```

**Response**

```json
{
  "approvalRequired": true,
  "approval": {
    "required": true,
    "tokenAddress": "0x4444444444444444444444444444444444444444",
    "spender": "0x3333333333333333333333333333333333333333",
    "requiredAmount": "100000000",
    "allowance": "0"
  },
  "transactions": [
    {
      "preparationId": "preparation_approval",
      "purpose": "approval",
      "chainId": 80002,
      "from": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a",
      "to": "0x4444444444444444444444444444444444444444",
      "data": "0x095ea7b300000000000000000000000033333333333333333333333333333333333333330000000000000000000000000000000000000000000000000000000005f5e100",
      "value": "0",
      "expiresAt": "2026-10-23T10:05:00.000Z"
    }
  ]
}
```

**SDK Code**

```python Default
import requests

url = "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval"

payload = {}
headers = {
    "Idempotency-Key": "request_demo_001",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Default
const url = 'https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'request_demo_001',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{}'
};

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

```go Default
package main

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

func main() {

	url := "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Idempotency-Key", "request_demo_001")
	req.Header.Add("Authorization", "Bearer <token>")
	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 Default
require 'uri'
require 'net/http'

url = URI("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")

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

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = 'request_demo_001'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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

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

HttpResponse<String> response = Unirest.post("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")
  .header("Idempotency-Key", "request_demo_001")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => 'request_demo_001',
  ],
]);

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

```csharp Default
using RestSharp;

var client = new RestClient("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "request_demo_001");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Default
import Foundation

let headers = [
  "Idempotency-Key": "request_demo_001",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")! 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()
```

### Allowance already sufficient

**Request**

```json
{}
```

**Response**

```json
{
  "approvalRequired": false,
  "approval": {
    "required": false,
    "tokenAddress": "0x4444444444444444444444444444444444444444",
    "spender": "0x3333333333333333333333333333333333333333",
    "requiredAmount": "100000000",
    "allowance": "100000000"
  },
  "transactions": []
}
```

**SDK Code**

```python Allowance already sufficient
import requests

url = "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval"

payload = {}
headers = {
    "Idempotency-Key": "request_demo_001",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Allowance already sufficient
const url = 'https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'request_demo_001',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{}'
};

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

```go Allowance already sufficient
package main

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

func main() {

	url := "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Idempotency-Key", "request_demo_001")
	req.Header.Add("Authorization", "Bearer <token>")
	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 Allowance already sufficient
require 'uri'
require 'net/http'

url = URI("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")

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

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = 'request_demo_001'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java Allowance already sufficient
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")
  .header("Idempotency-Key", "request_demo_001")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => 'request_demo_001',
  ],
]);

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

```csharp Allowance already sufficient
using RestSharp;

var client = new RestClient("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "request_demo_001");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Allowance already sufficient
import Foundation

let headers = [
  "Idempotency-Key": "request_demo_001",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")! 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()
```

### Reset then approve

**Request**

```json
{}
```

**Response**

```json
{
  "approvalRequired": true,
  "approval": {
    "required": true,
    "tokenAddress": "0x4444444444444444444444444444444444444444",
    "spender": "0x3333333333333333333333333333333333333333",
    "requiredAmount": "100000000",
    "allowance": "1"
  },
  "transactions": [
    {
      "preparationId": "preparation_reset",
      "purpose": "approvalReset",
      "chainId": 80002,
      "from": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a",
      "to": "0x4444444444444444444444444444444444444444",
      "data": "0x095ea7b300000000000000000000000033333333333333333333333333333333333333330000000000000000000000000000000000000000000000000000000000000000",
      "value": "0",
      "expiresAt": "2026-10-23T10:05:00.000Z"
    },
    {
      "preparationId": "preparation_approval",
      "purpose": "approval",
      "chainId": 80002,
      "from": "0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a",
      "to": "0x4444444444444444444444444444444444444444",
      "data": "0x095ea7b300000000000000000000000033333333333333333333333333333333333333330000000000000000000000000000000000000000000000000000000005f5e100",
      "value": "0",
      "expiresAt": "2026-10-23T10:05:00.000Z"
    }
  ]
}
```

**SDK Code**

```python Reset then approve
import requests

url = "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval"

payload = {}
headers = {
    "Idempotency-Key": "request_demo_001",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Reset then approve
const url = 'https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'request_demo_001',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{}'
};

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

```go Reset then approve
package main

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

func main() {

	url := "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Idempotency-Key", "request_demo_001")
	req.Header.Add("Authorization", "Bearer <token>")
	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 Reset then approve
require 'uri'
require 'net/http'

url = URI("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")

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

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = 'request_demo_001'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java Reset then approve
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")
  .header("Idempotency-Key", "request_demo_001")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => 'request_demo_001',
  ],
]);

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

```csharp Reset then approve
using RestSharp;

var client = new RestClient("https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "request_demo_001");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Reset then approve
import Foundation

let headers = [
  "Idempotency-Key": "request_demo_001",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://us-central1-sinbad-staging-env.cloudfunctions.net/b2b-v1/v1/trade-breakdowns/breakdown_demo/approval")! 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()
```