curl --request POST \
--url https://api.grainfinance.co/v1/spots/accept-quote \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'X-Customer-IP: <x-customer-ip>' \
--data '
{
"spotProposalId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"toCurrencyAmount": 1560,
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
'import requests
url = "https://api.grainfinance.co/v1/spots/accept-quote"
payload = {
"spotProposalId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"toCurrencyAmount": 1560,
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
headers = {
"X-Customer-IP": "<x-customer-ip>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Customer-IP': '<x-customer-ip>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
spotProposalId: '8173b9a7-ee61-413e-b9e3-7c04b2a067c5',
toCurrencyAmount: 1560,
extraFields: {field_a: 'value_a', field_b: 'value_b'}
})
};
fetch('https://api.grainfinance.co/v1/spots/accept-quote', 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.grainfinance.co/v1/spots/accept-quote",
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([
'spotProposalId' => '8173b9a7-ee61-413e-b9e3-7c04b2a067c5',
'toCurrencyAmount' => 1560,
'extraFields' => [
'field_a' => 'value_a',
'field_b' => 'value_b'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"X-Customer-IP: <x-customer-ip>"
],
]);
$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.grainfinance.co/v1/spots/accept-quote"
payload := strings.NewReader("{\n \"spotProposalId\": \"8173b9a7-ee61-413e-b9e3-7c04b2a067c5\",\n \"toCurrencyAmount\": 1560,\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Customer-IP", "<x-customer-ip>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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.grainfinance.co/v1/spots/accept-quote")
.header("X-Customer-IP", "<x-customer-ip>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"spotProposalId\": \"8173b9a7-ee61-413e-b9e3-7c04b2a067c5\",\n \"toCurrencyAmount\": 1560,\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/spots/accept-quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Customer-IP"] = '<x-customer-ip>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"spotProposalId\": \"8173b9a7-ee61-413e-b9e3-7c04b2a067c5\",\n \"toCurrencyAmount\": 1560,\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Could not parse IP address (v4 or v6) for ip"
}Accept
Accepts a previously generated spot rate proposal and executes the conversion.
curl --request POST \
--url https://api.grainfinance.co/v1/spots/accept-quote \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'X-Customer-IP: <x-customer-ip>' \
--data '
{
"spotProposalId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"toCurrencyAmount": 1560,
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
'import requests
url = "https://api.grainfinance.co/v1/spots/accept-quote"
payload = {
"spotProposalId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"toCurrencyAmount": 1560,
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
headers = {
"X-Customer-IP": "<x-customer-ip>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Customer-IP': '<x-customer-ip>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
spotProposalId: '8173b9a7-ee61-413e-b9e3-7c04b2a067c5',
toCurrencyAmount: 1560,
extraFields: {field_a: 'value_a', field_b: 'value_b'}
})
};
fetch('https://api.grainfinance.co/v1/spots/accept-quote', 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.grainfinance.co/v1/spots/accept-quote",
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([
'spotProposalId' => '8173b9a7-ee61-413e-b9e3-7c04b2a067c5',
'toCurrencyAmount' => 1560,
'extraFields' => [
'field_a' => 'value_a',
'field_b' => 'value_b'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"X-Customer-IP: <x-customer-ip>"
],
]);
$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.grainfinance.co/v1/spots/accept-quote"
payload := strings.NewReader("{\n \"spotProposalId\": \"8173b9a7-ee61-413e-b9e3-7c04b2a067c5\",\n \"toCurrencyAmount\": 1560,\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Customer-IP", "<x-customer-ip>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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.grainfinance.co/v1/spots/accept-quote")
.header("X-Customer-IP", "<x-customer-ip>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"spotProposalId\": \"8173b9a7-ee61-413e-b9e3-7c04b2a067c5\",\n \"toCurrencyAmount\": 1560,\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/spots/accept-quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Customer-IP"] = '<x-customer-ip>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"spotProposalId\": \"8173b9a7-ee61-413e-b9e3-7c04b2a067c5\",\n \"toCurrencyAmount\": 1560,\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Could not parse IP address (v4 or v6) for ip"
}POST /conversions/accept-quote instead.Authorizations
Basic authentication using the partner API keys from https://console.grainfinance.co/keys
Headers
The IPv4 address of the browser from which the customer contacts your platform.
example: 192.158.1.38
((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}Body
The payload required in order to accept a spot
The payload required in order to accept a spot
The id of the spot proposal to accept.
"8173b9a7-ee61-413e-b9e3-7c04b2a067c5"
the amount to transfer in the toCurrency. If amount was not specified on quote, it should be specified on Accept.
1560
Additional fields that provide further details about the transaction. These fields should be specified as a valid JSON object.
Show child attributes
Show child attributes
{
"field_a": "value_a",
"field_b": "value_b"
}Response
Spot Accepted
The response of a spot action. Includes the reference to the relevant objects.
The id of the created spot
[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}"4d78ac65-2c3f-47e2-8bf3-3f76124e9d27"