SDKs & Libraries
Official AltFiScore SDKs give you a typed, ergonomic client for the decisioning API — with idempotency, polling for consumer-action flows, and structured error handling built in. Available for Python and Node.js, or call the REST API directly from any language.
Same API, three ways to call it
Official SDKs
Install
Install the SDK
# No install needed — call the REST API directly
curl https://api.altfiscore.com/v1/decisions/bnpl \
-H 'Authorization: Bearer altfi_test_YOUR_KEY'The Python SDK requires Python 3.9+. The Node.js SDK requires Node 18+ (it uses the built-in fetch) and ships with TypeScript types.
Authenticate
Every SDK is constructed with your API key. Test keys are prefixed altfi_test_; live keys altfi_live_. See authentication for how keys map to environments. Never expose a live key in client-side code.
Quickstart
Create a BNPL decision. The same shape applies to every product — auto_loan, mortgage, personal_loan, and credit_card — each with its own typed parameters.
Create a decision
curl https://api.altfiscore.com/v1/decisions/bnpl \
-H 'Authorization: Bearer altfi_test_...' \
-H 'Content-Type: application/json' \
-d '{
"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
}
}'A decline is not an error
decision.is_declined (Python) or decision.isDeclined (Node), not a try/except block.Product methods
Each product is a method on client.decisions:
Python
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=...)Node.js
await client.decisions.bnpl({ consumer, order });
await client.decisions.autoLoan({ consumer, loan, vehicle, dealer });
await client.decisions.mortgage({ consumer, loan, property });
await client.decisions.personalLoan({ consumer, loan });
await client.decisions.creditCard({ consumer, product });Pending decisions & polling
Larger amounts trigger enhanced or hard KYC and return a pending decision with a consumer_complete_url. Send the consumer there, then poll until the decision is final. Both SDKs include a built-in poll helper.
Poll a pending decision
# Poll the decision until it is no longer needs_consumer_action
curl https://api.altfiscore.com/v1/decisions/mortgage/DECISION_ID \
-H 'Authorization: Bearer altfi_test_...'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. The SDKs also automatically retry idempotent requests on connection errors and 5xx responses. See idempotency.
Python
decision = client.decisions.bnpl(
consumer=consumer, order=order,
idempotency_key="order-98a7f3",
)Node.js
const decision = await client.decisions.bnpl({
consumer, order,
idempotencyKey: "order-98a7f3",
});Error handling
Both SDKs expose a typed exception hierarchy so you can branch on the failure kind. See the errors reference for the full catalog.
Handle errors
# HTTP status codes indicate transport/API errors.
# A declined applicant is still HTTP 200 with "outcome": "declined".
# 400 invalid_request — malformed body
# 401 invalid_api_key — bad or missing key
# 409 idempotency_conflict
# 422 unprocessable_entity
# 429 rate_limitedOther languages
Working in a language without an official SDK? The REST API is straightforward to call from anything that can make an HTTP request. Start with the quickstart and the API reference. A Postman collection is also available for exploring endpoints interactively.
Next steps
- Follow the quickstart end to end
- Review authentication and environments
- Handle declines with the compliance guide
- Browse per-product endpoints under API reference