cURL with fictitious data
curl --request POST \
--url https://api.example.com/spi/v1/transfers/01960718-a213-2435-6078-901234567123/refunds \
--header 'Authorization: Bearer demo-access-token' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: pix-demo-20260903-000001' \
--header 'X-Account-Id: 019606a1-3b4c-7d8e-9f01-234567890abc' \
--data '{
"amount": "100.00",
"reason": "Estorno solicitado pelo pagador",
"reasonCode": "MD06"
}'import requests
url = "https://api.example.com/spi/v1/transfers/{id}/refunds"
payload = {
"amount": "100.00",
"reason": "Estorno solicitado pelo pagador",
"reasonCode": "MD06"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-Account-Id": "<x-account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-Account-Id': '<x-account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '100.00',
reason: 'Estorno solicitado pelo pagador',
reasonCode: 'MD06'
})
};
fetch('https://api.example.com/spi/v1/transfers/{id}/refunds', 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.example.com/spi/v1/transfers/{id}/refunds",
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([
'amount' => '100.00',
'reason' => 'Estorno solicitado pelo pagador',
'reasonCode' => 'MD06'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"X-Account-Id: <x-account-id>"
],
]);
$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.example.com/spi/v1/transfers/{id}/refunds"
payload := strings.NewReader("{\n \"amount\": \"100.00\",\n \"reason\": \"Estorno solicitado pelo pagador\",\n \"reasonCode\": \"MD06\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-Account-Id", "<x-account-id>")
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/spi/v1/transfers/{id}/refunds")
.header("Idempotency-Key", "<idempotency-key>")
.header("X-Account-Id", "<x-account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100.00\",\n \"reason\": \"Estorno solicitado pelo pagador\",\n \"reasonCode\": \"MD06\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/spi/v1/transfers/{id}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["X-Account-Id"] = '<x-account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"100.00\",\n \"reason\": \"Estorno solicitado pelo pagador\",\n \"reasonCode\": \"MD06\"\n}"
response = http.request(request)
puts response.read_body{
"accountId": "019606a0-1a2b-7c3d-8e4f-567890123abc",
"amount": "100.00",
"createdAt": "2026-05-06T10:45:00Z",
"description": "Estorno solicitado pelo pagador",
"id": "019606b1-3b4c-7d8e-9f01-234567890dee",
"ledger": {
"destinationOperationId": "019606a5-7f80-7182-3c4d-56789012cdf1",
"revert": {
"destinationOperationId": "019606a5-7f80-7182-3c4d-56789012cdf1",
"sourceOperationId": "019606a5-7f80-7182-3c4d-56789012cdf0",
"transactionId": "019606a5-7f80-7182-3c4d-56789012cdef"
},
"sourceOperationId": "019606a5-7f80-7182-3c4d-56789012cdf0",
"transactionId": "019606a5-7f80-7182-3c4d-56789012cdef"
},
"metadata": {
"field": "field-example"
},
"originalEndToEndId": "E12345678202605061030abcdef12345",
"reasonCode": "MD06",
"returnEndToEndId": "D12345678202605061045fedcba54321",
"status": "COMPLETED",
"type": "OUTBOUND",
"updatedAt": "2026-05-06T10:45:30Z"
}{
"code": "PIX-0030",
"title": "Idempotency Key Required",
"message": "The Idempotency-Key header is required for this operation and must be within the accepted length."
}{
"code": "PIX-0031",
"title": "Idempotency Key Conflict",
"message": "The Idempotency-Key was already used with a different request."
}{
"code": "PIX-0032",
"title": "Idempotency Unavailable",
"message": "The request was not processed because the idempotency store is unavailable. Please retry."
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}Create an outbound Pix refund (MED)
Issues a refund against a previously completed CASHIN transfer with a structured pacs.004 reasonCode.
POST
/
transfers
/
{id}
/
refunds
cURL with fictitious data
curl --request POST \
--url https://api.example.com/spi/v1/transfers/01960718-a213-2435-6078-901234567123/refunds \
--header 'Authorization: Bearer demo-access-token' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: pix-demo-20260903-000001' \
--header 'X-Account-Id: 019606a1-3b4c-7d8e-9f01-234567890abc' \
--data '{
"amount": "100.00",
"reason": "Estorno solicitado pelo pagador",
"reasonCode": "MD06"
}'import requests
url = "https://api.example.com/spi/v1/transfers/{id}/refunds"
payload = {
"amount": "100.00",
"reason": "Estorno solicitado pelo pagador",
"reasonCode": "MD06"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-Account-Id": "<x-account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-Account-Id': '<x-account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '100.00',
reason: 'Estorno solicitado pelo pagador',
reasonCode: 'MD06'
})
};
fetch('https://api.example.com/spi/v1/transfers/{id}/refunds', 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.example.com/spi/v1/transfers/{id}/refunds",
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([
'amount' => '100.00',
'reason' => 'Estorno solicitado pelo pagador',
'reasonCode' => 'MD06'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"X-Account-Id: <x-account-id>"
],
]);
$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.example.com/spi/v1/transfers/{id}/refunds"
payload := strings.NewReader("{\n \"amount\": \"100.00\",\n \"reason\": \"Estorno solicitado pelo pagador\",\n \"reasonCode\": \"MD06\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-Account-Id", "<x-account-id>")
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/spi/v1/transfers/{id}/refunds")
.header("Idempotency-Key", "<idempotency-key>")
.header("X-Account-Id", "<x-account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100.00\",\n \"reason\": \"Estorno solicitado pelo pagador\",\n \"reasonCode\": \"MD06\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/spi/v1/transfers/{id}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["X-Account-Id"] = '<x-account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"100.00\",\n \"reason\": \"Estorno solicitado pelo pagador\",\n \"reasonCode\": \"MD06\"\n}"
response = http.request(request)
puts response.read_body{
"accountId": "019606a0-1a2b-7c3d-8e4f-567890123abc",
"amount": "100.00",
"createdAt": "2026-05-06T10:45:00Z",
"description": "Estorno solicitado pelo pagador",
"id": "019606b1-3b4c-7d8e-9f01-234567890dee",
"ledger": {
"destinationOperationId": "019606a5-7f80-7182-3c4d-56789012cdf1",
"revert": {
"destinationOperationId": "019606a5-7f80-7182-3c4d-56789012cdf1",
"sourceOperationId": "019606a5-7f80-7182-3c4d-56789012cdf0",
"transactionId": "019606a5-7f80-7182-3c4d-56789012cdef"
},
"sourceOperationId": "019606a5-7f80-7182-3c4d-56789012cdf0",
"transactionId": "019606a5-7f80-7182-3c4d-56789012cdef"
},
"metadata": {
"field": "field-example"
},
"originalEndToEndId": "E12345678202605061030abcdef12345",
"reasonCode": "MD06",
"returnEndToEndId": "D12345678202605061045fedcba54321",
"status": "COMPLETED",
"type": "OUTBOUND",
"updatedAt": "2026-05-06T10:45:30Z"
}{
"code": "PIX-0030",
"title": "Idempotency Key Required",
"message": "The Idempotency-Key header is required for this operation and must be within the accepted length."
}{
"code": "PIX-0031",
"title": "Idempotency Key Conflict",
"message": "The Idempotency-Key was already used with a different request."
}{
"code": "PIX-0032",
"title": "Idempotency Unavailable",
"message": "The request was not processed because the idempotency store is unavailable. Please retry."
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}Authorizations
JWT bearer token issued by the identity provider.
Headers
Client-generated key used to retry exactly the same request safely.
Required string length:
1 - 64UUID of the account associated with the operation.
Example:
"019606a1-3b4c-7d8e-9f01-234567890abc"
Path Parameters
Original transfer UUID
Example:
"0196070b-1234-7890-abcd-ef0123456789"
Body
application/json
Response
Created
Example:
"100.00"
Example:
"2026-05-06T10:45:00Z"
Example:
"019606b1-3b4c-7d8e-9f01-234567890dee"
Example:
"E12345678202605061030abcdef12345"
Example:
"MD06"
Example:
"COMPLETED"
Example:
"OUTBOUND"
Example:
"2026-05-06T10:45:30Z"
Example:
"019606a0-1a2b-7c3d-8e4f-567890123abc"
Example:
"Estorno solicitado pelo pagador"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Example:
"D12345678202605061045fedcba54321"
Was this page helpful?

