Skip to main content
POST
/
savings
/
orders
/
{id}
/
trade-confirmations
/
generate
Generate trade confirmation PDF
curl --request POST \
  --url https://{host}/savings/orders/{id}/trade-confirmations/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'x-user-id: <x-user-id>'
import requests

url = "https://{host}/savings/orders/{id}/trade-confirmations/generate"

headers = {
"x-user-id": "<x-user-id>",
"Authorization": "Bearer <token>"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {'x-user-id': '<x-user-id>', Authorization: 'Bearer <token>'}
};

fetch('https://{host}/savings/orders/{id}/trade-confirmations/generate', 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://{host}/savings/orders/{id}/trade-confirmations/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"x-user-id: <x-user-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"
"net/http"
"io"
)

func main() {

url := "https://{host}/savings/orders/{id}/trade-confirmations/generate"

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

req.Header.Add("x-user-id", "<x-user-id>")
req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{host}/savings/orders/{id}/trade-confirmations/generate")
.header("x-user-id", "<x-user-id>")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{host}/savings/orders/{id}/trade-confirmations/generate")

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

request = Net::HTTP::Post.new(url)
request["x-user-id"] = '<x-user-id>'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "fileUri": "https://storage.example.com/trade-confirmations/7501d8537fb3fc001234abcd/abc123/wealthyhood-trade-confirmation_12-jul-2024.pdf"
}
{
"status": 400,
"error": {
"message": "Trade confirmation can only be generated for matched orders!",
"description": "Operation failed"
},
"responseId": "7c91c5fe-d5a8-4b82-8e3f-5af2e30e43c2"
}
{
"status": 401,
"error": {
"message": "User not found"
},
"responseId": "145f2b0d-1d5b-4e91-8d0d-7af0ae9ad13a"
}
{
"status": 403,
"error": {
"message": "Portfolio does not belong to user"
},
"responseId": "5e467f79-c62c-4d83-9810-7a0f8529fd76"
}
{
"status": 404,
"error": {
"message": "Savings order not found"
},
"responseId": "65c0b1f6-2a48-4c4f-a5aa-9b9c8c6f9b58"
}

Authorizations

Authorization
string
header
required

Auth0-issued access token that includes the scopes listed for the endpoint.

Headers

x-user-id
string
required

User identifier for the M2M client to specify which user's data to access.

Pattern: ^[a-f0-9]{24}$

Path Parameters

id
string
required

Savings order identifier (MongoDB ObjectId)

Pattern: ^[a-f0-9]{24}$

Response

Trade confirmation generated successfully

fileUri
string<uri>
required

URL to download the generated trade confirmation PDF