Skip to main content
POST
/
v1
/
chains
/
{chain_name}
/
orders
/
cancel
Cancel one or more orders
curl --request POST \
  --url https://api.sandbox.immutable.com/v1/chains/{chain_name}/orders/cancel \
  --header 'Content-Type: application/json' \
  --data '
{
  "account_address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
  "ids": [
    "018a8c71-d7e4-e303-a2ef-318871ef7756",
    "238a8c71-d7e4-e303-a2ef-318871ef7778",
    "458a8c71-d7e4-e303-a2ef-318871ef7790"
  ],
  "signature": 291
}
'
import requests

url = "https://api.sandbox.immutable.com/v1/chains/{chain_name}/orders/cancel"

payload = {
"account_address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"ids": ["018a8c71-d7e4-e303-a2ef-318871ef7756", "238a8c71-d7e4-e303-a2ef-318871ef7778", "458a8c71-d7e4-e303-a2ef-318871ef7790"],
"signature": 291
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
account_address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
ids: [
'018a8c71-d7e4-e303-a2ef-318871ef7756',
'238a8c71-d7e4-e303-a2ef-318871ef7778',
'458a8c71-d7e4-e303-a2ef-318871ef7790'
],
signature: 291
})
};

fetch('https://api.sandbox.immutable.com/v1/chains/{chain_name}/orders/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://api.sandbox.immutable.com/v1/chains/{chain_name}/orders/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account_address' => '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
'ids' => [
'018a8c71-d7e4-e303-a2ef-318871ef7756',
'238a8c71-d7e4-e303-a2ef-318871ef7778',
'458a8c71-d7e4-e303-a2ef-318871ef7790'
],
'signature' => 291
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.sandbox.immutable.com/v1/chains/{chain_name}/orders/cancel"

payload := strings.NewReader("{\n \"account_address\": \"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\",\n \"ids\": [\n \"018a8c71-d7e4-e303-a2ef-318871ef7756\",\n \"238a8c71-d7e4-e303-a2ef-318871ef7778\",\n \"458a8c71-d7e4-e303-a2ef-318871ef7790\"\n ],\n \"signature\": 291\n}")

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

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sandbox.immutable.com/v1/chains/{chain_name}/orders/cancel")
.header("Content-Type", "application/json")
.body("{\n \"account_address\": \"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\",\n \"ids\": [\n \"018a8c71-d7e4-e303-a2ef-318871ef7756\",\n \"238a8c71-d7e4-e303-a2ef-318871ef7778\",\n \"458a8c71-d7e4-e303-a2ef-318871ef7790\"\n ],\n \"signature\": 291\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.immutable.com/v1/chains/{chain_name}/orders/cancel")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_address\": \"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\",\n \"ids\": [\n \"018a8c71-d7e4-e303-a2ef-318871ef7756\",\n \"238a8c71-d7e4-e303-a2ef-318871ef7778\",\n \"458a8c71-d7e4-e303-a2ef-318871ef7790\"\n ],\n \"signature\": 291\n}"

response = http.request(request)
puts response.read_body
{
  "result": {
    "successful_cancellations": [
      "018a8c71-d7e4-e303-a2ef-318871ef7756",
      "458a8c71-d7e4-e303-a2ef-318871ef7778"
    ],
    "pending_cancellations": [
      "238a8c71-d7e4-e303-a2ef-318871ef7778",
      "898a8c71-d7e4-e303-a2ef-318871ef7735"
    ],
    "failed_cancellations": [
      {
        "order": "458a8c71-d7e4-e303-a2ef-318871ef7790",
        "reason_code": "FILLED"
      },
      {
        "order": "338a8c71-d7e4-e303-a2ef-318871ef7342",
        "reason_code": "FILLED"
      }
    ]
  }
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "VALIDATION_ERROR",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "UNAUTHORISED_REQUEST",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "RESOURCE_NOT_FOUND",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "TOO_MANY_REQUESTS_ERROR",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "INTERNAL_SERVER_ERROR",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "NOT_IMPLEMENTED_ERROR",
"details": {}
}

Path Parameters

chain_name
string
required

The name of chain

Example:

"imtbl-zkevm-testnet"

Body

application/json
account_address
string
required

Address of the user initiating the cancel request

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"

orders
string<uuid>[]
required

List of order ids proposed for cancellation

Required array length: 1 - 20 elements
signature
string
required

Signature generated by the user for the specific cancellation request

Example:

"0x12345"

Response

Orders cancellation response.

result
object
required