Prepare a buy
curl --request POST \
--url https://partners-api.sandbox.securitize.io/stocks/v1/stocks/on-ramp/{contractAddress}/prepare-execute-transaction \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"investorId": "6b31c0e9a4f2d17e85c3b904",
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzeW1ib2wiOiJBQVBML1VTRCJ9.c2lnbmF0dXJl",
"slippageBps": "50",
"liquidityAmount": "1000000000",
"minOutputAmount": "4302702702"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
investorId: '6b31c0e9a4f2d17e85c3b904',
signedPrice: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzeW1ib2wiOiJBQVBML1VTRCJ9.c2lnbmF0dXJl',
slippageBps: '50',
liquidityAmount: '1000000000',
minOutputAmount: '4302702702'
})
};
fetch('https://partners-api.sandbox.securitize.io/stocks/v1/stocks/on-ramp/{contractAddress}/prepare-execute-transaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://partners-api.sandbox.securitize.io/stocks/v1/stocks/on-ramp/{contractAddress}/prepare-execute-transaction"
payload = {
"investorId": "6b31c0e9a4f2d17e85c3b904",
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzeW1ib2wiOiJBQVBML1VTRCJ9.c2lnbmF0dXJl",
"slippageBps": "50",
"liquidityAmount": "1000000000",
"minOutputAmount": "4302702702"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"unsignedTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA…",
"additionalData": {
"anchorPrice": "231250000000000000000",
"operator": "Gp3ratorRoutr9sXcR8yLmB3hW9sJdE6aK1uNqG5tYpC"
}
}{
"statusCode": 400,
"message": "EXPIRED_PRICE",
"error": "Bad Request"
}{
"message": "No API key found in request"
}{
"statusCode": 403,
"message": "UNAUTHORIZED_INVESTOR",
"error": "Forbidden"
}{
"statusCode": 404,
"message": "SYMBOL_NOT_FOUND",
"error": "Not Found"
}{
"statusCode": 429,
"message": "ThrottlerException: Too Many Requests"
}Trading
Prepare a buy
Builds the transaction that buys the stock with USDC, for the investor’s linked wallet, at the price in signedPrice. Securitize checks the investor’s eligibility, the market status, the order size and the price’s freshness, then returns the transaction with the signed price and the swap already in it and Securitize’s own signature on it. Securitize pays the network fee: the investor needs no funds for it.
Have the investor’s wallet sign the returned transaction without modifying it and submit it with POST /stocks/execute-signed-transaction within 120 seconds. Any change invalidates it on chain and the trade reverts.
POST
/
stocks
/
on-ramp
/
{contractAddress}
/
prepare-execute-transaction
Prepare a buy
curl --request POST \
--url https://partners-api.sandbox.securitize.io/stocks/v1/stocks/on-ramp/{contractAddress}/prepare-execute-transaction \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"investorId": "6b31c0e9a4f2d17e85c3b904",
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzeW1ib2wiOiJBQVBML1VTRCJ9.c2lnbmF0dXJl",
"slippageBps": "50",
"liquidityAmount": "1000000000",
"minOutputAmount": "4302702702"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
investorId: '6b31c0e9a4f2d17e85c3b904',
signedPrice: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzeW1ib2wiOiJBQVBML1VTRCJ9.c2lnbmF0dXJl',
slippageBps: '50',
liquidityAmount: '1000000000',
minOutputAmount: '4302702702'
})
};
fetch('https://partners-api.sandbox.securitize.io/stocks/v1/stocks/on-ramp/{contractAddress}/prepare-execute-transaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://partners-api.sandbox.securitize.io/stocks/v1/stocks/on-ramp/{contractAddress}/prepare-execute-transaction"
payload = {
"investorId": "6b31c0e9a4f2d17e85c3b904",
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzeW1ib2wiOiJBQVBML1VTRCJ9.c2lnbmF0dXJl",
"slippageBps": "50",
"liquidityAmount": "1000000000",
"minOutputAmount": "4302702702"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"unsignedTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA…",
"additionalData": {
"anchorPrice": "231250000000000000000",
"operator": "Gp3ratorRoutr9sXcR8yLmB3hW9sJdE6aK1uNqG5tYpC"
}
}{
"statusCode": 400,
"message": "EXPIRED_PRICE",
"error": "Bad Request"
}{
"message": "No API key found in request"
}{
"statusCode": 403,
"message": "UNAUTHORIZED_INVESTOR",
"error": "Forbidden"
}{
"statusCode": 404,
"message": "SYMBOL_NOT_FOUND",
"error": "Not Found"
}{
"statusCode": 429,
"message": "ThrottlerException: Too Many Requests"
}Authorizations
Path Parameters
Body
application/json
Response
The transaction for the investor's wallet to sign.