Skip to main content
POST
/
rpc
/
Trails
/
AbortIntent
cURL
curl --request POST \
  --url https://trails-api.sequence.app/rpc/Trails/AbortIntent \
  --header 'Content-Type: application/json' \
  --data '
{
  "intentId": "<string>",
  "chainId": 123,
  "abortTransactionHash": "<string>"
}
'
import requests

url = "https://trails-api.sequence.app/rpc/Trails/AbortIntent"

payload = {
"intentId": "<string>",
"chainId": 123,
"abortTransactionHash": "<string>"
}
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({intentId: '<string>', chainId: 123, abortTransactionHash: '<string>'})
};

fetch('https://trails-api.sequence.app/rpc/Trails/AbortIntent', 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://trails-api.sequence.app/rpc/Trails/AbortIntent",
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([
'intentId' => '<string>',
'chainId' => 123,
'abortTransactionHash' => '<string>'
]),
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://trails-api.sequence.app/rpc/Trails/AbortIntent"

payload := strings.NewReader("{\n \"intentId\": \"<string>\",\n \"chainId\": 123,\n \"abortTransactionHash\": \"<string>\"\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://trails-api.sequence.app/rpc/Trails/AbortIntent")
.header("Content-Type", "application/json")
.body("{\n \"intentId\": \"<string>\",\n \"chainId\": 123,\n \"abortTransactionHash\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://trails-api.sequence.app/rpc/Trails/AbortIntent")

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 \"intentId\": \"<string>\",\n \"chainId\": 123,\n \"abortTransactionHash\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "intentId": "<string>"
}
{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}
{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}

Overview

The AbortIntent endpoint cancels an in-flight intent after you have submitted the abort transaction on-chain. Once the abort transaction is confirmed, call this endpoint to notify Trails so the intent status is updated to ABORTED and any recoverable funds are tracked.

Use Cases

  • Cancel a pending intent that has not yet been processed
  • Recover stuck or expired intents
  • Clean up failed cross-chain transactions

Request Parameters

Required Fields

  • intentId (string): The unique ID of the intent to abort
  • chainId (number): The chain ID where the abort transaction was submitted
  • abortTransactionHash (string): The transaction hash of the on-chain abort transaction

Response

  • intentId (string): The ID of the aborted intent
  • status (IntentStatus): Updated status of the intent (typically ABORTED)

Examples

Abort a Pending Intent

const response = await fetch('https://trails-api.sequence.app/rpc/Trails/AbortIntent', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Access-Key': 'YOUR_ACCESS_KEY'
  },
  body: JSON.stringify({
    intentId: 'intent_abc123',
    chainId: 1,
    abortTransactionHash: '0xabc123...'
  })
});

const { intentId, status } = await response.json();
console.log(`Intent ${intentId} is now ${status}`);

With the Trails SDK

import { TrailsClient } from '0xtrails'

const trails = new TrailsClient({ accessKey: 'YOUR_ACCESS_KEY' })

const result = await trails.abortIntent({
  intentId: 'intent_abc123',
  chainId: 1,
  abortTransactionHash: '0xabc123...'
})

console.log('Abort result:', result.status)
You must submit the abort transaction on-chain first and wait for it to be confirmed before calling this endpoint. The abortTransactionHash must correspond to a valid on-chain transaction.

Next Steps

GetIntentHistory

Query intent history including aborted intents

GetIntent

Check current intent status

Body

application/json
intentId
string
required
chainId
number
required
abortTransactionHash
string
required

Response

OK

intentId
string
required
status
enum<string>
required

Represented as uint8 on the server side

Available options:
QUOTED,
COMMITTED,
EXECUTING,
FAILED,
SUCCEEDED,
ABORTED,
REFUNDED,
INVALID