Download OpenAPI specification:Download
Grain's API provides a comprehensive set of endpoints for managing hedging, spot transactions, pricing, and fund movements - enabling seamless integration of FX workflows into your platform. Each API call follows REST conventions, uses secure authentication, and returns standardized responses for consistency across environments.
Hedge objects represent transactions that lock exchange rates for future dates. A single hedge locks an exchange rate for a future transaction between two currencies.
Generates a real-time rate proposal for a new hedge associated with the specified customer. Once accepted, this proposal becomes a confirmed hedge.
| customerId required | string The id of the customer within the Grain platform. |
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
The payload required in order to ask for a hedge quote
| fromCurrency required | string The currency in which the transaction should be paid at by your customer. |
| toCurrency required | string The currency in which the inventory item is listed at on your platform. |
| toCurrencyAmount | number <double> The amount of |
| externalMarkupPct | number <double> Optional external markup percentage to be applied to the hedge quote. This markup is applied on top of Grain's internal pricing and will be reflected in the final quote rate. Value must be between 0 and 100 (representing 0% to 100%). For example, 1.0 means a 1.0% markup, 0.5 means 0.5% markup, not basis points. If not provided, defaults to 0 (no external markup). |
| endAt required | string <YYYY-MM-DD> (GrainDateFormat) The date format accepted by Grain's API. We accept dash separated ISO-8601 date-only strings. |
{- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "toCurrencyAmount": 1560,
- "externalMarkupPct": 1,
- "endAt": "2023-04-15"
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "quote": 20.6165,
- "validUntilTs": 1659625098,
- "endAt": "2023-04-15",
- "initialCollateralPercentage": 5,
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "externalMarkupPct": 1
}Accepts a previously generated real-time rate proposal and creates the hedge transaction.
| customerId required | string The id of the customer within the Grain platform. |
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
The payload required in order to accept a hedge
| hedgeProposalId required | string The id of the hedge proposal to accept. |
| endAt | string <YYYY-MM-DD> (GrainDateFormat) The date format accepted by Grain's API. We accept dash separated ISO-8601 date-only strings. |
| toCurrencyAmount | number <double> The amount to hedge in the toCurrency, if amount was not specified on quote, it should be specified on Accept. This value is rounded up to two decimal places to ensure precision in the hedging process. For example, an input of 3052.1124 will be rounded to 3052.12. |
| externalTransactionId required | string The transaction id, as identified within your system - required when creating a new hedge. |
| extraFields | object (ExtraFieldsParam) Additional fields that provide further details about the transaction. These fields should be specified as a valid JSON object. |
{- "hedgeProposalId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
- "endAt": "2023-04-15",
- "toCurrencyAmount": 1560,
- "externalTransactionId": "780231b3ae0d7e9e5097nd89",
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc"
}Retrieves offline hedge quote proposals for selected currency pairs. Partners can use these pre-fetched proposals - avoiding the need for a real-time quote per transaction.
| pairs | string Optional query parameter specifying currency pairs. Multiple pairs can be provided as a comma-separated list. Please encode the query param beforehand. For example, ?pairs=EURUSD%2CGBPEUR represents ?pairs=EURUSD,GBPEUR |
{- "tenorCalculationDate": "2023-12-21",
- "validUntilTs": 1703770471,
- "rates": {
- "USDEUR": {
- "7": 1.11293728,
- "14": 1.12093476,
- "30": 1.10384729,
- "60": 1.09723456,
- "90": 1.08576234,
- "120": 1.07456321,
- "150": 1.06781234,
- "180": 1.05678901,
- "210": 1.0456789,
- "240": 1.03456789,
- "270": 1.02345678,
- "300": 1.01234567,
- "330": 1.00987654,
- "360": 0.99876543
}, - "USDGBP": {
- "7": 1.27987654,
- "14": 1.26876543,
- "30": 1.28123456,
- "60": 1.29345678,
- "90": 1.30098765,
- "120": 1.31456789,
- "150": 1.32456789,
- "180": 1.33678901,
- "210": 1.34789012,
- "240": 1.35890123,
- "270": 1.36901234,
- "300": 1.37123456,
- "330": 1.38234567,
- "360": 1.39456789
}
}, - "revision": 156
}Accepts a previously retrieved offline rate proposal and books the hedge accordingly.
| customerId required | string The id of the customer within the Grain platform. |
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
The payload required in order to accept an offline quote hedge
| revision required | number <double> The id of the revision that defines the accepted rate for the currency-pair and tenor. |
| fromCurrency required | string The currency in which the transaction should be paid at by your customer. |
| toCurrency required | string the currency you want to buy. |
| toCurrencyAmount required | number <double> The amount to hedge in the toCurrency. |
| endAt required | string <YYYY-MM-DD> (GrainDateFormat) The date format accepted by Grain's API. We accept dash separated ISO-8601 date-only strings. |
| rate required | number <double> Represents the exchange rate according to the offline map of currency pairs to tenor object. The calculation of the tenor is based on the difference in calendar days between the 'tenorCalculationDate' and the 'endAt' date:
When counting the difference in calendar days, every day is counted as one regardless of the duration of the day. This means that the calculation includes all days: weekends, holidays, and weekdays alike. For example, if the 'endAt' date is 2023-12-16 and the 'tenorCalculationDate' is 2024-12-15, the result is 1 calendar day. To calculate the difference in calendar days accurately, we recommend using a date manipulation library, such as date-fns and its |
| externalTransactionId | string Optional The transaction id, as identified within your system. |
| extraFields | object (ExtraFieldsParam) Additional fields that provide further details about the transaction. These fields should be specified as a valid JSON object. |
{- "revision": 156,
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "toCurrencyAmount": 100000,
- "endAt": "2023-04-15",
- "rate": 20.616512,
- "externalTransactionId": "780231b3ae0d7e9e5097nd89",
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc"
}Retrieves detailed information for a specific hedge.
| customerId required | string The id of the customer within the Grain platform. |
| hedgeId required | string The id of the hedge within the Grain platform. |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
- "status": "Active",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "quote": 20.6165,
- "externalMarkupPct": 1,
- "acceptedAtTs": 1659625088,
- "issuedAt": "2023-04-15",
- "endAt": "2023-04-15",
- "updatedAt": "2023-04-15",
- "cancelledAt": "2023-02-23",
- "fundsReceivedAt": "2023-02-23",
- "completedAt": "2023-02-23",
- "completedAtTs": 1659625090,
- "overdueAt": "2023-04-15",
- "settlementAt": "2023-04-15",
- "settlementType": "collection"
}Cancels an existing hedge.
| customerId required | string The id of the customer within the Grain platform. |
| hedgeId required | string The id of the hedge within the Grain platform. |
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
| reason | string Description of the reason the hedge was canceled. |
{- "reason": "Transaction cancelled by customer"
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc"
}Retrieves all hedges associated with the given customer.
| customerId required | string The id of the customer within the Grain platform. |
| page | number <double> (Page) >= 1 page number indicating which set of items to return |
| per_page | number <double> (PerPage) [ 1 .. 100 ] The number of items in a page |
{- "hedges": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
- "status": "Active",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "quote": 20.6165,
- "externalMarkupPct": 1,
- "acceptedAtTs": 1659625088,
- "issuedAt": "2023-04-15",
- "endAt": "2023-04-15",
- "updatedAt": "2023-04-15",
- "cancelledAt": "2023-02-23",
- "fundsReceivedAt": "2023-02-23",
- "completedAt": "2023-02-23",
- "completedAtTs": 1659625090,
- "overdueAt": "2023-04-15",
- "settlementAt": "2023-04-15",
- "settlementType": "collection"
}
], - "pagination": {
- "page": 1,
- "perPage": 1,
- "totalResults": 0.1
}
}A dual hedge mitigates FX risk by automatically generating two linked hedge legs - a customer leg and a supplier leg - both routed through the customer's functional currency. This structure reduces exposure to currency fluctuations for both cash flow and accounting purposes, while allowing independent tracking and reporting of each hedge leg.
Returns a full table of dual hedge rate proposals for all configured currency pairs. Each rate represents a pair of customer and supplier leg proposals routed through the functional currency. Partners can pre-fetch and cache these rates for both legs.
| pairs | string Optional query parameter specifying currency pairs. Multiple pairs can be provided as a comma-separated list. Please encode the query param beforehand. For example, ?pairs=EURUSD%2CGBPEUR represents ?pairs=EURUSD,GBPEUR |
{- "functionalCurrency": "EUR",
- "tenorCalculationDate": "2023-12-21",
- "validUntilTs": 1703770471,
- "rates": {
- "property1": {
- "7": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "14": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "30": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "60": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "90": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "120": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "150": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "180": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "210": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "240": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "270": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "300": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "330": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "360": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}
}, - "property2": {
- "7": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "14": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "30": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "60": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "90": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "120": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "150": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "180": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "210": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "240": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "270": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "300": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "330": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}, - "360": {
- "7": 0.1,
- "14": 0.1,
- "30": 0.1,
- "60": 0.1,
- "90": 0.1,
- "120": 0.1,
- "150": 0.1,
- "180": 0.1,
- "210": 0.1,
- "240": 0.1,
- "270": 0.1,
- "300": 0.1,
- "330": 0.1,
- "360": 0.1
}
}
}, - "revision": 156
}Accepts a dual hedge rate proposal and books both customer and supplier hedge legs at their proposed rates and tenors.
| customerId required | string The id of the customer within the Grain platform. |
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
The payload required to accept an offline quote for a dual hedge
| revision required | number <double> The id of the revision that defines the accepted rate for the currency-pair and tenor. |
| fromCurrency required | string The currency in which the transaction should be paid by your customer. |
| toCurrency required | string The currency you want to buy. |
| customerToCurrencyAmount required | number <double> The amount to hedge in the toCurrency for the customer. |
| vendorToCurrencyAmount required | number <double> The amount to hedge in the toCurrency for the vendor. |
| customerEndAt required | string The date in which the customer hedge will be settled, denoted in |
| vendorEndAt required | string The date in which the vendor hedge will be settled, denoted in |
| rate required | number <double> Represents the offline hedge rate determined by a two-dimensional lookup based on the vendor and customer tenors. Calculating Tenors: Tenors are calculated from the calendar-day difference between the tenorCalculationDate and the vendor/customer end dates, then mapped into the nearest supported tenor bucket:
Note: All calendar days count — weekends and holidays included. Rate Lookup Example: The rate is retrieved from a two-dimensional map using both tenors:
In this example, if the vendor tenor is 14 days and the customer tenor is 7 days, the rate would be 1.2. To calculate the difference in calendar days accurately, we recommend using a date manipulation library, such as date-fns and its |
| externalTransactionId required | string The transaction id, as identified within your system. |
| extraFields | object (ExtraFieldsParam) Additional fields that provide further details about the transaction. These fields should be specified as a valid JSON object. |
{- "revision": 156,
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "customerToCurrencyAmount": 100000,
- "vendorToCurrencyAmount": 100000,
- "customerEndAt": "2024-02-23",
- "vendorEndAt": "2024-02-23",
- "rate": 20.616512,
- "externalTransactionId": "780231b3ae0d7e9e5097nd89",
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
- "hedgeIds": [
- "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
- "5e89bd76-3d4f-58e3-9cf4-4g87235e0e38"
]
}Retrieves details of a specific dual hedge, including both underlying legs and their respective proposals.
| customerId required | string The id of the customer within the Grain platform. |
| dualHedgeId required | string The id of the dual hedge within the Grain platform. |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "issuedAt": "2023-04-15",
- "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
- "functionalCurrency": "EUR",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "hedges": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
- "status": "Active",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "quote": 20.6165,
- "externalMarkupPct": 1,
- "acceptedAtTs": 1659625088,
- "issuedAt": "2023-04-15",
- "endAt": "2023-04-15",
- "updatedAt": "2023-04-15",
- "cancelledAt": "2023-02-23",
- "fundsReceivedAt": "2023-02-23",
- "completedAt": "2023-02-23",
- "completedAtTs": 1659625090,
- "overdueAt": "2023-04-15",
- "settlementAt": "2023-04-15",
- "settlementType": "collection",
- "spotRate": 0.1
}
]
}Cancels a dual hedge and its underlying customer and supplier legs.
| customerId required | string The id of the customer within the Grain platform. |
| dualHedgeId required | string The id of the dual hedge within the Grain platform. |
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
| reason | string The reason for cancelling the dual hedge. |
{- "reason": "Customer requested cancellation"
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
- "hedgeIds": [
- "bf77890b-17e2-48a1-2013-707df23eb222",
- "bf77890b-17e2-48a1-2013-707df23eb333"
]
}Lists all dual hedge transactions for the partner, including both hedge legs. Supports filtering by creation or update date.
| customerId required | string The id of the customer within the Grain platform. |
| page | number <double> (Page) >= 1 Page number indicating which set of items to return |
| per_page | number <double> (PerPage) [ 1 .. 100 ] The number of items in a page |
| issued_at | string Creation date filter - only dual hedges created on this date will be returned. Format: YYYY-MM-DD |
| updated_at | string Update date filter - only dual hedges updated on this date will be returned. Format: YYYY-MM-DD |
{- "dualHedges": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "issuedAt": "2023-04-15",
- "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
- "functionalCurrency": "EUR",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "hedges": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
- "status": "Active",
- "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "quote": 20.6165,
- "externalMarkupPct": 1,
- "acceptedAtTs": 1659625088,
- "issuedAt": "2023-04-15",
- "endAt": "2023-04-15",
- "updatedAt": "2023-04-15",
- "cancelledAt": "2023-02-23",
- "fundsReceivedAt": "2023-02-23",
- "completedAt": "2023-02-23",
- "completedAtTs": 1659625090,
- "overdueAt": "2023-04-15",
- "settlementAt": "2023-04-15",
- "settlementType": "collection",
- "spotRate": 0.1
}
]
}
], - "pagination": {
- "page": 1,
- "perPage": 1,
- "totalResults": 0.1
}
}Customer objects represent your end customers on the Grain platform. A customer must be created before a hedge or spot transaction can be initiated.
Creates a new customer. If a customer with the same external ID already exists, the record is updated automatically.
The payload required in order to create a customer
| contactEmail | string (ContactEmail) The email address of the company's primary contact |
| contactFullName | string The name of the company's primary contact |
| contactPhoneNumber | string The phone number of the company's primary contact |
| companyName required | string The legal name of the customer's company |
| companyAddress | string The address of the company |
| companyCity | string The city of the company |
| companyState | string The state the company is in (US based) |
| companyCountry required | string (CountryCode) The alpha-2 ISO 3166 country code of the entity's country. |
| companyTaxId | string The tax identification or registration number of the company |
| externalCustomerId required | string The id used to identify the customer within your platform |
| extraFields | object (CustomersExtraFieldsParam) Additional fields that provide further details about the company. These fields should be specified as a valid JSON object. |
{- "contactFullName": "Garrick Ollivander",
- "contactPhoneNumber": "+12125551234",
- "companyName": "Ollivander's Wand Shop",
- "companyAddress": "12 Diagon Alley",
- "companyCity": "London",
- "companyState": "London",
- "companyCountry": "GB",
- "companyTaxId": "123-45-6789",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}Retrieves a list of all existing customers.
| external_customer_id | string external_customer_id is the customer id, as identified within your system |
| page | number <double> (Page) >= 1 page number indicating which set of items to return |
| per_page | number <double> (PerPage) [ 1 .. 100 ] The number of items in a page |
{- "customers": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "companyName": "Ollivander's Wand Shop",
- "companyAddress": "12 Diagon Alley",
- "companyCity": "London",
- "companyState": "London",
- "companyCountry": "GB",
- "contactFullName": "Garrick Ollivander",
- "contactPhoneNumber": "+12125551234",
- "companyTaxId": "123-45-6789",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "status": "Pending",
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}
], - "pagination": {
- "page": 1,
- "perPage": 1,
- "totalResults": 0.1
}
}Retrieves a specific customer by its Grain customer ID.
| customerId required | string <uuid> (UUID) The UUID of the customer |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "companyName": "Ollivander's Wand Shop",
- "companyAddress": "12 Diagon Alley",
- "companyCity": "London",
- "companyState": "London",
- "companyCountry": "GB",
- "contactFullName": "Garrick Ollivander",
- "contactPhoneNumber": "+12125551234",
- "companyTaxId": "123-45-6789",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "status": "Pending",
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}Removes a customer by ID.
| customerId required | string <uuid> (UUID) The UUID of the customer |
{- "message": "Can't perform this action",
- "reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}Updates an existing customer's information.
| customerId required | string <uuid> (UUID) The id of the customer within the Grain platform. |
The payload required in order to update a customer
| contactEmail | string (ContactEmail) The email address of the company's primary contact |
| contactFullName | string The name of the company's primary contact |
| contactPhoneNumber | string The phone number of the company's primary contact |
| companyName | string The legal name of the customer's company |
| companyAddress | string The address of the company |
| companyCity | string The city of the company |
| companyState | string The state the company is in (US based) |
| companyCountry | string (CountryCode) The alpha-2 ISO 3166 country code of the entity's country. |
| companyTaxId | string The tax identification or registration number of the company |
| externalCustomerId | string The id used to identify the customer within your platform |
| extraFields | object (CustomersExtraFieldsParam) Additional fields that provide further details about the company. These fields should be specified as a valid JSON object. |
{- "contactFullName": "Garrick Ollivander",
- "contactPhoneNumber": "+12125551234",
- "companyName": "Ollivander's Wand Shop",
- "companyAddress": "12 Diagon Alley",
- "companyCity": "London",
- "companyState": "London",
- "companyCountry": "GB",
- "companyTaxId": "123-45-6789",
- "externalCustomerId": "630231b3ae0d7e9e5097ad35",
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}{- "message": "Can't perform this action",
- "reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}Pricing endpoints provide access to FX rates for currency pairs that are not being hedged. These endpoints can be used for live rate display or bulk retrieval to support high-volume quoting workflows.
Retrieves the current FX spot rate for supported currency pairs. Use this endpoint for real-time reference rates or live rate display.
| currencies | string (Optional) A query parameter specifying a comma-separated list of 3-letter ISO currency codes. |
{- "rates": {
- "property1": {
- "property1": 0.1,
- "property2": 0.1
}, - "property2": {
- "property1": 0.1,
- "property2": 0.1
}
}
}Generates a spot rate proposal for a new currency conversion.
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
The payload required in order to ask for a spot quote
| fromCurrency required | string The currency in which the transaction should be paid at by your customer. |
| toCurrency required | string The currency in which the inventory item is listed at on your platform. |
| toCurrencyAmount | number <double> The amount of |
| externalMarkupPct | number <double> Optional external markup percentage to be applied to the hedge quote. This markup is applied on top of Grain's internal pricing and will be reflected in the final quote rate. Value must be between 0 and 100 (representing 0% to 100%). For example, 1.0 means a 1.0% markup, 0.5 means 0.5% markup, not basis points. If not provided, defaults to 0 (no external markup). |
{- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "toCurrencyAmount": 1560,
- "externalMarkupPct": 1
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "quote": 20.6165,
- "validUntilTs": 1659625098
}Accepts a previously generated spot rate proposal and executes the conversion.
| X-Customer-IP required | string <IPv4> (CustomerIP) The IPv4 address of the browser from which the customer contacts your platform. |
The payload required in order to accept a spot
| spotProposalId required | string The id of the spot proposal to accept. |
| toCurrencyAmount | number <double> the amount to transfer in the toCurrency. If amount was not specified on quote, it should be specified on Accept. |
| extraFields | object (ExtraFieldsParam) Additional fields that provide further details about the transaction. These fields should be specified as a valid JSON object. |
{- "spotProposalId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
- "toCurrencyAmount": 1560,
- "extraFields": {
- "field_a": "value_a",
- "field_b": "value_b"
}
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}Retrieves details of a specific spot transaction.
| spotId required | string The id of the spot within the Grain platform. |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "quote": 20.6165,
- "acceptedAtTs": 1659625088,
- "issuedAt": "2023-04-15",
- "completedAt": "2023-02-23"
}Retrieves all spot transactions for the given organization.
| page | number <double> (Page) >= 1 page number indicating which set of items to return |
| per_page | number <double> (PerPage) [ 1 .. 100 ] The number of items in a page |
{- "spots": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
- "fromCurrency": "MXN",
- "toCurrency": "USD",
- "toCurrencyAmount": 1560,
- "fromCurrencyAmount": 32161.8,
- "quote": 20.6165,
- "acceptedAtTs": 1659625088,
- "issuedAt": "2023-04-15",
- "completedAt": "2023-02-23"
}
], - "pagination": {
- "page": 1,
- "perPage": 1,
- "totalResults": 0.1
}
}{- "wallets": [
- {
- "id": "1b0ada1e-fa1b-4cfe-a553-01b340c5650e",
- "balance": 10525,
- "currency": "EUR",
- "depositDetails": {
- "id": "string",
- "accountHolderName": "string",
- "externalId": "string",
- "accountNumber": "string",
- "bicSwift": "string",
- "bankCode": "string",
- "branchCode": "string",
- "iban": "string",
- "sortCode": "string",
- "bankName": "string",
- "bankAddress": "string",
- "bankCountry": "string",
- "bankState": "string",
- "paymentType": "swift",
- "specialInstructions": "string",
- "bsbCode": "string"
}
}
]
}Retrieves a specific wallet by its Grain wallet ID.
| walletId required | string <uuid> (UUID) The id of the wallet within the Grain platform. |
{- "id": "1b0ada1e-fa1b-4cfe-a553-01b340c5650e",
- "balance": 10525,
- "currency": "EUR",
- "depositDetails": {
- "id": "string",
- "accountHolderName": "string",
- "externalId": "string",
- "accountNumber": "string",
- "bicSwift": "string",
- "bankCode": "string",
- "branchCode": "string",
- "iban": "string",
- "sortCode": "string",
- "bankName": "string",
- "bankAddress": "string",
- "bankCountry": "string",
- "bankState": "string",
- "paymentType": "swift",
- "specialInstructions": "string",
- "bsbCode": "string"
}
}Withdraws funds from a wallet to a configured beneficiary. Returns the ID of the created withdrawal fund transfer.
| walletId required | string <uuid> (UUID) The id of the wallet within the Grain platform. |
The payload required in order to withdraw fund transfers
| amount required | number <double> The amount of the funds requested to be withdrawn. |
{- "amount": 10000
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}