Create a pending send or convert proposal for approval in Tuyo
curl --request POST \
--url https://api.tuyo.com/public/action_proposals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'Tuyo-API-Version: <tuyo-api-version>' \
--data '
{
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"ttlSeconds": "<unknown>"
}
'import requests
url = "https://api.tuyo.com/public/action_proposals"
payload = {
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"ttlSeconds": "<unknown>"
}
headers = {
"Tuyo-API-Version": "<tuyo-api-version>",
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tuyo-API-Version': '<tuyo-api-version>',
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
intent: {
kind: 'send',
recipient: {kind: 'tuyo_username', username: '<string>'},
recipientGets: '<unknown>',
fundingSource: '<unknown>',
memo: '<unknown>'
},
ttlSeconds: '<unknown>'
})
};
fetch('https://api.tuyo.com/public/action_proposals', 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.tuyo.com/public/action_proposals",
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([
'intent' => [
'kind' => 'send',
'recipient' => [
'kind' => 'tuyo_username',
'username' => '<string>'
],
'recipientGets' => '<unknown>',
'fundingSource' => '<unknown>',
'memo' => '<unknown>'
],
'ttlSeconds' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"Tuyo-API-Version: <tuyo-api-version>"
],
]);
$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.tuyo.com/public/action_proposals"
payload := strings.NewReader("{\n \"intent\": {\n \"kind\": \"send\",\n \"recipient\": {\n \"kind\": \"tuyo_username\",\n \"username\": \"<string>\"\n },\n \"recipientGets\": \"<unknown>\",\n \"fundingSource\": \"<unknown>\",\n \"memo\": \"<unknown>\"\n },\n \"ttlSeconds\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tuyo-API-Version", "<tuyo-api-version>")
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.tuyo.com/public/action_proposals")
.header("Tuyo-API-Version", "<tuyo-api-version>")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"intent\": {\n \"kind\": \"send\",\n \"recipient\": {\n \"kind\": \"tuyo_username\",\n \"username\": \"<string>\"\n },\n \"recipientGets\": \"<unknown>\",\n \"fundingSource\": \"<unknown>\",\n \"memo\": \"<unknown>\"\n },\n \"ttlSeconds\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tuyo.com/public/action_proposals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tuyo-API-Version"] = '<tuyo-api-version>'
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"intent\": {\n \"kind\": \"send\",\n \"recipient\": {\n \"kind\": \"tuyo_username\",\n \"username\": \"<string>\"\n },\n \"recipientGets\": \"<unknown>\",\n \"fundingSource\": \"<unknown>\",\n \"memo\": \"<unknown>\"\n },\n \"ttlSeconds\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"origin": {
"clientName": "<string>",
"clientLogoUri": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"origin": {
"clientName": "<string>",
"clientLogoUri": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}API Reference
Create a pending send or convert proposal for approval in Tuyo
A send intent moves funds to a Tuyo username, address, or saved bank account. A convert intent changes one token into another: from is the token balance to spend and amountIn the exact amount of it, to the token to receive, possibly on another network. Quote it first with POST /action_quotes; the received amount is not fixed until settlement, so follow the accepted proposal to its transaction for amountOut. Accounts without conversions enabled get action_unavailable. The user has 15 minutes to approve unless ttlSeconds asks for another lifetime, from 60 seconds to 24 hours; a value outside that range is rejected.
POST
/
action_proposals
Create a pending send or convert proposal for approval in Tuyo
curl --request POST \
--url https://api.tuyo.com/public/action_proposals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'Tuyo-API-Version: <tuyo-api-version>' \
--data '
{
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"ttlSeconds": "<unknown>"
}
'import requests
url = "https://api.tuyo.com/public/action_proposals"
payload = {
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"ttlSeconds": "<unknown>"
}
headers = {
"Tuyo-API-Version": "<tuyo-api-version>",
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tuyo-API-Version': '<tuyo-api-version>',
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
intent: {
kind: 'send',
recipient: {kind: 'tuyo_username', username: '<string>'},
recipientGets: '<unknown>',
fundingSource: '<unknown>',
memo: '<unknown>'
},
ttlSeconds: '<unknown>'
})
};
fetch('https://api.tuyo.com/public/action_proposals', 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.tuyo.com/public/action_proposals",
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([
'intent' => [
'kind' => 'send',
'recipient' => [
'kind' => 'tuyo_username',
'username' => '<string>'
],
'recipientGets' => '<unknown>',
'fundingSource' => '<unknown>',
'memo' => '<unknown>'
],
'ttlSeconds' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"Tuyo-API-Version: <tuyo-api-version>"
],
]);
$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.tuyo.com/public/action_proposals"
payload := strings.NewReader("{\n \"intent\": {\n \"kind\": \"send\",\n \"recipient\": {\n \"kind\": \"tuyo_username\",\n \"username\": \"<string>\"\n },\n \"recipientGets\": \"<unknown>\",\n \"fundingSource\": \"<unknown>\",\n \"memo\": \"<unknown>\"\n },\n \"ttlSeconds\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tuyo-API-Version", "<tuyo-api-version>")
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.tuyo.com/public/action_proposals")
.header("Tuyo-API-Version", "<tuyo-api-version>")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"intent\": {\n \"kind\": \"send\",\n \"recipient\": {\n \"kind\": \"tuyo_username\",\n \"username\": \"<string>\"\n },\n \"recipientGets\": \"<unknown>\",\n \"fundingSource\": \"<unknown>\",\n \"memo\": \"<unknown>\"\n },\n \"ttlSeconds\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tuyo.com/public/action_proposals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tuyo-API-Version"] = '<tuyo-api-version>'
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"intent\": {\n \"kind\": \"send\",\n \"recipient\": {\n \"kind\": \"tuyo_username\",\n \"username\": \"<string>\"\n },\n \"recipientGets\": \"<unknown>\",\n \"fundingSource\": \"<unknown>\",\n \"memo\": \"<unknown>\"\n },\n \"ttlSeconds\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"origin": {
"clientName": "<string>",
"clientLogoUri": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"intent": {
"kind": "send",
"recipient": {
"kind": "tuyo_username",
"username": "<string>"
},
"recipientGets": "<unknown>",
"fundingSource": "<unknown>",
"memo": "<unknown>"
},
"origin": {
"clientName": "<string>",
"clientLogoUri": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}Headers
Body
application/json
Response
Existing idempotent proposal.