Skip to main content

plaid-python PyPI version

The official python client library for the Plaid API, which is generated from our OpenAPI spec.

Version 48 introduces a new SDK with endpoints grouped by product, keyword arguments instead of request models, typed errors, an async client, and pagers for many paginated endpoints. The previous SDK remains available as plaid.legacy, so you can migrate one endpoint at a time. See the Python SDK Migration Guide for upgrade instructions.

Table of Contents

Installation

$ pip3 install plaid-python

The package supports Python 3.10 and later.

Versioning

This release only supports the latest Plaid API version, 2020-09-14.

For information about what has changed between versions and how to update your integration, head to the API upgrade guide.

The plaid-python client library is typically updated on a monthly basis. The canonical source for the latest version number is the client library changelog. New versions are published as GitHub tags, not as Releases. New versions are also published on PyPi. Plaid uses semantic versioning to version the client libraries, with potentially breaking changes being indicated by a major version bump.

All users are strongly recommended to use a recent version of the library, as older versions do not contain support for new endpoints and fields. For more details, see the Migration Guide.

Getting Started

The examples in this README use the bundled previous SDK. Import it from plaid.legacy; import plaid.legacy as plaid keeps names such as plaid.Configuration and plaid.ApiException working. For the new SDK, see the migration guide.

Calling Endpoints

To call an endpoint you must create a PlaidApi object.

import plaid.legacy as plaid
from plaid.legacy.api import plaid_api

# Available environments are
# 'Production'
# 'Sandbox'
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)

Each endpoint returns a response model, such as TransactionsSyncResponse. Access fields with response['field'], or convert the model with to_dict().

Errors

All non-200 responses will throw a plaid.legacy.ApiException.

import plaid.legacy as plaid
from plaid.legacy.model.asset_report_get_request import AssetReportGetRequest

try:
    request = AssetReportGetRequest(
        asset_report_token=asset_report_token,
    )
    return client.asset_report_get(request)
except plaid.ApiException as e:
    response = json.loads(e.body)
    # check the code attribute of the error to determine the specific error
    if response['error_code'] == 'ITEM_LOGIN_REQUIRED':
        # the users' login information has changed, generate a public_token
        # for the user and initialize Link in update mode to
        # restore access to this user's data
        # see https://plaid.com/docs/link/update-mode/
    else:
        ...

For more information on Plaid response codes, head to the docs.

Converting the response to a JSON

As this is a common question, we've included this in the README. plaid-python uses models like TransactionsSyncResponse to encapsulate API responses. If you want to convert this to a JSON, do something like this:

import json
...
response = ... # type TransactionsSyncResponse
# to_dict makes it first a python dictionary, and then we turn it into a string JSON.
json_string = json.dumps(response.to_dict(), default=str)

Dates

Dates and datetimes in requests, which are represented as strings in the API and in previous client library versions, are represented in this version of the Python client library as Python datetime.date or datetime.datetime objects. If you need to convert between dates and strings, you can use the datetime.strptime method. For an example, see the Retrieve Transactions sample code later in this Readme. For more information on the Python's datetime module, see Python's official documentation.

Note that the datetime.strptime method will silently remove time zone information. Time zone information is required for request fields that accept datetimes. Failing to include time zone information (or passing in a string, instead of a datetime.datetime object) will result in an error. See the following examples for guidance on datetime.date and datetime.datetime usage.

If the API reference documentation for a field specifies format: date, either of following are acceptable:

from datetime import date

a = date(2022, 5, 5)
b = date.fromisoformat('2022-05-05')

If the API reference documentation for a field specifies format: date-time, the following is acceptable:

from datetime import datetime, timezone

a = datetime(2022, 5, 5, 22, 35, 49, tzinfo=timezone.utc)

Examples

For more examples, see the test suites, Quickstart, or API Reference documentation.

Exchange a public_token from Plaid Link for a Plaid access token:

import plaid.legacy as plaid
from plaid.legacy.model.item_public_token_exchange_request import ItemPublicTokenExchangeRequest

# the public token is received from Plaid Link
exchange_request = ItemPublicTokenExchangeRequest(
    public_token=pt_response['public_token']
)
exchange_response = client.item_public_token_exchange(exchange_request)
access_token = exchange_response['access_token']

Remove Item

import plaid.legacy as plaid
from plaid.legacy.model.item_remove_request import ItemRemoveRequest

# Provide the access token for the Item you want to remove
request = ItemRemoveRequest(
    access_token=accessToken
)
response = client.item_remove(request)

Retrieve Transactions (preferred method)

import plaid.legacy as plaid
from plaid.legacy.model.transactions_sync_request import TransactionsSyncRequest

request = TransactionsSyncRequest(
    access_token=access_token,
)
response = client.transactions_sync(request)
transactions = response['added']

# the transactions in the response are paginated, so make multiple calls while incrementing the cursor to
# retrieve all transactions
while (response['has_more']):
    request = TransactionsSyncRequest(
        access_token=access_token,
        cursor=response['next_cursor']
    )
    response = client.transactions_sync(request)
    transactions += response['added']

Retrieve Transactions (older method)

import plaid.legacy as plaid
from plaid.legacy.model.transactions_get_request_options import TransactionsGetRequestOptions
from plaid.legacy.model.transactions_get_request import TransactionsGetRequest

request = TransactionsGetRequest(
    access_token=access_token,
    start_date=datetime.strptime('2020-01-01', '%Y-%m-%d').date(),
    end_date=datetime.strptime('2021-01-01', '%Y-%m-%d').date(),
)
response = client.transactions_get(request)
transactions = response['transactions']

# the transactions in the response are paginated, so make multiple calls while increasing the offset to
# retrieve all transactions
while len(transactions) < response['total_transactions']:
    options = TransactionsGetRequestOptions()
    options.offset = len(transactions)

    request = TransactionsGetRequest(
        access_token=access_token,
        start_date=datetime.strptime('2020-01-01', '%Y-%m-%d').date(),
        end_date=datetime.strptime('2021-01-01', '%Y-%m-%d').date(),
        options=options
    )
    response = client.transactions_get(request)
    transactions += response['transactions']

Retrieve Asset Report PDF

from plaid.legacy.model.asset_report_pdf_get_request import AssetReportPDFGetRequest

pdf_request = AssetReportPDFGetRequest(asset_report_token=PDF_TOKEN)
pdf = client.asset_report_pdf_get(pdf_request)
FILE = open('asset_report.pdf', 'wb')
FILE.write(pdf.read())
FILE.close()

Migration guide

8.0.0 or later to latest

Migrating from version 8.0.0 or later of the library to a recent version should involve very minor integration changes. Many customers will not need to make changes to their integrations at all. To see a list of all potentially-breaking changes since your current version, see the client library changelog and search for "Breaking changes in this version". Breaking changes are annotated at the top of each major version header.

Pre-8.0.0 to latest

Version 8.0.0 of the client library was released in August 2021 and contains multiple interface changes, as described below.

Client initialization

From:

from plaid import Client
Client(
    client_id=os.environ['CLIENT_ID'],
    secret=os.environ['SECRET'],
    environment='sandbox',
    api_version="2020-09-14",
    client_app="plaid-python-unit-tests"
)

To:

import plaid.legacy as plaid
from plaid.legacy.api import plaid_api
configuration = plaid.Configuration(
    host=plaid.Environment.Sandbox,
    api_key={
        'clientId': client_id,
        'secret': secret,
        'plaidVersion': '2020-09-14'
    }
)
api_client = plaid.ApiClient(configuration)
client = plaid_api.PlaidApi(api_client)

Endpoints

All endpoint requests now take a request model and the functions have been renamed to include _.

From:

response = client.Auth.get(access_token)

To:

import plaid.legacy as plaid
from plaid.legacy.model.auth_get_request import AuthGetRequest
from plaid.legacy.model.auth_get_request_options import AuthGetRequestOptions

ag_request = AuthGetRequest(
    access_token=access_token
)

response = client.auth_get(ag_request)

Errors

From:

try:
    client.Auth.get(access_token)
except ItemError as e:
    if e.code == 'ITEM_LOGIN_REQUIRED':
    else:
        ...
except APIError as e:
    if e.code == 'PLANNED_MAINTENANCE':
        # inform user
    else:
        ...

To:

try:
    request = AssetReportGetRequest(
        asset_report_token=asset_report_token,
    )
    return client.asset_report_get(request)
except plaid.ApiException as e:
    response = json.loads(e.body)
    if response['error_code'] == 'ITEM_LOGIN_REQUIRED':
    else:

Data type changes

See the sections above on Dates and Converting the response to a JSON.

Enums

While the API and previous library versions prior to 8.0.0 represent enums using strings, this current library uses Python classes with restricted values.

From:

'products': ['auth', 'transactions'],
'country_codes': ['US'],

To:

products=[Products('auth'), Products('transactions')],
country_codes=[CountryCode('US')],

Configuration options

Some configuration options, including request timeouts, have moved from global (client-level) to being specified a per-request level, and additional configuration options have been added.

Global configuration options: configuration.py Per-request configuration options: api_client.py

From:

class PlaidClient(plaid.Client):
   def __init__(
       self,
      ...
       timeout=60
   ):
   ...

To:

response = client.accounts_balance_get(request, _request_timeout=60)

Contributing

Please see Contributing for guidelines and instructions for local development.

License

MIT

Metadata

Release files for plaid-python 48.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plaid-python 48.0.0
File Size Uploaded Provenance Actions
plaid_python-48.0.0.tar.gz 2.7 MB With provenance Details for plaid_python-48.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plaid-python 48.0.0
File Interpreter ABI Platform Actions
plaid_python-48.0.0-py3-none-any.whl Python 3 none any Details for plaid_python-48.0.0-py3-none-any.whl

Total release size: 13.3 MB

Release files / plaid_python-48.0.0.tar.gz

Download URL plaid_python-48.0.0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
6c9beddaf8729c4f55583054de2cd4ded8030db9cfba93f3b8c2cc7ba02607d4
BLAKE2b-256 checksum
How to use checksums
537ccb0edbb1bd6cb4b5e0be3314ecd99a368cc631f39719f4b609a0a4c6e5bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / plaid_python-48.0.0-py3-none-any.whl

Download URL plaid_python-48.0.0-py3-none-any.whl
Size 10.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4a87a3ac580fc3b14abc0749b94076f243d0b15170484acf88f9582e7e16f8c2
BLAKE2b-256 checksum
How to use checksums
2f59d4becc5ad0974dcb79807dc56cddc11e4ceb7e55d18d578b86c99015f250
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for plaid-python 48.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for plaid_python-48.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

48.0.0 This release

2 release files Full provenance

0.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page