Skip to main content
POST
/
v1
/
transfers
/
{id}
/
cancel
Cancel a non-terminal transfer
curl --request POST \
  --url https://sta.sandbox.lerian.net/v1/transfers/{id}/cancel \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "reason": "<string>"
}
'
import requests

url = "https://sta.sandbox.lerian.net/v1/transfers/{id}/cancel"

payload = { "reason": "<string>" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};

fetch('https://sta.sandbox.lerian.net/v1/transfers/{id}/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://sta.sandbox.lerian.net/v1/transfers/{id}/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([
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://sta.sandbox.lerian.net/v1/transfers/{id}/cancel"

payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")

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

req.Header.Add("Authorization", "<api-key>")
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://sta.sandbox.lerian.net/v1/transfers/{id}/cancel")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://sta.sandbox.lerian.net/v1/transfers/{id}/cancel")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "bytesDownloaded": 123,
  "bytesUploaded": 123,
  "createdAt": "<string>",
  "credentialId": "<string>",
  "currentState": "<string>",
  "currentStateCode": 123,
  "direction": "<string>",
  "documentType": "<string>",
  "downloadAttempts": 123,
  "errorCode": "<string>",
  "expired": true,
  "expiresAt": "<string>",
  "fileName": "<string>",
  "fileRef": "<string>",
  "fileSizeBytes": 123,
  "hashMismatchAttempts": 123,
  "id": "<string>",
  "lastTransitError": "<string>",
  "protocolGeneratedAt": "<string>",
  "protocolNumber": "<string>",
  "secondsRemaining": 123,
  "sourceProduct": "<string>",
  "transmissionAttempts": 123,
  "updatedAt": "<string>",
  "uploadAttempts": 123,
  "urgentRequestedAt": "<string>"
}
{}
{}
{}
{}
{}

Authorizations

Authorization
string
header
required

Bearer token authentication (format: "Bearer {token}")

Path Parameters

id
string
required

Transfer UUID

Body

application/json

optional reason

reason
string

Response

OK

bytesDownloaded
integer
bytesUploaded
integer
createdAt
string
credentialId
string
currentState
string
currentStateCode
integer
direction
string
documentType
string
downloadAttempts
integer

DownloadAttempts is the legacy aggregate counter; for inbound transfers, see hashMismatchAttempts + transmissionAttempts.

errorCode
string
expired
boolean
expiresAt
string

ExpiresAt / SecondsRemaining / Expired project the 44h BACEN protocol TTL directly onto the read view (the dedicated GET /:id/expiry endpoint was folded in here). ExpiresAt is nil — and SecondsRemaining 0, Expired false — until the transfer is assigned a protocol number (ProtocolGeneratedAt nil). Once assigned, ExpiresAt is ProtocolGeneratedAt + TTL; SecondsRemaining counts down to it at the handler clock and clamps to 0, at which point Expired flips true.

fileName
string
fileRef
string
fileSizeBytes
integer
hashMismatchAttempts
integer

HashMismatchAttempts is the inbound-only counter that drives the StateInconsistent terminal budget (HASH_MISMATCH). Always 0 for outbound transfers.

id
string
lastTransitError
string
protocolGeneratedAt
string
protocolNumber
string
secondsRemaining
integer
sourceProduct
string
transmissionAttempts
integer

TransmissionAttempts is the inbound-only counter that drives the StateCanceled / DOWNLOAD_FAILED terminal budget. Always 0 for outbound transfers.

updatedAt
string
uploadAttempts
integer
urgentRequestedAt
string

UrgentRequestedAt is the UTC timestamp at which an operator flagged this inbound transfer for urgent processing (mark-urgent). Nil (and omitted) for transfers that were never marked urgent.