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


POST
Get a new token: By company name, login and password

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"  
}
                
            


GET
Get a new token: By company name, login and password

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


GET
Get a new rate

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"
}
                        
            


POST
Get a new rate

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"
}
                        
            



GET
Book a Trade : By client id and buy amount

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"
}

                
            


GET
Book a Trade : By client id and sell amount

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"
}

                
            



GET
Book a Trade : By quote id and buy amount

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"
}

                
            


GET
Book a Trade : By quote id and sell amount

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"
}

                
            



POST
Get a new rate : by RateValidFor and CCYDetails

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"
    }
]
                        
            



GET
Cancel Trade : By ExecID

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


POST
Get TaxID: Retrieve information regarding the TaxID by currency

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"
}
                        
            



POST
FileTransfer: Post a json data for trade and delivery instructions (disclaimer this is custom message)

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"
}
                        
            



GET
Get FileTransferCurrencyRules: Delivery Instructions Rules by Currency Code and Country Code

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"
}
                        
            



POST
File Transfer By ExecId:

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


GET
Trade Status: Get Booked Trade Status

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"
}
                
            



GET
Get Payment Status : By TradeNumber/ExecID/Client Reference Number

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"
}
                        
            


GET
Get PostSettlement Status : By TradeNumber/ExecID/Client Reference Number

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"
}
                        
            


GET
Get PreSettlement Status : By TradeNumber/ExecID/Client Reference Number

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"
}
                        
            


GET
Get Reversal Status : By ExecID

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
}
                        
            


GET
Get TradeConfirmation Status : By Date (YYYYMMDD)

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"
}
                        
            


POST
Get Multiple Trade Status: By ExecID

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"
    }
]
                        
            


GET
FileTransferStatus: Getting the FileTransferStatus based on the response from FileTransfer

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"
}