Get Investment Transactions

Get Investment Transactions

Returns investment transactions for the accounts associated with a link. Results are paginated, and returned in reverse chronological order.

Note that this endpoint does not trigger a fetch of transactions from the institution; it merely returns transactions that have already been fetched. To force a check for new/updated owner information, you must use the /products endpoint.

If you have requested prefetch or an on-demand update, you should check the refreshed_at date for this product in the returned response, and compare that against the previous refreshed_at date, which you can get from any previous response for this or any other account or link request. If the refreshed_at date has not increased, then updated data is not yet available.

URL

GET
/links/{id}/investments/transactions
Request
curl --request GET \
--url 'https://api.moneykit.com/links/[id]/investments/transactions?account_ids=SOME_ARRAY_VALUE&page=SOME_INTEGER_VALUE&size=SOME_INTEGER_VALUE&start_date=SOME_STRING_VALUE&end_date=SOME_STRING_VALUE' \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
const options = {method: 'GET', headers: {Authorization: 'Bearer REPLACE_BEARER_TOKEN'}};

fetch('https://api.moneykit.com/links/[id]/investments/transactions?account_ids=SOME_ARRAY_VALUE&page=SOME_INTEGER_VALUE&size=SOME_INTEGER_VALUE&start_date=SOME_STRING_VALUE&end_date=SOME_STRING_VALUE', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import requests

url = "https://api.moneykit.com/links/[id]/investments/transactions"

querystring = {"account_ids":"SOME_ARRAY_VALUE","page":"SOME_INTEGER_VALUE","size":"SOME_INTEGER_VALUE","start_date":"SOME_STRING_VALUE","end_date":"SOME_STRING_VALUE"}

headers = {"Authorization": "Bearer REPLACE_BEARER_TOKEN"}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
package main

import (
"fmt"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.moneykit.com/links/[id]/investments/transactions?account_ids=SOME_ARRAY_VALUE&page=SOME_INTEGER_VALUE&size=SOME_INTEGER_VALUE&start_date=SOME_STRING_VALUE&end_date=SOME_STRING_VALUE"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer REPLACE_BEARER_TOKEN")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.moneykit.com/links/[id]/investments/transactions?account_ids=SOME_ARRAY_VALUE&page=SOME_INTEGER_VALUE&size=SOME_INTEGER_VALUE&start_date=SOME_STRING_VALUE&end_date=SOME_STRING_VALUE")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer REPLACE_BEARER_TOKEN'

response = http.request(request)
puts response.read_body
import Foundation

let headers = ["Authorization": "Bearer REPLACE_BEARER_TOKEN"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.moneykit.com/links/[id]/investments/transactions?account_ids=SOME_ARRAY_VALUE&page=SOME_INTEGER_VALUE&size=SOME_INTEGER_VALUE&start_date=SOME_STRING_VALUE&end_date=SOME_STRING_VALUE")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})

dataTask.resume()
Response
{
"total": 82,
"page": 1,
"size": 50,
"investment_transactions": [
{
"investment_transaction_id": "it_R73abx78zoa2NxyAlki90g",
"account_id": "acc_6Tef269B6ZArSVpYrxtjBV",
"amount": 987.15,
"date": "2023-02-16T00:00:00",
"datetime": "2023-02-16T09:14:11",
"description": "Bought MSFT",
"type": "buy",
"fees": 5.95,
"forex_rate": string,
"price": 98.12,
"quantity": 10,
"security_id": "sec_bb6fi893jxdfNxyAjnb784"
}
],
"securities": [
{
"security_id": "sec_bb6fi893jxdfNxyAjnb784",
"name": "Microsoft",
"type": "equity",
"currency": "USD",
"ticker": "MSFT",
"isin": "US5949181045",
"sedol": string,
"close_price": 98.12,
"close_date": "2022-02-08"
}
],
"accounts": [
{
"account_id": "acc_6Tef269B6ZArSVpYrxtjBV",
"account_type": "depository.checking",
"name": "Premier Checking",
"account_mask": "3748",
"balances": {
"currency": "USD",
"available": 340.12,
"current": 445.89,
"limit": 500,
"balance_date": "2021-08-12T15:23:00Z"
},

"original_id": null,
"closed": true
}
],
"link": {
"link_id": "mk_eqkWN34UEoa2NxyALG8pcV",
"institution_id": "chase",
"institution_name": "Chase",
"institution_avatar": "https://example.com/avatar.png",
"state": "connected",
"last_synced_at": "2023-02-16T09:14:11",
"tags": [
"user_type:admin"
],
"products": {
"accounts": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11"
},
"identity": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"settings": {
"required": true,
"prefetch": false
}
}
}
}
}
{
"error_code": "api_error.auth.expired_access_token",
"error_message": "Access token expired",
"documentation_url": string
}
{
"error_code": "link_error.forbidden_action",
"error_message": "Accounts access not permitted",
"documentation_url": string
}
{
"error_code": "link_error.not_found",
"error_message": "Link not found.",
"documentation_url": string
}
{
"error_code": "link_error.deleted",
"error_message": "Link deleted.",
"documentation_url": string
}
{
"error_code": "link_error.bad_state",
"error_message": string,
"documentation_url": string,
"link_error_code": string
}
{
"error_code": "api_error.rate_limit_exceeded",
"error_message": "Rate limit exceeded",
"documentation_url": string
}

account_ids

: array

An optional list of account IDs to filter the results.

end_date

: string

The latest date for which data should be returned, formatted as YYYY-MM-DD.

format:

date

page

: integer

The page number to return.

default: 1

size

: integer

The number of items to return per page.

default: 50

start_date

: string

The earliest date for which data should be returned, formatted as YYYY-MM-DD.

format:

date

id

: string

required

The unique ID for this link.

example: mk_eqkWN34UEoa2NxyALG8pcV

Responses

200

Successful Response

total

: integer

required

The total number of results for this query.

example: 82

page

: integer

required

The page number corresponding to this batch of results.

example: 1

size

: integer

required

The number of results in this batch.

example: 50

investment_transactions

: array

required

A list of investment transactions.

securities

: array

required

A list of securities involved in these transactions.

accounts

: array

required

A list of accounts for which transactions are being returned.

401

Invalid access_token or insufficent API client scope or unauthorized link access.

403

Forbidden by link owner. The user did not give permission to access this data when linking.

error_code

: string

required

link_error.forbidden_action

default: "link_error.forbidden_action"

Allowed values:

"link_error.forbidden_action"

error_message

: string

required

Error message

example: Accounts access not permitted

documentation_url

: string

required

404

Link not found.

error_code

: string

required

link_error.not_found

default: "link_error.not_found"

Allowed values:

"link_error.not_found"

error_message

: string

required

default: "Link not found."

documentation_url

: string

required

410

Link deleted.

error_code

: string

required

link_error.deleted

default: "link_error.deleted"

Allowed values:

"link_error.deleted"

error_message

: string

required

default: "Link deleted."

documentation_url

: string

required

422

Link error.

error_code

: string

required

link_error.bad_state

default: "link_error.bad_state"

Allowed values:

"link_error.bad_state"

error_message

: string

required

documentation_url

: string

required

429

Rate limit exceeded.

error_code

: string

required

api_error.rate_limit_exceeded

default: "api_error.rate_limit_exceeded"

Allowed values:

"api_error.rate_limit_exceeded"

error_message

: string

required

Error message

default: "Rate limit exceeded"

documentation_url

: string

required