Skip to main content

AltFiScore Python SDK

Official Python client for the AltFiScore alternative credit scoring and loan decisioning API.

Alternative credit scoring and decisioning infrastructure for banks, credit unions, fintechs, BNPL providers, and embedded lenders.

Installation

pip install altfiscore

Requires Python 3.9+.

Quickstart

from altfiscore import AltFiScore

client = AltFiScore(api_key="altfi_test_...")

decision = client.decisions.bnpl(
    consumer={
        "first_name": "Ada",
        "last_name": "Okoro",
        "email": "ada@example.com",
        "dob": "1990-01-15",
        "ssn_last4": "1234",
    },
    order={
        "amount": "450.00",
        "currency": "USD",
        "installment_count": 4,
    },
)

if decision.is_approved:
    print(f"Approved {decision.approved_amount} at {decision.apr}% APR")
    for installment in decision.payment_schedule:
        print(installment["due_date"], installment["amount"])
elif decision.is_referred:
    print("Counter-offer:", decision.counter_offer)
elif decision.is_declined:
    for reason in decision.decline_reasons:
        print(reason["code"], reason["reason"])

Products

Every product is a method on client.decisions:

client.decisions.bnpl(consumer=..., order=...)
client.decisions.auto_loan(consumer=..., loan=..., vehicle=..., dealer=...)
client.decisions.mortgage(consumer=..., loan=..., property=...)
client.decisions.personal_loan(consumer=..., loan=...)
client.decisions.credit_card(consumer=..., product=...)

Returning consumers

Pass a consumer_id instead of full PII to score a consumer you have already onboarded:

decision = client.decisions.personal_loan(
    consumer={"consumer_id": "b0c9ed84-f66c-4598-b50a-a0d8b2ddcd04"},
    loan={"amount": "12000.00", "currency": "USD", "term_months": 36},
)

Pending decisions (consumer verification)

Larger amounts trigger enhanced or hard KYC. When that happens the decision is returned in a pending state:

decision = client.decisions.mortgage(consumer=..., loan=..., property=...)

if decision.is_pending:
    # Redirect the consumer to complete verification
    print(decision.consumer_complete_url)

    # Then poll until the decision is final
    final = client.decisions.poll("mortgage", decision.decision_id, timeout=180)
    print(final.outcome)

Idempotency

Pass an idempotency_key to make create calls safe to retry. Reusing a key returns the original decision instead of creating a new one:

decision = client.decisions.bnpl(
    consumer=...,
    order=...,
    idempotency_key="order-98a7f3",
)

Error handling

from altfiscore import (
    AuthenticationError,
    InvalidRequestError,
    RateLimitError,
    APIError,
)

try:
    decision = client.decisions.bnpl(consumer=..., order=...)
except AuthenticationError:
    ...  # bad or revoked API key
except InvalidRequestError as e:
    ...  # 400/422 - inspect e.body for details
except RateLimitError:
    ...  # 429 - back off and retry
except APIError as e:
    ...  # 5xx or unexpected - e.status_code available

A declined applicant is not an error - it is a successful decision with decision.is_declined == True. Exceptions are only raised for transport and API-level failures.

Configuration

client = AltFiScore(
    api_key="altfi_live_...",
    base_url="https://api.altfiscore.com",  # override for sandbox/self-host
    timeout=30.0,                            # per-request seconds
    max_retries=2,                           # idempotent requests only
)

The client is also a context manager:

with AltFiScore(api_key="...") as client:
    decision = client.decisions.bnpl(consumer=..., order=...)

Documentation

Full API reference: https://altfiscore.com/developers

License

MIT

Metadata

Release files for altfiscore 0.1.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 altfiscore 0.1.0
File Size Uploaded Provenance Actions
altfiscore-0.1.0.tar.gz 8.1 kB Without provenance Details for altfiscore-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for altfiscore 0.1.0
File Interpreter ABI Platform Actions
altfiscore-0.1.0-py3-none-any.whl Python 3 none any Details for altfiscore-0.1.0-py3-none-any.whl

Total release size: 16.9 kB

Release files / altfiscore-0.1.0.tar.gz

Download URL altfiscore-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
21bf4565562ea1a5831adb2473e4ebe790b734d6c75d084f970b579c409d7a68
BLAKE2b-256 checksum
How to use checksums
4b8b1a46e4023bc2c46605681e2e7cf7d576642d1697d00300008d1e6d54ce21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / altfiscore-0.1.0-py3-none-any.whl

Download URL altfiscore-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ccef567241e0fbfafd56dfaaf98e6491959ed39d8358ee26f27a7d36a060d60
BLAKE2b-256 checksum
How to use checksums
1d41eb090e73839664e934dede543582a295e931c7597ff06d4ede03b47537ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for altfiscore 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.1.0 This release

2 release files No provenance

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