Skip to content

moovfinancial/moov-python

Repository files navigation

Moov Python

The official SDK for interacting with the Moov API.

Summary

Moov API: Moov is a platform that enables developers to integrate all aspects of money movement with ease and speed. The Moov API makes it simple for platforms to send, receive, and store money. Our API is based upon REST principles, returns JSON responses, and uses standard HTTP response codes. To learn more about how Moov works at a high level, read our concepts guide.

Table of Contents

SDK Installation

Note

Python version upgrade policy

Once a Python version reaches its official end of life date, a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.

The SDK can be installed with either pip or poetry package managers.

PIP

PIP is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.

pip install moovio_sdk

Poetry

Poetry is a modern tool that simplifies dependency management and package publishing by using a single pyproject.toml file to handle project metadata and dependencies.

poetry add moovio_sdk

Shell and script usage with uv

You can use this SDK in a Python shell with uv and the uvx command that comes with it like so:

uvx --from moovio_sdk python

It's also possible to write a standalone Python script without needing to set up a whole project like so:

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
#     "moovio_sdk",
# ]
# ///

from moovio_sdk import Moov

sdk = Moov(
  # SDK arguments
)

# Rest of script here...

Once that is saved to a file, you can run it with uv run script.py where script.py can be replaced with the actual file name.

IDE Support

PyCharm

Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.

SDK Example Usage

Example

# Synchronous Example
from moovio_sdk import Moov
from moovio_sdk.models import components


with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

    res = moov.accounts.create(account_type=components.AccountType.BUSINESS, profile=components.CreateProfile(
        individual=components.CreateIndividualProfile(
            name=components.IndividualName(
                first_name="Jordan",
                last_name="Lee",
                middle_name="Reese",
                suffix="Jr",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            birth_date=components.BirthDate(
                day=9,
                month=11,
                year=1989,
            ),
        ),
        business=components.CreateBusinessProfile(
            legal_business_name="Classbooker, LLC",
            business_type=components.BusinessType.LLC,
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            description="Local fitness gym paying out instructors",
            tax_id=components.TaxID(
                ein=components.TaxIDEin(
                    number="12-3456789",
                ),
            ),
            industry_codes=components.IndustryCodes(
                naics="713940",
                sic="7991",
                mcc="7997",
            ),
        ),
    ), metadata={
        "optional": "metadata",
    }, terms_of_service={
        "token": "kgT1uxoMAk7QKuyJcmQE8nqW_HjpyuXBabiXPi6T83fUQoxsyWYPcYzuHQTqrt7YRp4gCwyDQvb6U5REM9Pgl2EloCe35t-eiMAbUWGo3Kerxme6aqNcKrP_6-v0MTXViOEJ96IBxPFTvMV7EROI2dq3u4e-x4BbGSCedAX-ViAQND6hcreCDXwrO6sHuzh5Xi2IzSqZHxaovnWEboaxuZKRJkA3dsFID6fzitMpm2qrOh4",
    }, customer_support={
        "phone": {
            "number": "8185551212",
            "country_code": "1",
        },
        "email": "[email protected]",
        "address": {
            "address_line1": "123 Main Street",
            "city": "Boulder",
            "state_or_province": "CO",
            "postal_code": "80301",
            "country": "US",
            "address_line2": "Apt 302",
        },
    }, settings={
        "card_payment": {
            "statement_descriptor": "Whole Body Fitness",
        },
        "ach_payment": {
            "company_name": "WholeBodyFitness",
        },
    }, mode=components.Mode.PRODUCTION)

    # Handle response
    print(res)

The same SDK client can also be used to make asychronous requests by importing asyncio.

# Asynchronous Example
import asyncio
from moovio_sdk import Moov
from moovio_sdk.models import components

async def main():

    async with Moov(
        security=components.Security(
            username="",
            password="",
        ),
    ) as moov:

        res = await moov.accounts.create_async(account_type=components.AccountType.BUSINESS, profile=components.CreateProfile(
            individual=components.CreateIndividualProfile(
                name=components.IndividualName(
                    first_name="Jordan",
                    last_name="Lee",
                    middle_name="Reese",
                    suffix="Jr",
                ),
                phone=components.PhoneNumber(
                    number="8185551212",
                    country_code="1",
                ),
                email="[email protected]",
                address=components.Address(
                    address_line1="123 Main Street",
                    city="Boulder",
                    state_or_province="CO",
                    postal_code="80301",
                    country="US",
                    address_line2="Apt 302",
                ),
                birth_date=components.BirthDate(
                    day=9,
                    month=11,
                    year=1989,
                ),
            ),
            business=components.CreateBusinessProfile(
                legal_business_name="Classbooker, LLC",
                business_type=components.BusinessType.LLC,
                address=components.Address(
                    address_line1="123 Main Street",
                    city="Boulder",
                    state_or_province="CO",
                    postal_code="80301",
                    country="US",
                    address_line2="Apt 302",
                ),
                phone=components.PhoneNumber(
                    number="8185551212",
                    country_code="1",
                ),
                email="[email protected]",
                description="Local fitness gym paying out instructors",
                tax_id=components.TaxID(
                    ein=components.TaxIDEin(
                        number="12-3456789",
                    ),
                ),
                industry_codes=components.IndustryCodes(
                    naics="713940",
                    sic="7991",
                    mcc="7997",
                ),
            ),
        ), metadata={
            "optional": "metadata",
        }, terms_of_service={
            "token": "kgT1uxoMAk7QKuyJcmQE8nqW_HjpyuXBabiXPi6T83fUQoxsyWYPcYzuHQTqrt7YRp4gCwyDQvb6U5REM9Pgl2EloCe35t-eiMAbUWGo3Kerxme6aqNcKrP_6-v0MTXViOEJ96IBxPFTvMV7EROI2dq3u4e-x4BbGSCedAX-ViAQND6hcreCDXwrO6sHuzh5Xi2IzSqZHxaovnWEboaxuZKRJkA3dsFID6fzitMpm2qrOh4",
        }, customer_support={
            "phone": {
                "number": "8185551212",
                "country_code": "1",
            },
            "email": "[email protected]",
            "address": {
                "address_line1": "123 Main Street",
                "city": "Boulder",
                "state_or_province": "CO",
                "postal_code": "80301",
                "country": "US",
                "address_line2": "Apt 302",
            },
        }, settings={
            "card_payment": {
                "statement_descriptor": "Whole Body Fitness",
            },
            "ach_payment": {
                "company_name": "WholeBodyFitness",
            },
        }, mode=components.Mode.PRODUCTION)

        # Handle response
        print(res)

asyncio.run(main())

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme Environment Variable
username
password
http HTTP Basic MOOV_USERNAME
MOOV_PASSWORD

You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:

from moovio_sdk import Moov
from moovio_sdk.models import components


with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

    res = moov.accounts.create(account_type=components.AccountType.BUSINESS, profile=components.CreateProfile(
        individual=components.CreateIndividualProfile(
            name=components.IndividualName(
                first_name="Jordan",
                last_name="Lee",
                middle_name="Reese",
                suffix="Jr",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            birth_date=components.BirthDate(
                day=9,
                month=11,
                year=1989,
            ),
        ),
        business=components.CreateBusinessProfile(
            legal_business_name="Classbooker, LLC",
            business_type=components.BusinessType.LLC,
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            description="Local fitness gym paying out instructors",
            tax_id=components.TaxID(
                ein=components.TaxIDEin(
                    number="12-3456789",
                ),
            ),
            industry_codes=components.IndustryCodes(
                naics="713940",
                sic="7991",
                mcc="7997",
            ),
        ),
    ), metadata={
        "optional": "metadata",
    }, terms_of_service={
        "token": "kgT1uxoMAk7QKuyJcmQE8nqW_HjpyuXBabiXPi6T83fUQoxsyWYPcYzuHQTqrt7YRp4gCwyDQvb6U5REM9Pgl2EloCe35t-eiMAbUWGo3Kerxme6aqNcKrP_6-v0MTXViOEJ96IBxPFTvMV7EROI2dq3u4e-x4BbGSCedAX-ViAQND6hcreCDXwrO6sHuzh5Xi2IzSqZHxaovnWEboaxuZKRJkA3dsFID6fzitMpm2qrOh4",
    }, customer_support={
        "phone": {
            "number": "8185551212",
            "country_code": "1",
        },
        "email": "[email protected]",
        "address": {
            "address_line1": "123 Main Street",
            "city": "Boulder",
            "state_or_province": "CO",
            "postal_code": "80301",
            "country": "US",
            "address_line2": "Apt 302",
        },
    }, settings={
        "card_payment": {
            "statement_descriptor": "Whole Body Fitness",
        },
        "ach_payment": {
            "company_name": "WholeBodyFitness",
        },
    }, mode=components.Mode.PRODUCTION)

    # Handle response
    print(res)

Available Resources and Operations

Available methods
  • create - You can create business or individual accounts for your users (i.e., customers, merchants) by passing the required information to Moov. Requirements differ per account type and requested capabilities.

If you're requesting the wallet, send-funds, collect-funds, or card-issuing capabilities, you'll need to:

  • Send Moov the user platform terms of service agreement acceptance. This can be done upon account creation, or by patching the account using the termsOfService field. If you're creating a business account with the business type llc, partnership, or privateCorporation, you'll need to:
  • Provide business representatives after creating the account.
  • Patch the account to indicate that business representative ownership information is complete.

Visit our documentation to read more about creating accounts and verification requirements. Note that the mode field (for production or sandbox) is only required when creating a facilitator account. All non-facilitator account requests will ignore the mode field and be set to the calling facilitator's mode.

To access this endpoint using an access token you'll need to specify the /accounts.write scope.

  • list - List or search accounts to which the caller is connected.

All supported query parameters are optional. If none are provided the response will include all connected accounts. Pagination is supported via the skip and count query parameters. Searching by name and email will overlap and return results based on relevance.

To access this endpoint using an access token you'll need to specify the /accounts.read scope.

  • get - Retrieves details for the account with the specified ID.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

  • update - When can profile data be updated:

    • For unverified accounts, all profile data can be edited.
    • During the verification process, missing or incomplete profile data can be edited.
    • Verified accounts can only add missing profile data.

    When can't profile data be updated:

    • Verified accounts cannot change any existing profile data.

If you need to update information in a locked state, please contact Moov support.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.write scope.

  • disconnect - This will sever the connection between you and the account specified and it will no longer be listed as active in the list of accounts. This also means you'll only have read-only access to the account going forward for reporting purposes.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.disconnect scope.

  • get_countries - Retrieve the specified countries of operation for an account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

This endpoint will always overwrite the previously assigned values.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.write scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

This token can only be generated via API. Any Moov account requesting the collect funds, send funds, wallet, or card issuing capabilities must accept Moov's terms of service, then have the generated terms of service token patched to the account. Read more in our documentation.

  • list - List adjustments associated with a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

  • get - Retrieve a specific adjustment associated with a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

Any domains that will be used to accept payments must first be verified with Apple.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

Any domains that will be used to accept payments must first be verified with Apple.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

Read our Apple Pay tutorial to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.read scope.

  • create_session - Create a session with Apple Pay to facilitate a payment.

Read our Apple Pay tutorial to learn more. A successful response from this endpoint should be passed through to Apple Pay unchanged.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/apple-pay.write scope.

  • link_token - Connect an Apple Pay token to the specified account.

Read our Apple Pay tutorial to learn more. The token data is defined by Apple Pay and should be passed through from Apple Pay's response unmodified.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.write scope.

Allows clients to notify the authorization server that a previously obtained refresh or access token is no longer needed.

  • get - Get avatar image for an account using a unique ID.

To access this endpoint using an access token you'll need to specify the /profile-enrichment.read scope.

It is strongly recommended that callers include the X-Wait-For header, set to payment-method, if the newly linked bank-account is intended to be used right away. If this header is not included, the caller will need to poll the List Payment Methods endpoint to wait for the new payment methods to be available for use.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.write scope.

  • list - List all the bank accounts associated with a particular Moov account.

Read our bank accounts guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.read scope.

  • get - Retrieve bank account details (i.e. routing number or account type) associated with a specific Moov account.

Read our bank accounts guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.read scope.

  • disable - Discontinue using a specified bank account linked to a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.write scope.

  • initiate_micro_deposits - Micro-deposits help confirm bank account ownership, helping reduce fraud and the risk of unauthorized activity. Use this method to initiate the micro-deposit verification, sending two small credit transfers to the bank account you want to confirm.

If you request micro-deposits before 4:15PM ET, they will appear that same day. If you request micro-deposits any time after 4:15PM ET, they will appear the next banking day. When the two credits are initiated, Moov simultaneously initiates a debit to recoup the micro-deposits.

Micro-deposits initiated for a sandbox bank account will always be $0.00 / $0.00 and instantly verifiable once initiated.

You can simulate micro-deposit verification in test mode. See our test mode guide for more information.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.write scope.

  • complete_micro_deposits - Complete the micro-deposit validation process by passing the amounts of the two transfers within three tries.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.write scope.

  • get_verification - Retrieve the current status and details of an instant verification, including whether the verification method was instant or same-day ACH. This helps track the verification process in real-time and provides details in case of exceptions.

The status will indicate the following:

  • new: Verification initiated, credit pending to the payment network
  • sent-credit: Credit sent, available for verification
  • failed: Verification failed, description provided, user needs to add a new bank account
  • expired: Verification expired after 14 days, initiate another verification
  • max-attempts-exceeded: Five incorrect code attempts exhausted, initiate another verification

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.read scope.

  • initiate_verification - Instant micro-deposit verification offers a quick and efficient way to verify bank account ownership.

Send a $0.01 credit with a unique verification code via RTP or same-day ACH, depending on the receiving bank's capabilities. This feature provides a faster alternative to traditional methods, allowing verification in a single session.

It is recommended to use the X-Wait-For: rail-response header to synchronously receive the outcome of the instant credit in the response payload.

Possible verification methods:

  • instant: Real-time verification credit sent via RTP
  • ach: Verification credit sent via same-day ACH

Possible statuses:

  • new: Verification initiated, credit pending
  • sent-credit: Credit sent, available for verification in the external bank account
  • failed: Verification failed due to credit rejection/return, details in exceptionDetails

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.write scope.

  • complete_verification - Finalize the instant micro-deposit verification by submitting the verification code displayed in the user's bank account.

Upon successful verification, the bank account status will be updated to verified and eligible for ACH debit transactions.

The following formats are accepted:

  • MV0000
  • mv0000
  • 0000

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/bank-accounts.write scope.

  • create - Create brand properties for the specified account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/branding.write scope.

  • upsert - Create or replace brand properties for the specified account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/branding.write scope.

  • get - Get brand properties for the specified account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/branding.read scope.

  • update - Updates the brand properties for the specified account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/branding.write scope.

  • list - Retrieve all the capabilities an account has requested.

Read our capabilities guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/capabilities.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/capabilities.write scope.

  • get - Retrieve a specific capability that an account has requested. Read our capabilities guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/capabilities.read scope.

  • disable - Disable a specific capability that an account has requested. Read our capabilities guide to learn more.

    To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/capabilities.write scope.

  • request - Request a virtual card be issued.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.write scope.

  • list - List Moov issued cards existing for the account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read scope.

  • get - Retrieve a single issued card associated with a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read scope.

  • update - Update a Moov issued card.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.write scope.

  • get_full - Get issued card with PAN, CVV, and expiration.

Only use this endpoint if you have provided Moov with a copy of your PCI attestation of compliance.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read-secure scope.

  • link - Link a card to an existing Moov account.

Read our accept card payments guide to learn more.

Only use this endpoint if you have provided Moov with a copy of your PCI attestation of compliance.

During card linking, the provided data will be verified by submitting a $0 authorization (account verification) request. If merchantAccountID is provided, the authorization request will contain that account's statement descriptor and address. Otherwise, the platform account's profile will be used. If no statement descriptor has been set, the authorization will use the account's name instead.

It is strongly recommended that callers include the X-Wait-For header, set to payment-method, if the newly linked card is intended to be used right away. If this header is not included, the caller will need to poll the List Payment Methods endpoint to wait for the new payment methods to be available for use.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.write scope.

  • list - List all the active cards associated with a Moov account.

Read our accept card payments guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.read scope.

  • get - Fetch a specific card associated with a Moov account.

Read our accept card payments guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.read scope.

  • update - Update a linked card and/or resubmit it for verification.

If a value is provided for CVV, a new verification ($0 authorization) will be submitted for the card. Updating the expiration date or address will update the information stored on file for the card but will not be verified.

Read our accept card payments guide to learn more.

Only use this endpoint if you have provided Moov with a copy of your PCI attestation of compliance.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.write scope.

  • disable - Disables a card associated with a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.write scope.

  • list - Returns the list of disputes.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • get - Get a dispute by ID.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • accept - Accepts liability for a dispute.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

Evidence items must be uploaded using the appropriate endpoint(s) prior to calling this endpoint to submit it. Evidence can only be submitted once per dispute.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

Read our disputes guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

To access this endpoint using an access token you'll need to specify the /ping.read scope.

  • generate_key - Generates a public key used to create a JWE token for passing secure authentication data through non-PCI compliant intermediaries.
  • get - Fetch enriched address suggestions. Requires a partial address.

To access this endpoint using an access token you'll need to specify the /profile-enrichment.read scope.

  • get - Fetch enriched profile data. Requires a valid email address. This service is offered in collaboration with Clearbit.

To access this endpoint using an access token you'll need to specify the /profile-enrichment.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

  • create_fee_plan_agreements - Creates the subscription of a fee plan to a merchant account. Merchants are required to accept the fee plan terms prior to activation.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.write scope.

  • list_fee_plans - List all fee plans available for use by an account. This is intended to be used by an account when selecting a fee plan to apply to a connected account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

  • upload - Upload a file and link it to the specified Moov account.

The maximum file size is 10MB. Each account is allowed a maximum of 50 files. Acceptable file types include csv, jpg, pdf, and png.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/files.write scope.

  • list - List all the files associated with a particular Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/files.read scope.

  • get - Retrieve file details associated with a specific Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/files.read scope.

  • list - Returns a list of all industry titles and their corresponding MCC/SIC/NAICS codes. Results are ordered by title.

To access this endpoint using an access token you'll need to specify the /profile-enrichment.read scope.

  • search - Search for institutions by either their name or routing number.

To access this endpoint using an access token you'll need to specify the /fed.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read scope.

  • get_authorization - Retrieves details of an authorization associated with a specific Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read scope.

  • list_authorization_events - List card network and Moov platform events that affect the authorization and its hold on a wallet balance.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read scope.

  • list - List issued card transactions associated with a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read scope.

  • get - Retrieves details of an issued card transaction associated with a specific Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/issued-cards.read scope.

  • create_invite - Create an invitation containing a unique link that allows the recipient to onboard their organization with Moov.

To access this endpoint using an access token you'll need to specify the /accounts.write scope.

  • list_invites - List all the onboarding invites created by the caller's account.

To access this endpoint using an access token you'll need to specify the /accounts.read scope.

  • get_invite - Retrieve details about an onboarding invite.

To access this endpoint using an access token you'll need to specify the /accounts.read scope.

  • revoke_invite - Revoke an onboarding invite, rendering the invitation link unusable.

To access this endpoint using an access token you'll need to specify the /accounts.write scope.

  • create - Create a payment link that allows an end user to make a payment on Moov's hosted payment link page.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • list - List all the payment links created under a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • get - Retrieve a payment link by code.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • update - Update a payment link.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • disable - Disable a payment link.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • get_qr_code - Retrieve the payment link encoded in a QR code.

Use the Accept header to specify the format of the response. Supported formats are application/json and image/png.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/payment-methods.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/payment-methods.read scope.

  • ping - A simple endpoint to check auth.

To access this endpoint using an access token you'll need to specify the /ping.read scope.

  • create - Create receipts for transfers and scheduled transfers.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • list - List receipts by trasnferID, scheduleID, or occurrenceID.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • create - Moov accounts associated with businesses require information regarding individuals who represent the business. You can provide this information by creating a representative. Each account is allowed a maximum of 7 representatives. Read our business representatives guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/representatives.write scope.

  • list - A Moov account may have multiple representatives depending on the associated business's ownership and management structure. You can use this method to list all the representatives for a given Moov account. Note that Moov accounts associated with an individual do not have representatives. Read our business representatives guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/representatives.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/representatives.write scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/representatives.read scope.

  • update - If a representative's information has changed you can patch the information associated with a specific representative ID. Read our business representatives guide to learn more.

When can profile data be updated:

  • For unverified representatives, all profile data can be edited.
  • During the verification process, missing or incomplete profile data can be edited.
  • Verified representatives can only add missing profile data.

When can't profile data be updated:

  • Verified representatives cannot change any existing profile data.

If you need to update information in a locked state, please contact Moov support.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/representatives.write scope.

  • create - Describes the schedule to create or modify.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • list - Describes a list of schedules associated with an account. Append the hydrate=accounts query parameter to include partial account details in the response.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • update - Describes the schedule to modify.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • get - Describes a schedule associated with an account. Requires at least 1 occurrence or recurTransfer to be specified.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • cancel - Describes the schedule to cancel.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.write scope.

  • list_configs - List sweep configs associated with an account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

  • get_config - Get a sweep config associated with a wallet.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.write scope.

  • list - List sweeps associated with a wallet.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

  • get - Get details on a specific sweep.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

  • create - Create a new terminal application.

To access this endpoint using an access token you'll need to specify the /terminalApplications.write scope.

  • list - List all the terminal applications for a Moov Account.

To access this endpoint using an access token you'll need to specify the /terminalApplications.read scope.

  • get - Fetch a specific terminal application.

To access this endpoint using an access token you'll need to specify the /terminalApplications.read scope.

  • delete - Delete a specific terminal application.

To access this endpoint using an access token you'll need to specify the /terminalApplications.write scope.

  • create - Move money by providing the source, destination, and amount in the request body.

Read our transfers overview guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • list - List all the transfers associated with a particular Moov account.

Read our transfers overview guide to learn more.

When you run this request, you retrieve 200 transfers at a time. You can advance past a results set of 200 transfers by using the skip parameter (for example, if you set skip= 10, you will see a results set of 200 transfers after the first 10). If you are searching a high volume of transfers, the request will likely process very slowly. To achieve faster performance, restrict the data as much as you can by using the StartDateTime and EndDateTime parameters for a limited period of time. You can run multiple requests in smaller time window increments until you've retrieved all the transfers you need.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • get - Retrieve full transfer details for an individual transfer of a particular Moov account.

Payment rail-specific details are included in the source and destination. Read our transfers overview guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • update - Update the metadata contained on a transfer.

Read our transfers overview guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • create_cancellation - Initiate a cancellation for a card, ACH, or queued transfer.

    To access this endpoint using a token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • get_cancellation - Get details of a cancellation for a transfer.

    To access this endpoint using a token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • initiate_refund - Initiate a refund for a card transfer.

Use the Cancel or refund a card transfer endpoint for more comprehensive cancel and refund options.
See the reversals guide for more information.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • get_refund - Get details of a refund for a card transfer.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • create_reversal - Reverses a card transfer by initiating a cancellation or refund depending on the transaction status. Read our reversals guide to learn more.

To access this endpoint using a token you'll need to specify the /accounts/{accountID}/transfers.write scope.

  • generate_options - Generate available payment method options for one or multiple transfer participants depending on the accountID or paymentMethodID you supply in the request.

Read our transfers overview guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.read scope.

  • get - Retrieve underwriting associated with a given Moov account.

Read our underwriting guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.read scope.

  • upsert - Create or update the account's underwriting.

Read our underwriting guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/profile.write scope.

  • list - List all the transactions associated with a particular Moov wallet.

Read our wallet transactions guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

  • get - Get details on a specific wallet transaction.

Read our wallet transactions guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

  • list - List the wallets associated with a Moov account.

Read our Moov wallets guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

  • get - Get information on a specific wallet (e.g., the available balance).

Read our Moov wallets guide to learn more.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/wallets.read scope.

File uploads

Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.

Tip

For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.

from moovio_sdk import Moov
from moovio_sdk.models import components


with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

    res = moov.disputes.upload_evidence_file(account_id="ac81921c-4c1a-4e7a-8a8f-dfc0d0027ac5", dispute_id="49c04fa3-f5c3-4ddd-aece-4b5fb6e8a071", file={
        "file_name": "example.file",
        "content": open("example.file", "rb"),
    }, evidence_type=components.EvidenceType.CUSTOMER_COMMUNICATION)

    # Handle response
    print(res)

Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a RetryConfig object to the call:

from moovio_sdk import Moov
from moovio_sdk.models import components
from moovio_sdk.utils import BackoffStrategy, RetryConfig


with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

    res = moov.accounts.create(account_type=components.AccountType.BUSINESS, profile=components.CreateProfile(
        individual=components.CreateIndividualProfile(
            name=components.IndividualName(
                first_name="Jordan",
                last_name="Lee",
                middle_name="Reese",
                suffix="Jr",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            birth_date=components.BirthDate(
                day=9,
                month=11,
                year=1989,
            ),
        ),
        business=components.CreateBusinessProfile(
            legal_business_name="Classbooker, LLC",
            business_type=components.BusinessType.LLC,
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            description="Local fitness gym paying out instructors",
            tax_id=components.TaxID(
                ein=components.TaxIDEin(
                    number="12-3456789",
                ),
            ),
            industry_codes=components.IndustryCodes(
                naics="713940",
                sic="7991",
                mcc="7997",
            ),
        ),
    ), metadata={
        "optional": "metadata",
    }, terms_of_service={
        "token": "kgT1uxoMAk7QKuyJcmQE8nqW_HjpyuXBabiXPi6T83fUQoxsyWYPcYzuHQTqrt7YRp4gCwyDQvb6U5REM9Pgl2EloCe35t-eiMAbUWGo3Kerxme6aqNcKrP_6-v0MTXViOEJ96IBxPFTvMV7EROI2dq3u4e-x4BbGSCedAX-ViAQND6hcreCDXwrO6sHuzh5Xi2IzSqZHxaovnWEboaxuZKRJkA3dsFID6fzitMpm2qrOh4",
    }, customer_support={
        "phone": {
            "number": "8185551212",
            "country_code": "1",
        },
        "email": "[email protected]",
        "address": {
            "address_line1": "123 Main Street",
            "city": "Boulder",
            "state_or_province": "CO",
            "postal_code": "80301",
            "country": "US",
            "address_line2": "Apt 302",
        },
    }, settings={
        "card_payment": {
            "statement_descriptor": "Whole Body Fitness",
        },
        "ach_payment": {
            "company_name": "WholeBodyFitness",
        },
    }, mode=components.Mode.PRODUCTION,
        RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))

    # Handle response
    print(res)

If you'd like to override the default retry strategy for all operations that support retries, you can use the retry_config optional parameter when initializing the SDK:

from moovio_sdk import Moov
from moovio_sdk.models import components
from moovio_sdk.utils import BackoffStrategy, RetryConfig


with Moov(
    retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

    res = moov.accounts.create(account_type=components.AccountType.BUSINESS, profile=components.CreateProfile(
        individual=components.CreateIndividualProfile(
            name=components.IndividualName(
                first_name="Jordan",
                last_name="Lee",
                middle_name="Reese",
                suffix="Jr",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            birth_date=components.BirthDate(
                day=9,
                month=11,
                year=1989,
            ),
        ),
        business=components.CreateBusinessProfile(
            legal_business_name="Classbooker, LLC",
            business_type=components.BusinessType.LLC,
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            description="Local fitness gym paying out instructors",
            tax_id=components.TaxID(
                ein=components.TaxIDEin(
                    number="12-3456789",
                ),
            ),
            industry_codes=components.IndustryCodes(
                naics="713940",
                sic="7991",
                mcc="7997",
            ),
        ),
    ), metadata={
        "optional": "metadata",
    }, terms_of_service={
        "token": "kgT1uxoMAk7QKuyJcmQE8nqW_HjpyuXBabiXPi6T83fUQoxsyWYPcYzuHQTqrt7YRp4gCwyDQvb6U5REM9Pgl2EloCe35t-eiMAbUWGo3Kerxme6aqNcKrP_6-v0MTXViOEJ96IBxPFTvMV7EROI2dq3u4e-x4BbGSCedAX-ViAQND6hcreCDXwrO6sHuzh5Xi2IzSqZHxaovnWEboaxuZKRJkA3dsFID6fzitMpm2qrOh4",
    }, customer_support={
        "phone": {
            "number": "8185551212",
            "country_code": "1",
        },
        "email": "[email protected]",
        "address": {
            "address_line1": "123 Main Street",
            "city": "Boulder",
            "state_or_province": "CO",
            "postal_code": "80301",
            "country": "US",
            "address_line2": "Apt 302",
        },
    }, settings={
        "card_payment": {
            "statement_descriptor": "Whole Body Fitness",
        },
        "ach_payment": {
            "company_name": "WholeBodyFitness",
        },
    }, mode=components.Mode.PRODUCTION)

    # Handle response
    print(res)

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.

By default, an API error will raise a errors.APIError exception, which has the following properties:

Property Type Description
.status_code int The HTTP status code
.message str The error message
.raw_response httpx.Response The raw HTTP response
.body str The response content

When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the create_async method may raise the following exceptions:

Error Type Status Code Content Type
errors.GenericError 400, 409 application/json
errors.CreateAccountResponseBody 422 application/json
errors.APIError 4XX, 5XX */*

Example

from moovio_sdk import Moov
from moovio_sdk.models import components, errors


with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:
    res = None
    try:

        res = moov.accounts.create(account_type=components.AccountType.BUSINESS, profile=components.CreateProfile(
            individual=components.CreateIndividualProfile(
                name=components.IndividualName(
                    first_name="Jordan",
                    last_name="Lee",
                    middle_name="Reese",
                    suffix="Jr",
                ),
                phone=components.PhoneNumber(
                    number="8185551212",
                    country_code="1",
                ),
                email="[email protected]",
                address=components.Address(
                    address_line1="123 Main Street",
                    city="Boulder",
                    state_or_province="CO",
                    postal_code="80301",
                    country="US",
                    address_line2="Apt 302",
                ),
                birth_date=components.BirthDate(
                    day=9,
                    month=11,
                    year=1989,
                ),
            ),
            business=components.CreateBusinessProfile(
                legal_business_name="Classbooker, LLC",
                business_type=components.BusinessType.LLC,
                address=components.Address(
                    address_line1="123 Main Street",
                    city="Boulder",
                    state_or_province="CO",
                    postal_code="80301",
                    country="US",
                    address_line2="Apt 302",
                ),
                phone=components.PhoneNumber(
                    number="8185551212",
                    country_code="1",
                ),
                email="[email protected]",
                description="Local fitness gym paying out instructors",
                tax_id=components.TaxID(
                    ein=components.TaxIDEin(
                        number="12-3456789",
                    ),
                ),
                industry_codes=components.IndustryCodes(
                    naics="713940",
                    sic="7991",
                    mcc="7997",
                ),
            ),
        ), metadata={
            "optional": "metadata",
        }, terms_of_service={
            "token": "kgT1uxoMAk7QKuyJcmQE8nqW_HjpyuXBabiXPi6T83fUQoxsyWYPcYzuHQTqrt7YRp4gCwyDQvb6U5REM9Pgl2EloCe35t-eiMAbUWGo3Kerxme6aqNcKrP_6-v0MTXViOEJ96IBxPFTvMV7EROI2dq3u4e-x4BbGSCedAX-ViAQND6hcreCDXwrO6sHuzh5Xi2IzSqZHxaovnWEboaxuZKRJkA3dsFID6fzitMpm2qrOh4",
        }, customer_support={
            "phone": {
                "number": "8185551212",
                "country_code": "1",
            },
            "email": "[email protected]",
            "address": {
                "address_line1": "123 Main Street",
                "city": "Boulder",
                "state_or_province": "CO",
                "postal_code": "80301",
                "country": "US",
                "address_line2": "Apt 302",
            },
        }, settings={
            "card_payment": {
                "statement_descriptor": "Whole Body Fitness",
            },
            "ach_payment": {
                "company_name": "WholeBodyFitness",
            },
        }, mode=components.Mode.PRODUCTION)

        # Handle response
        print(res)

    except errors.GenericError as e:
        # handle e.data: errors.GenericErrorData
        raise(e)
    except errors.CreateAccountResponseBody as e:
        # handle e.data: errors.CreateAccountResponseBodyData
        raise(e)
    except errors.APIError as e:
        # handle exception
        raise(e)

Server Selection

Override Server URL Per-Client

The default server can be overridden globally by passing a URL to the server_url: str optional parameter when initializing the SDK client instance. For example:

from moovio_sdk import Moov
from moovio_sdk.models import components


with Moov(
    server_url="https://api.moov.io",
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

    res = moov.accounts.create(account_type=components.AccountType.BUSINESS, profile=components.CreateProfile(
        individual=components.CreateIndividualProfile(
            name=components.IndividualName(
                first_name="Jordan",
                last_name="Lee",
                middle_name="Reese",
                suffix="Jr",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            birth_date=components.BirthDate(
                day=9,
                month=11,
                year=1989,
            ),
        ),
        business=components.CreateBusinessProfile(
            legal_business_name="Classbooker, LLC",
            business_type=components.BusinessType.LLC,
            address=components.Address(
                address_line1="123 Main Street",
                city="Boulder",
                state_or_province="CO",
                postal_code="80301",
                country="US",
                address_line2="Apt 302",
            ),
            phone=components.PhoneNumber(
                number="8185551212",
                country_code="1",
            ),
            email="[email protected]",
            description="Local fitness gym paying out instructors",
            tax_id=components.TaxID(
                ein=components.TaxIDEin(
                    number="12-3456789",
                ),
            ),
            industry_codes=components.IndustryCodes(
                naics="713940",
                sic="7991",
                mcc="7997",
            ),
        ),
    ), metadata={
        "optional": "metadata",
    }, terms_of_service={
        "token": "kgT1uxoMAk7QKuyJcmQE8nqW_HjpyuXBabiXPi6T83fUQoxsyWYPcYzuHQTqrt7YRp4gCwyDQvb6U5REM9Pgl2EloCe35t-eiMAbUWGo3Kerxme6aqNcKrP_6-v0MTXViOEJ96IBxPFTvMV7EROI2dq3u4e-x4BbGSCedAX-ViAQND6hcreCDXwrO6sHuzh5Xi2IzSqZHxaovnWEboaxuZKRJkA3dsFID6fzitMpm2qrOh4",
    }, customer_support={
        "phone": {
            "number": "8185551212",
            "country_code": "1",
        },
        "email": "[email protected]",
        "address": {
            "address_line1": "123 Main Street",
            "city": "Boulder",
            "state_or_province": "CO",
            "postal_code": "80301",
            "country": "US",
            "address_line2": "Apt 302",
        },
    }, settings={
        "card_payment": {
            "statement_descriptor": "Whole Body Fitness",
        },
        "ach_payment": {
            "company_name": "WholeBodyFitness",
        },
    }, mode=components.Mode.PRODUCTION)

    # Handle response
    print(res)

Custom HTTP Client

The Python SDK makes API calls using the httpx HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance. Depending on whether you are using the sync or async version of the SDK, you can pass an instance of HttpClient or AsyncHttpClient respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls. This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of httpx.Client or httpx.AsyncClient directly.

For example, you could specify a header for every request that this sdk makes as follows:

from moovio_sdk import Moov
import httpx

http_client = httpx.Client(headers={"x-custom-header": "someValue"})
s = Moov(client=http_client)

or you could wrap the client with your own custom logic:

from moovio_sdk import Moov
from moovio_sdk.httpclient import AsyncHttpClient
import httpx

class CustomClient(AsyncHttpClient):
    client: AsyncHttpClient

    def __init__(self, client: AsyncHttpClient):
        self.client = client

    async def send(
        self,
        request: httpx.Request,
        *,
        stream: bool = False,
        auth: Union[
            httpx._types.AuthTypes, httpx._client.UseClientDefault, None
        ] = httpx.USE_CLIENT_DEFAULT,
        follow_redirects: Union[
            bool, httpx._client.UseClientDefault
        ] = httpx.USE_CLIENT_DEFAULT,
    ) -> httpx.Response:
        request.headers["Client-Level-Header"] = "added by client"

        return await self.client.send(
            request, stream=stream, auth=auth, follow_redirects=follow_redirects
        )

    def build_request(
        self,
        method: str,
        url: httpx._types.URLTypes,
        *,
        content: Optional[httpx._types.RequestContent] = None,
        data: Optional[httpx._types.RequestData] = None,
        files: Optional[httpx._types.RequestFiles] = None,
        json: Optional[Any] = None,
        params: Optional[httpx._types.QueryParamTypes] = None,
        headers: Optional[httpx._types.HeaderTypes] = None,
        cookies: Optional[httpx._types.CookieTypes] = None,
        timeout: Union[
            httpx._types.TimeoutTypes, httpx._client.UseClientDefault
        ] = httpx.USE_CLIENT_DEFAULT,
        extensions: Optional[httpx._types.RequestExtensions] = None,
    ) -> httpx.Request:
        return self.client.build_request(
            method,
            url,
            content=content,
            data=data,
            files=files,
            json=json,
            params=params,
            headers=headers,
            cookies=cookies,
            timeout=timeout,
            extensions=extensions,
        )

s = Moov(async_client=CustomClient(httpx.AsyncClient()))

Resource Management

The Moov class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a context manager and reuse it across the application.

from moovio_sdk import Moov
from moovio_sdk.models import components
def main():

    with Moov(
        security=components.Security(
            username="",
            password="",
        ),
    ) as moov:
        # Rest of application here...


# Or when using async:
async def amain():

    async with Moov(
        security=components.Security(
            username="",
            password="",
        ),
    ) as moov:
        # Rest of application here...

Debugging

You can setup your SDK to emit debug logs for SDK requests and responses.

You can pass your own logger class directly into your SDK.

from moovio_sdk import Moov
import logging

logging.basicConfig(level=logging.DEBUG)
s = Moov(debug_logger=logging.getLogger("moovio_sdk"))

You can also enable a default debug logger by setting an environment variable MOOV_DEBUG to true.

Development

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

SDK Created by Speakeasy