Withdraw
Endpoint
POST /withdraw
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
currency_name | string | Yes | Name of the currency to withdraw (e.g., BTC ). |
amount | string | Yes | Amount of the currency to withdraw. |
Headers
Header | Type | Required | Description |
---|---|---|---|
session-token | string | Yes | Authorization token. |
api-key | string | Yes | API key for user authentication. |
Note: You must provide either session-token
or api-key
in the headers for authentication.
Response
HTTP Status Code
- 200 OK: Withdrawal successfully.
- 4XX: Client error.
- 5XX: Server error.
Example Usage
- cURL
- ReactJS
- React Native
- Node.js
- Java
- C#
- Python
- Go
- Rust
curl --location 'https://spot-markets.goonus.io/withdraw' \
--header 'session-token: xxx' \
--data '{
"currency_name": "VNDC",
"amount": "1"
}'
import React from 'react';
function Withdraw() {
const handleWithdraw = async () => {
const response = await fetch('https://spot-markets.goonus.io/withdraw', {
method: 'POST',
headers: {
'session-token': 'xxx',
},
body: JSON.stringify({
currency_name: 'VNDC',
amount: '1',
}),
});
if (response.ok) {
console.log('Withdrawal successful');
} else {
console.error('Error:', await response.text());
}
};
return <button onClick={handleWithdraw}>Withdraw</button>;
}
export default Withdraw;
import React, { useEffect } from 'react';
import { Button, View, Alert } from 'react-native';
const Withdraw = () => {
const handleWithdraw = async () => {
try {
const response = await fetch('https://spot-markets.goonus.io/withdraw', {
method: 'POST',
headers: {
'session-token': 'xxx',
},
body: JSON.stringify({
currency_name: 'VNDC',
amount: '1',
}),
});
if (response.ok) {
Alert.alert('Success', 'Withdrawal successful');
} else {
Alert.alert('Error', await response.text());
}
} catch (error) {
Alert.alert('Error', error.message);
}
};
return (
<View>
<Button title="Withdraw" onPress={handleWithdraw} />
</View>
);
};
export default Withdraw;
const axios = require('axios');
axios.post('https://spot-markets.goonus.io/withdraw', {
currency_name: 'VNDC',
amount: '1',
}, {
headers: {
'session-token': 'xxx',
},
})
.then(response => console.log('Withdrawal successful'))
.catch(error => console.error('Error:', error.response.data));
import java.net.http.*;
import java.net.URI;
public class Withdraw {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://spot-markets.goonus.io/withdraw"))
.header("session-token", "xxx")
.POST(HttpRequest.BodyPublishers.ofString(
"{\"currency_name\":\"VNDC\",\"amount\":\"1\"}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println("Withdrawal successful");
} else {
System.err.println("Error: " + response.body());
}
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program {
static async Task Main(string[] args) {
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("session-token", "xxx");
var content = new StringContent(
"{\"currency_name\":\"VNDC\",\"amount\":\"1\"}",
Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://spot-markets.goonus.io/withdraw", content);
if (response.IsSuccessStatusCode) {
Console.WriteLine("Withdrawal successful");
} else {
Console.WriteLine("Error: " + await response.Content.ReadAsStringAsync());
}
}
}
import requests
url = "https://spot-markets.goonus.io/withdraw"
headers = {
"session-token": "xxx"
}
data = {
"currency_name": "VNDC",
"amount": "1"
}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 200:
print("Withdrawal successful")
else:
print("Error:", response.text)
package main
import (
"bytes"
"fmt"
"net/http"
)
func main() {
url := "https://spot-markets.goonus.io/withdraw"
jsonBody := []byte(`{"currency_name":"VNDC","amount":"1"}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonBody))
req.Header.Set("session-token", "xxx")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
fmt.Println("Withdrawal successful")
} else {
fmt.Println("Error:", resp.Status)
}
}
use reqwest;
use tokio;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://spot-markets.goonus.io/withdraw")
.header("session-token", "xxx")
.body(r#"{"currency_name":"VNDC","amount":"1"}"#)
.send()
.await?;
if response.status().is_success() {
println!("Withdrawal successful");
} else {
println!("Error: {}", response.text().await?);
}
Ok(())
}