FX Trade Execution API
Introduction
The FX Trade Execution API is a secure and efficient service that enables authorized users to execute trades in the financial markets. It allows trades to be performed by specifying parameters such as currencies, amounts, and maturity options, ensuring accurate and seamless currency exchange and FX transactions
Use Cases and Features
- Facilitate efficient execution of foreign exchange (FX) trades
- Support trades with configurable options such as currencies, amounts, and maturity settings
- Allow handling of both buy and sell operations across multiple currency pairs
- Flexibility to define trade maturity by date or tenor
- Provide optional fields like comments for additional trade context
- Deliver detailed responses with precise trade execution data
- Ensure secure access and authentication for trade execution
Markets
This API is designed to support global trading activities, allowing users to execute trades across various currencies and markets, particularly for currency trading and foreign exchange (FX) transactions.
Getting Started
To begin using the FX Trade Execution API, you must complete the onboarding process through the External API Platform. Once successfully onboarded, you will gain access to all Premium APIs provided by Danske Bank.
For detailed onboarding instructions, please visit the Danske Bank Open Banking Developer Portal
Environment Description
As described in the External API Platform onboarding guidelines, the FX Trade Execution API will be available in two environments:
-
Sandbox: This environment is designed for initial integration tests and will provide mocked data. Users can execute trades with simulated parameters, allowing for the exploration of various functionalities without impacting real transactions.
-
Production: This environment provides access to real trade execution capabilities. Users can execute actual trades based on the parameters specified in their requests, with results reflecting the live trading environment.
Sandbox URLs
Token Endpoint: https://sandbox-api.danskebank.com/sandbox-corporate/api/dk/business/oauth2/token
FX Trade Execution API: https://sandbox-api.danskebank.com/sandbox-corporate/api/v1/trade-service
Production URLs
Token Endpoint: https://api.danskebank.com/corporate/api/dk/business/oauth2/token
FX Trade Execution API: https://api.danskebank.com/corporate/api/v1/trade-service
Authentication
To access a resource, the client must first request a Client Credentials Grant token by calling the token endpoint specified in the OpenId configuration (token_endpoint). The request should be an x-www-form-urlencoded POST with the following parameters:
- grant_type - client_credentials (read more).
- scope - should include a scope the client has access to; for the FX Trade Execution API, it MUST contain the "accounts" keyword (read more).
- client_id - the ID received after onboarding (read more).
Example Request:
curl --location --request POST 'https://example.com/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=1233456' \
--data-urlencode 'scope=accounts'
Example Response:
{
"token_type": "Bearer",
"access_token": "A****",
"metadata": "m:",
"expires_in": 3600,
"consented_on": 1588933990,
"scope": "accounts"
}
Using the Access Token:
The access_token received is valid for 1 hour and must be included in the request header on all subsequent API requests:
Authorization: Bearer <access_token>
Supported Endpoints
FX Trade Execution API includes the following endpoint to interact with:
| Endpoint | Method | Description |
|---|---|---|
| /trade-execution/execute | POST | Executes a trade based on provided parameters |
Implementation Details
Request parameters
POST /trade-execution/execute
Executes a trade based on provided parameters.
| Parameter | Required | Description | Validations |
|---|---|---|---|
| counterpart | Yes | Counterpart identifier. | Must be a valid string |
| buyCurrency | Yes | Currency to buy | Must be valid currency code (e.g. |
| sellCurrency | Yes | Currency to sell | Must be valid currency code (e.g. |
| amount | Yes | Trade amount | Must be a positive number |
| amountSide | Yes | Side of the amount (BUY or SELL). | Must be either 'BUY' or 'SELL'. |
| baseSide | Yes | Side of the amount (BUY or SELL). | Must be either 'BUY' or 'SELL'. |
| maturityDate | No* | Maturity date of the trade. | Must be in a valid date format (YYYY-MM-DD). |
| tenor | No* | length of time between the value date (or spot date) and the expiration date of a foreign exchange contract. | Must be valid ENUM constant |
| comment | No | Additional comments | Must be a valid string. |
| shortName | No | Short name | Must be a valid string. |
*Note: Either maturityDate or tenor must be provided. If both are given, maturityDate takes precedence.
Example Request
Trade Execution cURL request:
curl -X POST 'https://api.danskebank.com/corporate/api/v1/trade-service/trade-execution/execute' \
-H "Authorization: Bearer {accessToken}" \
-d '{
"counterpart": "DBDEMO1",
"buyCurrency": "DKK",
"sellCurrency": "EUR",
"amount": 1000000,
"amountSide": "BUY",
"baseSide": "SELL",
"maturityDate": "2026-08-31",
"tenor": "1W",
"comment": "Urgent client request"
}'
Response Parameters
POST /trade-execution/execute
Returns a paginated list of historical trades.
Response parameters:
| Parameter | Description |
|---|---|
| tradeId | Unique identifier of the trade. |
| executionId | Unique identifier for the execution. |
| counterpart | Counterpart identifier for the trade. |
| bought | Amount bought (includes currency and amount). |
| sold | Amount sold (includes currency and amount). |
| maturityDate | Maturity date of the trade. |
| product | Type of the FX Trade (Spot |
| tradeTime | Date and time when the trade was executed. |
| spotPrice | Spot price at the time of execution. |
| forwardPrice | Forward price at the time of execution. |
| allInPrice | Total price including fees. |
| autoSettle | Indicates if the trade will auto-settle. |
| comment | Any additional comments related to the trade. |
Response body:
{
"tradeId": "string",
"executionId": "string",
"counterpart": "string",
"bought": {
"currency": "EUR",
"amount": 100000.1
},
"sold": {
"currency": "EUR",
"amount": 100000.1
},
"maturityDate": "2025-10-07",
"product": "string",
"tradeTime": "2025-10-07T10:28:30.946Z",
"spotPrice": 0.1,
"forwardPrice": 0.1,
"allInPrice": 0.1,
"autoSettle": true,
"comment": "string"
}
Error Response
FX Trade execution API uses standardized HTTP status codes to indicate the success or failure of API requests. Below is a summary of the error codes you may encounter:
| Error Code | Description | Resolution Steps |
|---|---|---|
| 200 OK | The request was successful. | No action needed. |
| 400 Bad Request | The request could not be understood or was missing required parameters. | Check the request syntax and ensure all required parameters are included. |
| 401 Unauthorized | Authentication credentials were missing or incorrect. | Verify that authentication credentials are correct and included in the request. |
| 403 Forbidden | "The request was understood | but it has been refused or access is not allowed." |
| 404 Not | The requested resource could not be found. | Verify the resource URL and ensure that the resource exists. |
| 500 Internal Error | An error occurred on the server. | Try the request again later and contact support if the issue persists. |
Error Response Structure:
{
"error": {
"exception": "ExceptionType",
"message": "Detailed error message",
"timestamp": "2025-06-23T08:10:38Z"
}
}
Pricing
During the pilot phase, the API will be offered at no cost to selected customers. Final pricing details will be announced at a later date.
Architectural constraints
- State
- Active
Technical constraints
- Static URL
- /premium-apis/fx-trade-execution-api
- Environment(s)
- PROD, SANDBOX
Is this helpful?