Withdraw
Send USDT or Matic back to your whitelisted address
This endpoint allows you to withdraw USDT or Matic from your kamiPay wallet to a previously whitelisted address.
Instructions are simple, just add the chain, token, amount, the address from and address to. If the addresses are not previously mapped to your user, the endpoint will fail with status 400.
Request Body
| Name | Type | Description |
|---|---|---|
| chain | string | Required. Indicates the blockchain network in use. Currently only 'polygon' is supported. |
| token | string | Required. Represents the token to withdraw: 'usdt' or 'matic'. |
| amount | float | Required. Specifies the amount to withdraw, expressed as a float. |
| from_address | string | Required. Represents the sending wallet's address. |
| to_address | string | Required. Represents the receiving wallet's address. Must be previously whitelisted. |
The receiving address must be previously whitelisted for your account. Non-whitelisted addresses will result in a 400 error.
Example Request
const url = `${baseURL}/v1/wallet/withdraw`;
const body = {
"chain": "polygon",
"token": "usdt",
"amount": 0.10,
"from_address": "0x1c0aCxxxxxx488fEdce1ab4",
"to_address": "0x6Fe712cxxxxxx0E72988e68"
};
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${access_token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});import requests
import json
url = f"{base_url}/v1/withdraw"
body = {
"chain": "polygon",
"token": "usdt",
"amount": 0.10,
"from_address": "0x1c0aCxxxxxx488fEdce1ab4",
"to_address": "0x6Fe712cxxxxxx0E72988e68"
}
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json',
}
response = requests.post(url, json=body, headers=headers)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := fmt.Sprintf("%s/v1/wallet/withdraw", baseURL)
// Create request body
requestBody, _ := json.Marshal(map[string]interface{}{
"chain": "polygon",
"token": "usdt",
"amount": 0.10,
"from_address": "0x1c0aCxxxxxx488fEdce1ab4",
"to_address": "0x6Fe712cxxxxxx0E72988e68",
})
// Create request
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", access_token))
req.Header.Add("Content-Type", "application/json")
// Make the request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
}Response
{
"status": "ok",
"msg": "transaction succesful",
"data": {
"status": "mined",
"transactionHash": "0x0c5fabf2a7c76c809b345b6xxxxxd2d414b405033619067c9b425",
"to": "00x6Fe712cxxxxxx0E72988e68",
"usdt amount": 0.1
}
}{
"detail": "detailed error will be provided here"
}{
"detail": "Incorrect Credentials"
}{
"detail": "an unexpected error occurred"
}Withdrawal transactions are processed on the blockchain and may take some time to complete depending on network conditions.
Always double-check the receiving address before initiating a withdrawal, as blockchain transactions cannot be reversed once confirmed.