"required fields missing" error when using Plaid transactions/sync Python API

79 Views Asked by At

I'd like to write a command line app that fetches transactions. I used the Quickstart in Sandbox mode to generate an access token, and now I'd like my Python program to call transactions_sync to get the transactions. My Python code is very close to what is shown in the Plaid docs for Transactions.

I was able to make a TransactionsSyncRequest object using the access token from the Quickstart and my client and secret IDs. But when I pass it to transaction_sync the response is Bad Request (status code 400), and the message says the client_id field is missing.

Is there some sort of initialization step I need to run from Python before calling transaction_sync?

I'm using Python 3.10.6, Plaid 18.2.0, running on macOS.

1

There are 1 best solutions below

2
On BEST ANSWER

The client_id field is set when you initialize the PlaidApi object, so there's probably an issue with that part of your code. Take a look at the plaid-python readme and the full code (not just the /transactions/sync part) of the Python Quickstart for examples of how to initialize PlaidApi. For example, here's the excerpt from the README showing how it's done:

import plaid
from plaid.api import plaid_api

configuration = plaid.Configuration(
    host=plaid.Environment.Sandbox,
    api_key={
        'clientId': client_id,
        'secret': secret,
    }
)

api_client = plaid.ApiClient(configuration)
client = plaid_api.PlaidApi(api_client)