Transaction Endpoints


Request

Name Located In Type Description
Authorization header string The authorization bearer token previously obtained by the client [required]
Accept-Datetime-Format header AcceptDatetimeFormat Format of DateTime fields in the request and response.
accountID path AccountID Account Identifier [required]
from query DateTime The starting time (inclusive) of the time range for the Transactions being queried. [default=Account Creation Time]
to query DateTime The ending time (inclusive) of the time range for the Transactions being queried. [default=Request Time]
pageSize query integer The number of Transactions to include in each page of the results. [default=100, maximum=1000]
type query List of TransactionFilter (csv) A filter for restricting the types of Transactions to retrieve.

Responses

Response Headers

  • RequestID - The unique identifier generated for the request
Response Body Schema (application/json)

{
    # 
    # The starting time provided in the request.
    # 
    from : (DateTime),

    # 
    # The ending time provided in the request.
    # 
    to : (DateTime),

    # 
    # The pageSize provided in the request
    # 
    pageSize : (integer),

    # 
    # The Transaction-type filter provided in the request
    # 
    type : (Array[TransactionFilter]),

    # 
    # The number of Transactions that are contained in the pages returned
    # 
    count : (integer),

    # 
    # The list of URLs that represent idrange queries providing the data for
    # each page in the query results
    # 
    pages : (Array[string]),

    # 
    # The ID of the most recent Transaction created for the Account
    # 
    lastTransactionID : (TransactionID)
}

Other Error Responses: 400, 401, 403, 404, 405, 416

Examples

Request
curl \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TOKEN>" \
  "<URL>/v3/accounts/<ACCOUNT>/transactions?to=2016-06-22T18%3A41%3A52.660593788Z&from=2016-06-22T18%3A41%3A52.655959799Z"
Response Headers
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type, Accept-Datetime-Format
Content-Encoding: gzip
Transfer-Encoding: chunked
Server: openresty/1.7.0.1
Connection: keep-alive
Date: Wed, 22 Jun 2016 18:41:52 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: PUT, PATCH, POST, GET, OPTIONS, DELETE
Content-Type: application/json
Response Body
{
  "count": 4, 
  "from": "2016-06-22T18:41:52.655959799Z", 
  "lastTransactionID": "6412", 
  "pageSize": 100, 
  "pages": [
    "<URL>/v3/accounts/<ACCOUNT>/transactions/idrange?from=6409&to=6412"
  ], 
  "to": "2016-06-22T18:41:52.660593788Z"
}

Request

Name Located In Type Description
Authorization header string The authorization bearer token previously obtained by the client [required]
Accept-Datetime-Format header AcceptDatetimeFormat Format of DateTime fields in the request and response.
accountID path AccountID Account Identifier [required]
transactionID path TransactionID A Transaction ID [required]

Responses

Response Headers

  • RequestID - The unique identifier generated for the request
Response Body Schema (application/json)

{
    # 
    # The details of the Transaction requested
    # 
    transaction : (Transaction),

    # 
    # The ID of the most recent Transaction created for the Account
    # 
    lastTransactionID : (TransactionID)
}

Other Error Responses: 401, 404, 405

Examples

Request
curl \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TOKEN>" \
  "<URL>/v3/accounts/<ACCOUNT>/transactions/6410"
Response Headers
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type, Accept-Datetime-Format
Content-Encoding: gzip
Transfer-Encoding: chunked
Server: openresty/1.7.0.1
Connection: keep-alive
Date: Wed, 22 Jun 2016 18:41:52 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: PUT, PATCH, POST, GET, OPTIONS, DELETE
Content-Type: application/json
Response Body
{
  "lastTransactionID": "6412", 
  "transaction": {
    "accountBalance": "43650.51319", 
    "accountID": "<ACCOUNT>", 
    "batchID": "6409", 
    "financing": "0.00000", 
    "id": "6410", 
    "instrument": "EUR_USD", 
    "orderID": "6409", 
    "pl": "0.00000", 
    "price": "1.13031", 
    "reason": "MARKET_ORDER", 
    "time": "2016-06-22T18:41:52.655959799Z", 
    "tradeOpened": {
      "tradeID": "6410", 
      "units": "100"
    }, 
    "type": "ORDER_FILL", 
    "units": "100", 
    "userID": <USERID>
  }
}

Request

Name Located In Type Description
Authorization header string The authorization bearer token previously obtained by the client [required]
Accept-Datetime-Format header AcceptDatetimeFormat Format of DateTime fields in the request and response.
accountID path AccountID Account Identifier [required]
from query TransactionID The starting Transaction ID (inclusive) to fetch. [required]
to query TransactionID The ending Transaction ID (inclusive) to fetch. [required]
type query List of TransactionFilter (csv) The filter that restricts the types of Transactions to retrieve.

Responses

Response Headers

  • RequestID - The unique identifier generated for the request
Response Body Schema (application/json)

{
    # 
    # The list of Transactions that satisfy the request.
    # 
    transactions : (Array[Transaction]),

    # 
    # The ID of the most recent Transaction created for the Account
    # 
    lastTransactionID : (TransactionID)
}

Other Error Responses: 400, 401, 404, 405, 416

Examples

Request
curl \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TOKEN>" \
  "<URL>/v3/accounts/<ACCOUNT>/transactions/idrange?to=6412&from=6409"
Response Headers
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type, Accept-Datetime-Format
Content-Encoding: gzip
Transfer-Encoding: chunked
Server: openresty/1.7.0.1
Connection: keep-alive
Date: Wed, 22 Jun 2016 18:41:52 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: PUT, PATCH, POST, GET, OPTIONS, DELETE
Content-Type: application/json
Response Body
{
  "lastTransactionID": "6412", 
  "transactions": [
    {
      "accountID": "<ACCOUNT>", 
      "batchID": "6409", 
      "id": "6409", 
      "instrument": "EUR_USD", 
      "positionFill": "DEFAULT", 
      "reason": "CLIENT_ORDER", 
      "time": "2016-06-22T18:41:52.655959799Z", 
      "timeInForce": "FOK", 
      "type": "MARKET_ORDER", 
      "units": "100", 
      "userID": <USERID>
    }, 
    {
      "accountBalance": "43650.51319", 
      "accountID": "<ACCOUNT>", 
      "batchID": "6409", 
      "financing": "0.00000", 
      "id": "6410", 
      "instrument": "EUR_USD", 
      "orderID": "6409", 
      "pl": "0.00000", 
      "price": "1.13031", 
      "reason": "MARKET_ORDER", 
      "time": "2016-06-22T18:41:52.655959799Z", 
      "tradeOpened": {
        "tradeID": "6410", 
        "units": "100"
      }, 
      "type": "ORDER_FILL", 
      "units": "100", 
      "userID": <USERID>
    }, 
    {
      "accountID": "<ACCOUNT>", 
      "batchID": "6411", 
      "id": "6411", 
      "instrument": "USD_CAD", 
      "positionFill": "DEFAULT", 
      "reason": "CLIENT_ORDER", 
      "time": "2016-06-22T18:41:52.660593788Z", 
      "timeInForce": "FOK", 
      "type": "MARKET_ORDER", 
      "units": "500", 
      "userID": <USERID>
    }, 
    {
      "accountBalance": "43650.51319", 
      "accountID": "<ACCOUNT>", 
      "batchID": "6411", 
      "financing": "0.00000", 
      "id": "6412", 
      "instrument": "USD_CAD", 
      "orderID": "6411", 
      "pl": "0.00000", 
      "price": "1.28260", 
      "reason": "MARKET_ORDER", 
      "time": "2016-06-22T18:41:52.660593788Z", 
      "tradeOpened": {
        "tradeID": "6412", 
        "units": "500"
      }, 
      "type": "ORDER_FILL", 
      "units": "500", 
      "userID": <USERID>
    }
  ]
}

Request

Name Located In Type Description
Authorization header string The authorization bearer token previously obtained by the client [required]
Accept-Datetime-Format header AcceptDatetimeFormat Format of DateTime fields in the request and response.
accountID path AccountID Account Identifier [required]
id query TransactionID The ID of the last Transaction fetched. This query will return all Transactions newer than the TransactionID. [required]
type query List of TransactionFilter (csv) A filter for restricting the types of Transactions to retrieve.

Responses

Response Headers

  • RequestID - The unique identifier generated for the request
Response Body Schema (application/json)

{
    # 
    # The list of Transactions that satisfy the request.
    # 
    transactions : (Array[Transaction]),

    # 
    # The ID of the most recent Transaction created for the Account
    # 
    lastTransactionID : (TransactionID)
}

Other Error Responses: 400, 401, 404, 405, 416

Examples

Request
curl \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TOKEN>" \
  "<URL>/v3/accounts/<ACCOUNT>/transactions/sinceid?id=6411"
Response Headers
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type, Accept-Datetime-Format
Content-Encoding: gzip
Transfer-Encoding: chunked
Server: openresty/1.7.0.1
Connection: keep-alive
Date: Wed, 22 Jun 2016 18:41:52 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: PUT, PATCH, POST, GET, OPTIONS, DELETE
Content-Type: application/json
Response Body
{
  "lastTransactionID": "6412", 
  "transactions": [
    {
      "accountBalance": "43650.51319", 
      "accountID": "<ACCOUNT>", 
      "batchID": "6411", 
      "financing": "0.00000", 
      "id": "6412", 
      "instrument": "USD_CAD", 
      "orderID": "6411", 
      "pl": "0.00000", 
      "price": "1.28260", 
      "reason": "MARKET_ORDER", 
      "time": "2016-06-22T18:41:52.660593788Z", 
      "tradeOpened": {
        "tradeID": "6412", 
        "units": "500"
      }, 
      "type": "ORDER_FILL", 
      "units": "500", 
      "userID": <USERID>
    }
  ]
}

Request

Name Located In Type Description
Authorization header string The authorization bearer token previously obtained by the client [required]
accountID path AccountID Account Identifier [required]

Responses

Response Body Schema (application/octet-stream)

The response body for the Transaction Stream uses chunked transfer encoding. Each chunk contains Transaction and/or TransactionHeartbeat objects encoded as JSON. Each JSON object is serialized into a single line of text, and multiple objects found in the same chunk are separated by newlines. TransactionHeartbeats are sent every 5 seconds.

The specification for the objects found in response stream are as follows:

Other Error Responses: 400, 401, 404, 405

Examples

Request
curl \
  -H "Authorization: Bearer <TOKEN>" \
  "<STREAM_URL>/v3/accounts/<ACCOUNT>/transactions/stream"
Response Headers
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type, Accept-Datetime-Format, OANDA-Agent
Access-Control-Allow-Methods: PUT, PATCH, POST, GET, OPTIONS, DELETE
Access-Control-Allow-Origin: *
Content-Type: application/octet-stream
Response Body
{"lastTransactionID":"776","time":"2016-09-20T18:18:19.335449554Z","type":"HEARTBEAT"}
{"accountID":"101-002-1179508-001","batchID":"777","id":"777","instrument":"EUR_USD","positionFill":"DEFAULT","reason":"CLIENT_ORDER","time":"2016-09-20T18:18:22.126490230Z","timeInForce":"FOK","type":"MARKET_ORDER","units":"100","userID":1179508}
{"accountBalance":"6505973.49885","accountID":"<ACCOUNT>","batchID":"777","financing":"0.00000","id":"778","instrument":"EUR_USD","orderID":"777","pl":"0.00000","price":"1.11625","reason":"MARKET_ORDER","time":"2016-09-20T18:18:22.126490230Z","tradeOpened":{"tradeID":"778","units":"100"},"type":"ORDER_FILL","units":"100","userID":1179508}
{"lastTransactionID":"778","time":"2016-09-20T18:18:24.335560658Z","type":"HEARTBEAT"}