Get User Accounts

Get User Accounts

Fetches all accounts belonging to a user.

URL

GET
/users/{id}/accounts
Request
curl --request GET \
--url 'https://api.moneykit.com/users/MyUser1234/accounts?account_ids=SOME_ARRAY_VALUE&institution_ids=SOME_ARRAY_VALUE' \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
const options = {method: 'GET', headers: {Authorization: 'Bearer REPLACE_BEARER_TOKEN'}};

fetch('https://api.moneykit.com/users/MyUser1234/accounts?account_ids=SOME_ARRAY_VALUE&institution_ids=SOME_ARRAY_VALUE', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import requests

url = "https://api.moneykit.com/users/MyUser1234/accounts"

querystring = {"account_ids":"SOME_ARRAY_VALUE","institution_ids":"SOME_ARRAY_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/users/MyUser1234/accounts?account_ids=SOME_ARRAY_VALUE&institution_ids=SOME_ARRAY_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/users/MyUser1234/accounts?account_ids=SOME_ARRAY_VALUE&institution_ids=SOME_ARRAY_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/users/MyUser1234/accounts?account_ids=SOME_ARRAY_VALUE&institution_ids=SOME_ARRAY_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
{
"links": {
"additionalProp": {
"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"
}
}
],
"last_synced_at": "2023-02-16T09:14:11"
}
}
}
{
"error_code": "api_error.auth.expired_access_token",
"error_message": "Access token expired",
"documentation_url": string
}

account_ids

: array

If present, filters results to accounts matching the given IDs.

min length:

1

institution_ids

: array

If present, filters results to accounts at institutions matching the given IDs.

min length:

1

id

: string

required

The unique ID for this user. This is the same ID provided in the call to /link-session to create any link for this user.

example: MyUser1234

Responses

200

Successful Response

401

Invalid access_token or insufficent API client scope.