cURL
curl --request GET \
--url https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}"
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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}', 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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}",
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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}"
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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}")
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": "b3e0d6a1-5c7f-4e2a-8d9b-1f4c6a2e7b30",
"hedgeId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"createdAtTs": 1676887200,
"fromCurrency": "MXN",
"toCurrency": "USD",
"fromCurrencyAmount": 32426.94,
"toCurrencyAmount": 1560,
"quote": 20.7865,
"endAt": "2023-04-24",
"settlementAt": "2023-04-25",
"beforeHedgeState": {
"fromCurrencyAmount": 32161.8,
"toCurrencyAmount": 1560,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1608.09
},
"afterHedgeState": {
"fromCurrencyAmount": 32426.94,
"toCurrencyAmount": 1560,
"quote": 20.7865,
"endAt": "2023-04-24",
"settlementAt": "2023-04-25",
"collateralAmount": 1608.09
}
}{
"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"
}Extend Hedge
Get
Retrieves details of a specific extension.
GET
/
customers
/
{customerId}
/
hedges
/
{hedgeId}
/
extension
/
{extensionId}
cURL
curl --request GET \
--url https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}"
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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}', 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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}",
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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}"
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/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/extension/{extensionId}")
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": "b3e0d6a1-5c7f-4e2a-8d9b-1f4c6a2e7b30",
"hedgeId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"createdAtTs": 1676887200,
"fromCurrency": "MXN",
"toCurrency": "USD",
"fromCurrencyAmount": 32426.94,
"toCurrencyAmount": 1560,
"quote": 20.7865,
"endAt": "2023-04-24",
"settlementAt": "2023-04-25",
"beforeHedgeState": {
"fromCurrencyAmount": 32161.8,
"toCurrencyAmount": 1560,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1608.09
},
"afterHedgeState": {
"fromCurrencyAmount": 32426.94,
"toCurrencyAmount": 1560,
"quote": 20.7865,
"endAt": "2023-04-24",
"settlementAt": "2023-04-25",
"collateralAmount": 1608.09
}
}{
"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"
}Authorizations
Basic authentication using the partner API keys from https://console.grainfinance.co/keys
Path Parameters
Response
Extension Retrieved
The response body when fetching a single extension.