curl --request POST \
--url https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'X-Customer-IP: <x-customer-ip>' \
--data '
{
"drawdownProposalId": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"externalDrawdownId": "dd_2026_001"
}
'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept"
payload = {
"drawdownProposalId": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"externalDrawdownId": "dd_2026_001"
}
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({
drawdownProposalId: '497f6eca-6276-4993-bfeb-53cbbbba6f08',
externalDrawdownId: 'dd_2026_001'
})
};
fetch('https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept', 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}/drawdown/accept",
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([
'drawdownProposalId' => '497f6eca-6276-4993-bfeb-53cbbbba6f08',
'externalDrawdownId' => 'dd_2026_001'
]),
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/customers/{customerId}/hedges/{hedgeId}/drawdown/accept"
payload := strings.NewReader("{\n \"drawdownProposalId\": \"497f6eca-6276-4993-bfeb-53cbbbba6f08\",\n \"externalDrawdownId\": \"dd_2026_001\"\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/customers/{customerId}/hedges/{hedgeId}/drawdown/accept")
.header("X-Customer-IP", "<x-customer-ip>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"drawdownProposalId\": \"497f6eca-6276-4993-bfeb-53cbbbba6f08\",\n \"externalDrawdownId\": \"dd_2026_001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept")
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 \"drawdownProposalId\": \"497f6eca-6276-4993-bfeb-53cbbbba6f08\",\n \"externalDrawdownId\": \"dd_2026_001\"\n}"
response = http.request(request)
puts response.read_body{
"id": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"hedgeId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"status": "Active",
"fromCurrency": "MXN",
"toCurrency": "USD",
"fromCurrencyAmount": 8040.43,
"toCurrencyAmount": 390,
"collateralAmountReleased": 402.02,
"quote": 20.6165,
"endAt": "2023-01-25",
"settlementAt": "2023-01-26",
"beforeHedgeState": {
"fromCurrencyAmount": 32161.8,
"toCurrencyAmount": 1560,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1608.09
},
"afterHedgeState": {
"fromCurrencyAmount": 24121.37,
"toCurrencyAmount": 1170,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1206.07
}
}{
"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"
}Drawdown Accept
Accepts a drawdown proposal generated by the drawdown-quote call, turning it into a confirmed drawdown that settles on the next business day.
curl --request POST \
--url https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'X-Customer-IP: <x-customer-ip>' \
--data '
{
"drawdownProposalId": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"externalDrawdownId": "dd_2026_001"
}
'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept"
payload = {
"drawdownProposalId": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"externalDrawdownId": "dd_2026_001"
}
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({
drawdownProposalId: '497f6eca-6276-4993-bfeb-53cbbbba6f08',
externalDrawdownId: 'dd_2026_001'
})
};
fetch('https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept', 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}/drawdown/accept",
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([
'drawdownProposalId' => '497f6eca-6276-4993-bfeb-53cbbbba6f08',
'externalDrawdownId' => 'dd_2026_001'
]),
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/customers/{customerId}/hedges/{hedgeId}/drawdown/accept"
payload := strings.NewReader("{\n \"drawdownProposalId\": \"497f6eca-6276-4993-bfeb-53cbbbba6f08\",\n \"externalDrawdownId\": \"dd_2026_001\"\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/customers/{customerId}/hedges/{hedgeId}/drawdown/accept")
.header("X-Customer-IP", "<x-customer-ip>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"drawdownProposalId\": \"497f6eca-6276-4993-bfeb-53cbbbba6f08\",\n \"externalDrawdownId\": \"dd_2026_001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/accept")
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 \"drawdownProposalId\": \"497f6eca-6276-4993-bfeb-53cbbbba6f08\",\n \"externalDrawdownId\": \"dd_2026_001\"\n}"
response = http.request(request)
puts response.read_body{
"id": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"hedgeId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"status": "Active",
"fromCurrency": "MXN",
"toCurrency": "USD",
"fromCurrencyAmount": 8040.43,
"toCurrencyAmount": 390,
"collateralAmountReleased": 402.02,
"quote": 20.6165,
"endAt": "2023-01-25",
"settlementAt": "2023-01-26",
"beforeHedgeState": {
"fromCurrencyAmount": 32161.8,
"toCurrencyAmount": 1560,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1608.09
},
"afterHedgeState": {
"fromCurrencyAmount": 24121.37,
"toCurrencyAmount": 1170,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1206.07
}
}{
"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"
}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}Path Parameters
The id of the customer within the Grain platform.
[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}The id of the hedge within the Grain platform.
[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}Body
The payload required in order to accept a drawdown proposal.
The id returned by the drawdown-quote call.
[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}"497f6eca-6276-4993-bfeb-53cbbbba6f08"
Your own reference id for this drawdown.
"dd_2026_001"
Response
Drawdown Accepted
An executed drawdown, returned by the drawdown-accept call and when fetching a drawdown.
The id of the drawdown within the Grain platform.
[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"
The id of the hedge this drawdown belongs to.
[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}"8173b9a7-ee61-413e-b9e3-7c04b2a067c5"
The status of the drawdown.
Active, InProcess, Completed, Overdue "Active"
The currency in which the transaction should be paid at by your customer.
"MXN"
The currency in which the inventory item is listed at on your platform.
"USD"
The amount to draw down in the fromCurrency.
If toCurrencyAmount is provided, then fromCurrencyAmount calculated as:
fromCurrencyAmount = toCurrencyAmount * quote
8040.43
The amount to draw down in the toCurrency.
If fromCurrencyAmount is provided, then toCurrencyAmount calculated as:
toCurrencyAmount = fromCurrencyAmount / quote
390
The collateral amount released back to the customer as a result of this drawdown, in the fromCurrency.
402.02
The rate at which this drawdown settles - the rate locked by the hedge.
20.6165
The date in which this drawdown executes, denoted in YYYY-MM-DD format.
\d{4}-\d{2}-\d{2}"2023-01-25"
The date in which this drawdown settles (next business day after endAt), denoted in YYYY-MM-DD format.
\d{4}-\d{2}-\d{2}"2023-01-26"
The hedge's state immediately before this drawdown.
Show child attributes
Show child attributes
The hedge's remaining state immediately after this drawdown.
Show child attributes
Show child attributes