Limit Orders
Cancel an order
Requests asynchronous cancellation. Unspent input is refunded and successfully filled output is withdrawn.
Errors. Branch on code, never on title or detail. New codes arrive without a major
version, so treat an unrecognized code as the HTTP status alone.
| Status | Codes |
|---|---|
| 400 | order-rejected |
| 401 | authentication-required |
| 404 | order-not-found |
| 429 | rate-limit-exceeded |
| 500 | internal-error |
| 503 | service-unavailable |
POST
/
v0
/
orders
/
{orderId}
/
cancel
Cancel an order
curl --request POST \
--url https://1click.chaindefuser.com/v0/orders/{orderId}/cancel \
--header 'X-API-Key: <api-key>'import requests
url = "https://1click.chaindefuser.com/v0/orders/{orderId}/cancel"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://1click.chaindefuser.com/v0/orders/{orderId}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://1click.chaindefuser.com/v0/orders/{orderId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://1click.chaindefuser.com/v0/orders/{orderId}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://1click.chaindefuser.com/v0/orders/{orderId}/cancel")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://1click.chaindefuser.com/v0/orders/{orderId}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "orders",
"id": "<string>",
"attributes": {
"orderType": "LIMIT",
"depositAddress": "0x2527D...a0f10D",
"depositMode": "SIMPLE",
"depositType": "ORIGIN_CHAIN",
"fillStatus": "AWAITING_DEPOSIT",
"payoutStatus": "NOT_STARTED",
"isPayoutStatusFinal": true,
"payouts": {
"withdrawal": {
"status": "IN_PROGRESS"
},
"allWithdrawals": [
{
"status": "IN_PROGRESS"
}
],
"refund": {
"status": "IN_PROGRESS"
}
},
"depositedAmount": "1000000000",
"depositedAmountFormatted": "1.0",
"baseAsset": "<string>",
"quoteAsset": "<string>",
"quantity": "<string>",
"swapView": {
"swapType": "EXACT_INPUT",
"originAsset": "<string>",
"destinationAsset": "<string>",
"amountIn": "<string>",
"minAmountOut": "<string>"
},
"side": "SELL",
"price": "<string>",
"appFees": [
{
"recipient": "recipient.near",
"fee": 100
}
],
"recipient": "<string>",
"recipientType": "DESTINATION_CHAIN",
"refundTo": "<string>",
"refundType": "ORIGIN_CHAIN",
"estimatedWithdrawFee": "<string>",
"estimatedWithdrawFeeFormatted": "<string>",
"estimatedRefundFee": "<string>",
"estimatedRefundFeeFormatted": "<string>",
"confidentiality": "public",
"timeInForce": "GTC",
"deadline": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"depositMemo": "123456",
"partialFills": [
{
"id": "<string>",
"amountIn": "<string>",
"amountOut": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
},
"links": {
"self": "<string>"
}
},
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}Was this page helpful?
⌘I
Cancel an order
curl --request POST \
--url https://1click.chaindefuser.com/v0/orders/{orderId}/cancel \
--header 'X-API-Key: <api-key>'import requests
url = "https://1click.chaindefuser.com/v0/orders/{orderId}/cancel"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://1click.chaindefuser.com/v0/orders/{orderId}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://1click.chaindefuser.com/v0/orders/{orderId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://1click.chaindefuser.com/v0/orders/{orderId}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://1click.chaindefuser.com/v0/orders/{orderId}/cancel")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://1click.chaindefuser.com/v0/orders/{orderId}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "orders",
"id": "<string>",
"attributes": {
"orderType": "LIMIT",
"depositAddress": "0x2527D...a0f10D",
"depositMode": "SIMPLE",
"depositType": "ORIGIN_CHAIN",
"fillStatus": "AWAITING_DEPOSIT",
"payoutStatus": "NOT_STARTED",
"isPayoutStatusFinal": true,
"payouts": {
"withdrawal": {
"status": "IN_PROGRESS"
},
"allWithdrawals": [
{
"status": "IN_PROGRESS"
}
],
"refund": {
"status": "IN_PROGRESS"
}
},
"depositedAmount": "1000000000",
"depositedAmountFormatted": "1.0",
"baseAsset": "<string>",
"quoteAsset": "<string>",
"quantity": "<string>",
"swapView": {
"swapType": "EXACT_INPUT",
"originAsset": "<string>",
"destinationAsset": "<string>",
"amountIn": "<string>",
"minAmountOut": "<string>"
},
"side": "SELL",
"price": "<string>",
"appFees": [
{
"recipient": "recipient.near",
"fee": 100
}
],
"recipient": "<string>",
"recipientType": "DESTINATION_CHAIN",
"refundTo": "<string>",
"refundType": "ORIGIN_CHAIN",
"estimatedWithdrawFee": "<string>",
"estimatedWithdrawFeeFormatted": "<string>",
"estimatedRefundFee": "<string>",
"estimatedRefundFeeFormatted": "<string>",
"confidentiality": "public",
"timeInForce": "GTC",
"deadline": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"depositMemo": "123456",
"partialFills": [
{
"id": "<string>",
"amountIn": "<string>",
"amountOut": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
},
"links": {
"self": "<string>"
}
},
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}{
"errors": [
{
"status": "400",
"code": "validation-failed",
"title": "Validation failed",
"detail": "Must be a positive decimal string.",
"source": {
"pointer": "/data/attributes/price"
}
}
],
"meta": {
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2019-08-24T14:15:22Z"
}
}