Query the Mercury Bank API

Quadratic sample sheet: https://app.quadratichq.com/file/305e49d1-bd36-4b8f-b0d6-1eadf602a80b

Mercury Bank API docs: https://docs.mercury.com/reference/welcome-to-mercury-api

To get started, view your transaction history directly with the following code (note: this is a sandbox example, follow the docs if you'd like to set this up in production).

import requests
import pandas as pd
from datetime import datetime

# Sandbox token - create your own 
mercury_token = "<your_token_here>"

# Make the API request
response = requests.get(
    headers = {
        'x-cors-api-key': 'temp_2ed7d641dd52613591687200e7f7958b',
        "Authorization": "Bearer {}".format(mercury_token)

# Fix type and put it into a DataFrame 
response = response.json()['transactions']
df = pd.DataFrame(response)

# Filter for the columns we want and prettify 
output_df = df[['amount', 'counterpartyName', 'createdAt', 'status']]
output_df = output_df.rename(columns={"amount": "Amount", "counterpartyName": "Counterparty", "createdAt": "Date", "status": "Status"})

# Output to the sheet 

Need help making this connection? Feel free to reach out to support@quadratichq.com for help.

Quadratic logo

The infinite canvas spreadsheet with code.

Try it now