Skip to main content
GET
/
conversions
/
{conversionId}
cURL
curl --request GET \
  --url https://api.grainfinance.co/v1/conversions/{conversionId} \
  --header 'Authorization: Basic <encoded-value>'
import requests

url = "https://api.grainfinance.co/v1/conversions/{conversionId}"

headers = {"Authorization": "Basic <encoded-value>"}

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

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};

fetch('https://api.grainfinance.co/v1/conversions/{conversionId}', 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/conversions/{conversionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);

$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://api.grainfinance.co/v1/conversions/{conversionId}"

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

req.Header.Add("Authorization", "Basic <encoded-value>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.grainfinance.co/v1/conversions/{conversionId}")
.header("Authorization", "Basic <encoded-value>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.grainfinance.co/v1/conversions/{conversionId}")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'

response = http.request(request)
puts response.read_body
{
  "id": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
  "organizationId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
  "fromCurrency": "MXN",
  "toCurrency": "USD",
  "toCurrencyAmount": 1560,
  "fromCurrencyAmount": 32161.8,
  "quote": 20.6165,
  "acceptedAtTs": 1659625088,
  "issuedAt": "2023-01-18",
  "completedAt": "2023-02-23"
}
{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}

Authorizations

Authorization
string
header
required

Basic authentication using the partner API keys from https://console.grainfinance.co/keys

Path Parameters

conversionId
string
required

The id of the conversion within the Grain platform.

Response

Conversion Found

id
string<uuid>
required

The id of the conversion within the Grain platform.

Pattern: [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}
Example:

"8173b9a7-ee61-413e-b9e3-7c04b2a067c5"

organizationId
string<uuid>
required

The id of the organization that perform the conversion within the Grain platform.

Pattern: [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}
Example:

"8173b9a7-ee61-413e-b9e3-7c04b2a067c5"

fromCurrency
string
required

The currency in which the transaction should be paid at by your customer.

Example:

"MXN"

toCurrency
string
required

The currency in which the inventory item is listed at on your platform.

Example:

"USD"

toCurrencyAmount
number<double>
required

The amount to transfer in the toCurrency

Example:

1560

fromCurrencyAmount
number<double>
required

The amount to transfer in the fromCurrency

Example:

32161.8

quote
number<double>
required

The rate locked by this conversion.

Example:

20.6165

acceptedAtTs
number<double>
required

The unix timestamp in which the conversion offer was accepted (if it was).

Example:

1659625088

issuedAt
string<YYYY-MM-DD>
required

The date in which the conversion was issued, denoted in YYYY-MM-DD format.

Pattern: \d{4}-\d{2}-\d{2}
Example:

"2023-01-18"

completedAt
string<YYYY-MM-DD> | null
required

The date in which the conversion was completed, denoted in YYYY-MM-DD format.

Pattern: \d{4}-\d{2}-\d{2}
Example:

"2023-02-23"