Import Link

Import Link

Creates a new link with pre-populated accounts and transactions. The new link will be created in an initially disconnected state, with an error code of auth_expired, but all data will be available. As with any disconnected link, the imported link can then be reconnected at any time by starting a new /link-session with existing_link_id set to the link's link_id. Note that the link can be reconnected using any suitable provider.

The imported data has a maximum size limit of 1MB, which corresponds very roughly to about 4000 transactions. The data is processed synchronously, so you can expect a delay of up to 10 seconds before the response is transmitted. You should set generous HTTP read timeouts to avoid disconnecting before the import is complete.

URL

POST
/links/import
Request
curl --request POST \
--url https://api.moneykit.com/links/import \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"customer_user":{"id":"string","email":{"address":"string","customer_verified_at":"2023-02-16T00:00:00"},"phone":{"number":"6175551212","country":"US","customer_verified_at":"2023-02-16T00:00:00"}},"provider":"mx","institution_id":"chase","accounts":[{"account_id":"74583934","name":"Premier Checking","type":"depository.checking","mask":"3748","balances":{"currency":"USD","available":340.12,"current":445.89,"limit":500,"balance_date":"2021-08-12T15:23:00Z"}}],"transactions":[{"account_id":"74583934","transaction_id":"string","amount":"384.05","date":"2022-02-08","description":"Regina'\''s Mulberry","type":"food_and_drinks.restaurants"}]}'
const options = {
method: 'POST',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN',
'content-type': 'application/json'
},
body: '{"customer_user":{"id":"string","email":{"address":"string","customer_verified_at":"2023-02-16T00:00:00"},"phone":{"number":"6175551212","country":"US","customer_verified_at":"2023-02-16T00:00:00"}},"provider":"mx","institution_id":"chase","accounts":[{"account_id":"74583934","name":"Premier Checking","type":"depository.checking","mask":"3748","balances":{"currency":"USD","available":340.12,"current":445.89,"limit":500,"balance_date":"2021-08-12T15:23:00Z"}}],"transactions":[{"account_id":"74583934","transaction_id":"string","amount":"384.05","date":"2022-02-08","description":"Regina\'s Mulberry","type":"food_and_drinks.restaurants"}]}'
};

fetch('https://api.moneykit.com/links/import', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import requests

url = "https://api.moneykit.com/links/import"

payload = {
"customer_user": {
"id": "string",
"email": {
"address": "string",
"customer_verified_at": "2023-02-16T00:00:00"
},
"phone": {
"number": "6175551212",
"country": "US",
"customer_verified_at": "2023-02-16T00:00:00"
}
},
"provider": "mx",
"institution_id": "chase",
"accounts": [
{
"account_id": "74583934",
"name": "Premier Checking",
"type": "depository.checking",
"mask": "3748",
"balances": {
"currency": "USD",
"available": 340.12,
"current": 445.89,
"limit": 500,
"balance_date": "2021-08-12T15:23:00Z"
}
}
],
"transactions": [
{
"account_id": "74583934",
"transaction_id": "string",
"amount": "384.05",
"date": "2022-02-08",
"description": "Regina's Mulberry",
"type": "food_and_drinks.restaurants"
}
]
}
headers = {
"Authorization": "Bearer REPLACE_BEARER_TOKEN",
"content-type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
package main

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

func main() {

url := "https://api.moneykit.com/links/import"

payload := strings.NewReader("{\"customer_user\":{\"id\":\"string\",\"email\":{\"address\":\"string\",\"customer_verified_at\":\"2023-02-16T00:00:00\"},\"phone\":{\"number\":\"6175551212\",\"country\":\"US\",\"customer_verified_at\":\"2023-02-16T00:00:00\"}},\"provider\":\"mx\",\"institution_id\":\"chase\",\"accounts\":[{\"account_id\":\"74583934\",\"name\":\"Premier Checking\",\"type\":\"depository.checking\",\"mask\":\"3748\",\"balances\":{\"currency\":\"USD\",\"available\":340.12,\"current\":445.89,\"limit\":500,\"balance_date\":\"2021-08-12T15:23:00Z\"}}],\"transactions\":[{\"account_id\":\"74583934\",\"transaction_id\":\"string\",\"amount\":\"384.05\",\"date\":\"2022-02-08\",\"description\":\"Regina's Mulberry\",\"type\":\"food_and_drinks.restaurants\"}]}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer REPLACE_BEARER_TOKEN")
req.Header.Add("content-type", "application/json")

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/import")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer REPLACE_BEARER_TOKEN'
request["content-type"] = 'application/json'
request.body = "{\"customer_user\":{\"id\":\"string\",\"email\":{\"address\":\"string\",\"customer_verified_at\":\"2023-02-16T00:00:00\"},\"phone\":{\"number\":\"6175551212\",\"country\":\"US\",\"customer_verified_at\":\"2023-02-16T00:00:00\"}},\"provider\":\"mx\",\"institution_id\":\"chase\",\"accounts\":[{\"account_id\":\"74583934\",\"name\":\"Premier Checking\",\"type\":\"depository.checking\",\"mask\":\"3748\",\"balances\":{\"currency\":\"USD\",\"available\":340.12,\"current\":445.89,\"limit\":500,\"balance_date\":\"2021-08-12T15:23:00Z\"}}],\"transactions\":[{\"account_id\":\"74583934\",\"transaction_id\":\"string\",\"amount\":\"384.05\",\"date\":\"2022-02-08\",\"description\":\"Regina's Mulberry\",\"type\":\"food_and_drinks.restaurants\"}]}"

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

let headers = [
"Authorization": "Bearer REPLACE_BEARER_TOKEN",
"content-type": "application/json"
]
let parameters = [
"customer_user": [
"id": "string",
"email": [
"address": "string",
"customer_verified_at": "2023-02-16T00:00:00"
],
"phone": [
"number": "6175551212",
"country": "US",
"customer_verified_at": "2023-02-16T00:00:00"
]
],
"provider": "mx",
"institution_id": "chase",
"accounts": [
[
"account_id": "74583934",
"name": "Premier Checking",
"type": "depository.checking",
"mask": "3748",
"balances": [
"currency": "USD",
"available": 340.12,
"current": 445.89,
"limit": 500,
"balance_date": "2021-08-12T15:23:00Z"
]
]
],
"transactions": [
[
"account_id": "74583934",
"transaction_id": "string",
"amount": "384.05",
"date": "2022-02-08",
"description": "Regina's Mulberry",
"type": "food_and_drinks.restaurants"
]
]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.moneykit.com/links/import")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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
{
"link_id": "mk_eqkWN34UEoa2NxyALG8pcV",
"institution_id": "chase",
"institution_name": "Chase",
"institution_avatar": "https://example.com/avatar.png",
"state": "connected",
"error_code": null,
"link_tags": [
"smoke_test",
"user_type:admin"
],
"webhook": "https://example.com/webhook",
"products": {
"accounts": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"account_numbers": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"identity": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"transactions": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"investments": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"enrichment": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
}
},
"available_products": [
"account_numbers"
]
}
{
"error_code": "api_error.auth.expired_access_token",
"error_message": "Access token expired",
"documentation_url": string
}
{
"error_code": "api_error.rate_limit_exceeded",
"error_message": "Rate limit exceeded",
"documentation_url": string
}

accounts

: array

required

The accounts to import. Note that these fields are initial values only. After import, the actual values may be normalized and cleaned to fit the MoneyKit schema. Also, values may be updated if the account is synced with a provider later.

customer_user

: object

required

institution_id

: string

required

MoneyKit's unique ID for this institution. If you use a MoneyKit-supported provider, you can also submit the provider name and their institution_id in dotted notation, such as mx.chase or yodlee.30188. If the imported link is synced with a data provider later, it will be connected to this institution. Note that MoneyKit may reconnect the link using any supported provider, not just the one given during this import.

example: chase

example: mx.chase

example: yodlee.30188

provider

: string

An enumeration.

example: mx

Allowed values:

"moneykit"

"finicity"

"plaid"

"yodlee"

"mx"

"akoya"

transactions

: array

required

The transactions to import.

Responses

200

Successful Response

institution_id

: string

The unique ID for the institution this link is connected to.

example: chase

institution_name

: string

The institution name this link is connected to.

example: Chase

institution_avatar

: string

An avatar image for the link's institution.

example: https://example.com/avatar.png

state

: string

An enumeration.

connecting awaiting_token_exchange connected deleted error

example: connected

Allowed values:

"connecting"

"awaiting_token_exchange"

"connected"

"deleted"

"error"

error_code

: string

An enumeration.

system_error provider_error institution_error user_error auth_expired incomplete no_accounts user_setup_required invalid_credentials user_oauth_denied user_input_incorrect

Allowed values:

"system_error"

"provider_error"

"institution_error"

"user_error"

"auth_expired"

"incomplete"

"no_accounts"

"user_setup_required"

"invalid_credentials"

"user_oauth_denied"

"user_input_incorrect"

last_synced_at

: string

deprecated

(Deprecated) An ISO-8601 timestamp indicating the last time that the link was updated.

format:

date-time

example: 2023-02-16T09:14:11

provider

: string

An enumeration.

moneykit finicity plaid yodlee mx akoya

example: mx

Allowed values:

"moneykit"

"finicity"

"plaid"

"yodlee"

"mx"

"akoya"

tags

: array

deprecated

DEPRECATED; use link_tags instead

webhook

: string

The webhook url assigned to this link.

example: https://example.com/webhook

products

: object

The granted products available for this link.

available_products

: array

A list of products that could be added to this link. Products can be added to (and removed from) an existing link by creating a new /link-session and supplying the existing_link_id with a new set of products.

example: account_numbers

Allowed values:

"accounts"

"account_numbers"

"identity"

"transactions"

"investments"

"enrichment"

429

Rate limit exceeded.

error_code

: string

api_error.rate_limit_exceeded

default: "api_error.rate_limit_exceeded"

Allowed values:

"api_error.rate_limit_exceeded"

error_message

: string

Error message

default: "Rate limit exceeded"

documentation_url

: string