FXConnect Restful API User Guide
FXConnect API
StoneX’s RESTful web services API, FX Connect, provides clients, simple, reliable and fault tolerant mechanism to get FX prices and execute trades in real-time
Requests and Responses
All requests to the FX Connect API are made over HTTPS. HTTPS requests must be made using the TLS 1.2 protocol (older clients may default to SSLv2 and older versions). All API calls must include a content-type and an authorization token in the header. The authorization token is a unique ID assigned to your FX Connect account. This token ensures that any requests are performed against data in your account.
All API calls must include the following in the header:
Key | Value |
---|---|
Content-Type | Application/JSON |
Authorization | Bearer[valid token] |
Connectivity Endpoints
Method : HTTP Post
Request Data : Form Submit
Response Data : json/xml
End Point Url Address :api/PostFXToken
Parameter | Type | Required | Description |
---|---|---|---|
CompanyName | String | Yes | Login company name registered via FXecute web site. |
Username | String | Yes | Login registered via FXecute web site. |
Password | String | Yes | Login password registered via FXecute web site. |
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi.....",
"expires_in": Universal date ex: 2017-05-06T20:00:58Z,
"token_type": "bearer"
}
Method : HTTP Get
Request Data : Passing company, login and password as part of the url route
Response Data : json
End Point Url Address : api/GetFXToken/<companyName>/<loginName>/<password>
Parameter | Type | Required | Description |
---|---|---|---|
CompanyName | String | Yes | Login company name registered via FXecute web site. |
Username | String | Yes | Login registered via FXecute web site. |
Password | String | Yes | Login password registered via FXecute web site. |
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi.....",
"expires_in": Universal date ex: 2017-05-06T20:00:58Z,
"token_type": "bearer"
}
Rate and Trade Execution Endpoints
Method : HTTP Get
Request Data : QueryString
Response Data : json
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/GetRate?<QueryString....>
Parameter | Type | Required | Description |
---|---|---|---|
CcyPair | String | Yes | Currency pair for single quote request. E.g. USDINR |
ClientId | String | Yes | Unique value generated by the client that can be used to book subsequent trades on successful return of a quote, up to 16 alpha-numeric characters. |
BuyCcy | String | Yes | 3 Digit ISO Currency code. E.g. USD |
SellCcy | String | Yes | 3 Digit ISO Currency code. E.g. USD |
BuyAmt | Number | No | Buy amount. E.g. 1000.00 |
SellAmt | Number | No | Sell amount. E.g. 1000.00 |
ClientGroupId | String | No | Optional field in order to determine applied margin for customer/segment of SFL client |
{
"CcyPair":"currency value pair",
"ClientId":"supplied client id",
"QuoteId":SFL id,
"BuyCcy":"buy currency",
"SellCcy":"sell currency",
"TimeStamp":"time of given rate",
"ExpireTime":"given rate expired time",
"ValueDate":"value date",
"Rate":deal rate,
"ClientGroupId":"optional id",
"IsExpired":expiry flag,
"RejectText":"reject message, if get rate response fails and blank if successful"
}
Method : HTTP Post
Request Data : Form Submit
Response Data : json/xml
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/GetRate
Parameter | Type | Required | Description |
---|---|---|---|
CcyPair | String | Yes | Currency pair for single quote request. E.g. USDINR |
ClientId | String | Yes | Unique value generated by the client that can be used to book subsequent trades on successful return of a quote, up to 16 alpha-numeric characters. |
BuyCcy | String | Yes | 3 Digit ISO Currency code. E.g. USD |
SellCcy | String | Yes | 3 Digit ISO Currency code. E.g. USD |
BuyAmt | Number | No | Buy amount. E.g. 1000.00 |
SellAmt | Number | No | Sell amount. E.g. 1000.00 |
ClientGroupId | String | No | Optional field in order to determine applied margin for customer/segment of SFL client |
{
"CcyPair":"currency value pair",
"ClientId":"supplied client id",
"QuoteId":SFL id,
"BuyCcy":"buy currency",
"SellCcy":"sell currency",
"TimeStamp":"time of given rate",
"ExpireTime":"given rate expired time",
"ValueDate":"value date",
"Rate":deal rate,
"ClientGroupId":"optional id",
"IsExpired":expiry flag,
"RejectText":"reject message, if get rate response fails and blank if successful"
}
Method : HTTP Get
Request Data : Passing client id and buy amount as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/BookingBuyWithClientId/<client id>/<buy amount>/
Parameter | Type | Required | Description |
---|---|---|---|
ClientId | String | Yes | Unique client ID, up to 16 alpha-numeric characters. |
BuyAmt | Number | Yes | Buy amount |
{
"ExecId":FX execution id,
"ClientId":"supplied client id",
"BuyCcy":"buy currency",
"SellCcy":"sell currency",
"CcyPair":"currency value pair",
"DealStatus":Booked trade status,
"Rate":deal rate,
"BuyAmt":buy amount,
"SellAmt":sell amount,
"ValueDate":"value date",
"RejectText":"reject message, if trade booking fails and blank if successful"
}
Method : HTTP Get
Request Data : Passing client id and sell amount as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/BookingSellWithClientId/<client id>/<sell amount>/
Parameter | Type | Required | Description |
---|---|---|---|
ClientId | String | Yes | Unique client ID, up to 16 alpha-numeric characters. |
SellAmt | Number | Yes | Sell amount |
{
"ExecId":FX execution id,
"ClientId":"supplied client id",
"BuyCcy":"buy currency",
"SellCcy":"sell currency",
"CcyPair":"currency value pair",
"DealStatus":Booked trade status,
"Rate":deal rate,
"BuyAmt":buy amount,
"SellAmt":sell amount,
"ValueDate":"value date",
"RejectText":"reject message, if trade booking fails and blank if successful"
}
Method : HTTP Get
Request Data : Passing quote id and buy amount as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/BookingBuyWithQuoteId/<quote id>/<buy amount>/
Parameter | Type | Required | Description |
---|---|---|---|
QuoteId | String | Yes | Unique quote ID, generated by SFL, up to 16 alpha-numeric characters. |
BuyAmt | Number | Yes | Buy amount |
{
"ExecId":FX execution id,
"ClientId":"supplied client id",
"BuyCcy":"buy currency",
"SellCcy":"sell currency",
"CcyPair":"currency value pair",
"DealStatus":Booked trade status,
"Rate":deal rate,
"BuyAmt":buy amount,
"SellAmt":sell amount,
"ValueDate":"value date",
"RejectText":"reject message, if trade booking fails and blank if successful"
}
Method : HTTP Get
Request Data : Passing quote id and sell amount as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/BookingSellWithQuoteId/<quote id>/<sell amount>/
Parameter | Type | Required | Description |
---|---|---|---|
quoteId | String | Yes | Unique quote ID, generated by SFL, up to 16 alpha-numeric characters. |
SellAmt | Number | Yes | Sell amount |
{
"ExecId":FX execution id,
"ClientId":"supplied client id",
"BuyCcy":"buy currency",
"SellCcy":"sell currency",
"CcyPair":"currency value pair",
"DealStatus":Booked trade status,
"Rate":deal rate,
"BuyAmt":buy amount,
"SellAmt":sell amount,
"ValueDate":"value date",
"RejectText":"reject message, if trade booking fails and blank if successful"
}
Method : HTTP Post
Request Data : Form submit RequestBody: RateValidFor: , CCYDetails:[{CcyPair:,ClientId:,BuyCcy:,SellCcy:}]
Response Data : json
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/GetMRate RequestBody: RateValidFor: , CCYDetails:[{CcyPair:,ClientId:,BuyCcy:,SellCcy:}]
Parameter | Type | Required | Description |
---|---|---|---|
RateValidFor | int | Yes | Rate validity in minutes |
CcyPair | String | Yes | Currency pair for single quote request. E.g. USDINR |
ClientId | String | Yes | Unique value generated by the client that can be used to book subsequent trades on successful return of a quote, up to 16 alpha-numeric characters. |
BuyCcy | String | Yes | 3 Digit ISO Currency code. E.g. USD |
SellCcy | String | Yes | 3 Digit ISO Currency code. E.g. USD |
[
{
"CcyPair": "Currency value Pair",
"ClientId": "ClientId",
"QuoteId": "RateQuoteId",
"BuyCcy": "BuyCurrency",
"SellCcy": "SellCurrency",
"TimeStamp": "TimeStamp of response returned",
"ExpireTime": "Expiry Timestamp",
"ValueDate": "Value Date",
"Rate":"Rate Value",
"ClientGroupId": "Client GroupId value",
"IsExpired": "Expiry Flag",
"RejectText": "Reason for rejection of request"
}
]
Method : HTTP Get
Request Data : QueryString
Response Data : jsonJson
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/CancelTrade/<ExecId>/
Parameter | Type | Required | Description |
---|---|---|---|
ExecId | Integer | Yes | SFL generated id, given back to client, when getting a successful trade response |
{
"Message":"Error Code : Message"
}
Delivery Instructions Endpoints
Method : HTTP Post
Request Data : Json { "Currency" : "", "TaXID" : "" }
Response Data : json
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/GetTaxID
Parameter | Type | Required | Description |
---|---|---|---|
CurrencyCode | String | Yes | Currency, this should be only 3 characters, for now supporting only BRL |
TaXID | String | Yes | TaxID, no special characters |
{
"Message": "XXXXXXXXXXX - BRL Cadastro Complete"
}
Method : HTTP Post
Request Data : json
Response Data : json
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/FileTransfer
Parameter | Type | Required | Description |
---|---|---|---|
Custom message by Customer | Json | Yes | Defined json by customer. |
{
"tempID": "97b0a873-.........",
"message": "Success",
"Errors": "Specify if there is an error while receiving the file"
}
Method : HTTP Get
Request Data : Passing currency code and countrycode as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXCommon/FileTransferCurrencyRules/<currencyCode>/<countryCode>
Parameter | Type | Required | Description |
---|---|---|---|
CurrencyCode | String | Yes | Valid and Supported Currency Code |
CountryCode | String | Yes | Valid and Supported Country Code |
{
"CurrencyName":"Currency Name",
"CountryName":"Country Name",
"DelInstructions":"List of delivery instruction. (IsOptional, LabelName, MinLength, MaxLength, FieldType)",
"RejectText":"reject message, if failure happened"
}
Method : HTTP Post
Request Data : json
Response Data : json
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/FileTransferByExecID/<currencyCode>/<countryCode>
Parameter | Type | Required | Description |
---|---|---|---|
Custom message by Customer | Json | Yes | Defined json based on CCY specific Delivery Instruction requirements. |
Request Data Sample : json
{
"ExecId": execID,
"Currency": "currency",
"Amount": amount,
"Country": "country code",
"ClientAddress": "Ordering Customer Address",
"ClientIban": "CR12345678901234567890",
"ClientName": "Ordering Customer Name",
"UniqueId": "ABC008",
"DeliveryInstructions": {
"Beneficiary Account Name": "Beneficiary Account Name",
"Beneficiary Account Number": "01234000000",
"Beneficiary Bank Name": "Beneficiary Bank Name",
"Beneficiary Bank Address": "Beneficiary Bank Address",
"Beneficiary Street Address": "Street Address, City, Country",
"Purpose of Payment": "Purpose of Payment Test Purpose of Payment Test 2",
"Kenya Bank Branch Code": "51106"
}
}
Response Data Sample : json
{
"tempID": "97b0a873-.........",
"message": "Success",
"Errors": "Specify if there is an error while receiving the file"
}
Status Endpoints
Method : HTTP Get
Request Data : Passing Exec Id from TradeBooking Response
Response Data : Json
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/TradeStatus/<ExecId>
Parameter | Type | Required | Description |
---|---|---|---|
ExecId | Integer | Yes | SFL generated id, given back to client, when getting a successful trade response. |
{
"DealStatus":"current booked trade status"
}
Method : HTTP Get
Request Data : Passing ExecId as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/PaymentStatus/<ExecId>
Parameter | Type | Required | Description |
---|---|---|---|
ExecId | Integer | Yes | SFL generated id, given back to client, when getting a successful payment status response |
{
"ExecId":"Provided input ExecId",
"PaymentStatus":"current payment status of execId",
"Error":"Error value if there is any"
}
Method : HTTP Get
Request Data : Passing ExecId as part of the url route
Response Data : json/xml
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/PostSettlement/<ExecId>
Parameter | Type | Required | Description |
---|---|---|---|
ExecId | Integer | Yes | SFL generated id, given back to client, when getting a successful payment status response |
{
"ExecId":"Provided input ExecId",
"PaymentStatus":"current payment status of execId",
"Error":"Error value if there is any"
}
Method : HTTP Get
Request Data : Passing ExecId as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/PreSettlement/<ExecId>
Parameter | Type | Required | Description |
---|---|---|---|
ExecId | Integer | Yes | SFL generated id, given back to client, when getting a successful payment status response |
{
"ExecId":"Provided input ExecId",
"PaymentStatus":"current payment status of execId",
"Error":"Error value if there is any"
}
Method : HTTP Get
Request Data : Passing ExecId as part of the url route
Response Data : json/xml
End Point Url Address :https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/GetReversalStatus/<ExecId>
Parameter | Type | Required | Description |
---|---|---|---|
ExecId | Integer | Yes | SFL generated id, given back to client, when getting a successful payment status response |
{
"ReversalFXID": ExecID of the reverse transaction,
"OriginalFXID": ExecID or the original transaction,
"ReversalTradeStatus": status of the reversal,
"TransactionDateTime": time of the transaction of the reversal,
"ReversalReferenceID": internal reference id of the reversal,
"SettlementDate": settlement date for the reversal,
"IFLBuySell": side of the reversal,
"CCy1": trading amount currency,
"CCy1Amount": trading currency,
"ReversalTradePrice":rate,
"CCy2": trading currency with respect to currency 1,
"CCy2Amount":trading amount with respect to currency 2
}
Method : HTTP Get
Request Data : Passing Date as the following format YYYYMMDD
Response Data : json
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/GetTradeConfirmationReport/<Date> YYYYMMDD
Parameter | Type | Required | Description |
---|---|---|---|
Date | Integer | Yes | Date Format as the following (YYYYMMDD) for example for Jan 20th 2021, 20210120 |
{
"TradeNumber": internal trade number,
"TransactionDateTime": date of the transaction,
"ExternalReferenceID": ExecID return by the api,
"SettlementDate": settlement date ,
"IFLBuySell": "S or B",
"CCy1": Trading currency,
"CCy1Amount": trading amount,
"TradePrice": rate
"CCy2": Trading Currency with respect to Currency 1,
"CCy2Amount": Trading Amount with respect to Currency 1,
"ClientOrderID": client internal reference,
"FocusStatus": "Status of the payment"
}
Method : HTTP Post
Request Data : Json {Fxids : 000000,00001,00002}
Response Data : json
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/MultipleTradeStatus
Parameter | Type | Required | Description |
---|---|---|---|
List of ExecId | Integer | Yes | SFL generated id, given back to client, when getting a successful payment status response |
[
{
"TradeNumber": internal trade number,
"TransactionDateTime": date of the transaction,
"ExternalReferenceID": ExecID return by the api,
"SettlementDate": settlement date ,
"IFLBuySell": "S or B",
"CCy1": Trading currency,
"CCy1Amount": trading amount,
"TradePrice": rate,
"CCy2": Trading Currency with respect to Currency 1,
"CCy2Amount": Trading Amount with respect to Currency 1,
"ClientOrderID": client internal reference,
"FocusStatus": "Status of the payment"
}
]
Method : HTTP Get
Request Data : QueryString
Response Data : json
End Point Url Address : https://fxconnect.demo.stonex.com/IFLFXAPI/FXQuote/FileTransferStatus
Parameter | Type | Required | Description |
---|---|---|---|
TempID | String | Yes | TempID generated by FileTransfer Endpoint when user send file through FileTransfer Endpoint. |
{
"FXID": Unique identifier representing the trade booking execution id,
"ValueDate": Settlement date given to trade that is booked in the system,
"TempID": "TempID generated by FileTransfer Endpoint when user send file through FileTransfer Endpoint",
"FileValidationStatus": "complete, in progress or rejected",
"TradeValidationStatus": "Result of Validation. Accepted, Repair or Rejection",
"ErrorMessages" : "Error messages of Validation"
}