Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.123.0"
".": "0.124.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 190
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-0f374e78a0212145a2f55a55dfc39a612de19094d5152ae26b1bc74b01b9e343.yml
openapi_spec_hash: ec888cdaebea979a2cd6231ca04c346c
config_hash: 01dfc901bb6d54b0f582155d779bcbe0
configured_endpoints: 192
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-00f07b0edcc0c3c5ef79920ced7f58dac2434df5e4c27ff6041783e8228315f9.yml
openapi_spec_hash: 963688b09480159a06865075c94a2577
config_hash: 265a2b679964f4ad5706de101ad2a942
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.124.0 (2026-05-08)

Full Changelog: [v0.123.0...v0.124.0](https://github.com/lithic-com/lithic-python/compare/v0.123.0...v0.124.0)

### Features

* **api:** add retrieve_signals method to accounts and cards ([6e1649a](https://github.com/lithic-com/lithic-python/commit/6e1649ad7ee7ca58316891747b24c3f4773553d9))
* **api:** add unit parameter and travel/distance attributes to auth_rules ([02bd0f0](https://github.com/lithic-com/lithic-python/commit/02bd0f021353f6ddb9e930f3e5515c0636adfb29))


### Bug Fixes

* **client:** add missing f-string prefix in file type error message ([826938a](https://github.com/lithic-com/lithic-python/commit/826938aec1590a333b0e377dc6f99c9e14e96cdf))

## 0.123.0 (2026-05-06)

Full Changelog: [v0.122.0...v0.123.0](https://github.com/lithic-com/lithic-python/compare/v0.122.0...v0.123.0)
Expand Down
8 changes: 8 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Methods:
- <code title="get /v1/accounts/{account_token}">client.accounts.<a href="./src/lithic/resources/accounts.py">retrieve</a>(account_token) -> <a href="./src/lithic/types/account.py">Account</a></code>
- <code title="patch /v1/accounts/{account_token}">client.accounts.<a href="./src/lithic/resources/accounts.py">update</a>(account_token, \*\*<a href="src/lithic/types/account_update_params.py">params</a>) -> <a href="./src/lithic/types/account.py">Account</a></code>
- <code title="get /v1/accounts">client.accounts.<a href="./src/lithic/resources/accounts.py">list</a>(\*\*<a href="src/lithic/types/account_list_params.py">params</a>) -> <a href="./src/lithic/types/account.py">SyncCursorPage[Account]</a></code>
- <code title="get /v1/accounts/{account_token}/signals">client.accounts.<a href="./src/lithic/resources/accounts.py">retrieve_signals</a>(account_token) -> <a href="./src/lithic/types/signals_response.py">SignalsResponse</a></code>
- <code title="get /v1/accounts/{account_token}/spend_limits">client.accounts.<a href="./src/lithic/resources/accounts.py">retrieve_spend_limits</a>(account_token) -> <a href="./src/lithic/types/account_spend_limits.py">AccountSpendLimits</a></code>

# AccountHolders
Expand Down Expand Up @@ -88,6 +89,12 @@ Methods:

# AuthRules

Types:

```python
from lithic.types import SignalsResponse
```

## V2

Types:
Expand Down Expand Up @@ -233,6 +240,7 @@ Methods:
- <code title="post /v1/cards/{card_token}/provision">client.cards.<a href="./src/lithic/resources/cards/cards.py">provision</a>(card_token, \*\*<a href="src/lithic/types/card_provision_params.py">params</a>) -> <a href="./src/lithic/types/card_provision_response.py">CardProvisionResponse</a></code>
- <code title="post /v1/cards/{card_token}/reissue">client.cards.<a href="./src/lithic/resources/cards/cards.py">reissue</a>(card_token, \*\*<a href="src/lithic/types/card_reissue_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
- <code title="post /v1/cards/{card_token}/renew">client.cards.<a href="./src/lithic/resources/cards/cards.py">renew</a>(card_token, \*\*<a href="src/lithic/types/card_renew_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
- <code title="get /v1/cards/{card_token}/signals">client.cards.<a href="./src/lithic/resources/cards/cards.py">retrieve_signals</a>(card_token) -> <a href="./src/lithic/types/signals_response.py">SignalsResponse</a></code>
- <code title="get /v1/cards/{card_token}/spend_limits">client.cards.<a href="./src/lithic/resources/cards/cards.py">retrieve_spend_limits</a>(card_token) -> <a href="./src/lithic/types/card_spend_limits.py">CardSpendLimits</a></code>
- <code title="post /v1/cards/search_by_pan">client.cards.<a href="./src/lithic/resources/cards/cards.py">search_by_pan</a>(\*\*<a href="src/lithic/types/card_search_by_pan_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
- <code title="post /v1/cards/{card_token}/web_provision">client.cards.<a href="./src/lithic/resources/cards/cards.py">web_provision</a>(card_token, \*\*<a href="src/lithic/types/card_web_provision_params.py">params</a>) -> <a href="./src/lithic/types/card_web_provision_response.py">CardWebProvisionResponse</a></code>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "lithic"
version = "0.123.0"
version = "0.124.0"
description = "The official Python library for the lithic API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/lithic/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles
elif is_sequence_t(files):
files = [(key, await _async_transform_file(file)) for key, file in files]
else:
raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence")
raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence")

return files

Expand Down
2 changes: 1 addition & 1 deletion src/lithic/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "lithic"
__version__ = "0.123.0" # x-release-please-version
__version__ = "0.124.0" # x-release-please-version
93 changes: 93 additions & 0 deletions src/lithic/resources/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ..pagination import SyncCursorPage, AsyncCursorPage
from .._base_client import AsyncPaginator, make_request_options
from ..types.account import Account
from ..types.signals_response import SignalsResponse
from ..types.account_spend_limits import AccountSpendLimits

__all__ = ["Accounts", "AsyncAccounts"]
Expand Down Expand Up @@ -259,6 +260,46 @@ def list(
model=Account,
)

def retrieve_signals(
self,
account_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SignalsResponse:
"""
Returns behavioral feature state derived from an account's transaction history.

These signals expose the same data used by behavioral rule attributes (e.g.
`AMOUNT_Z_SCORE` with `scope: ACCOUNT`, `IS_NEW_COUNTRY` with `scope: ACCOUNT`)
and custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to
inspect feature values before writing rules and debug rule behavior.

Note: 3DS fields are not available at the account scope and will be null.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_token:
raise ValueError(f"Expected a non-empty value for `account_token` but received {account_token!r}")
return self._get(
path_template("/v1/accounts/{account_token}/signals", account_token=account_token),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=SignalsResponse,
)

def retrieve_spend_limits(
self,
account_token: str,
Expand Down Expand Up @@ -533,6 +574,46 @@ def list(
model=Account,
)

async def retrieve_signals(
self,
account_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SignalsResponse:
"""
Returns behavioral feature state derived from an account's transaction history.

These signals expose the same data used by behavioral rule attributes (e.g.
`AMOUNT_Z_SCORE` with `scope: ACCOUNT`, `IS_NEW_COUNTRY` with `scope: ACCOUNT`)
and custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to
inspect feature values before writing rules and debug rule behavior.

Note: 3DS fields are not available at the account scope and will be null.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_token:
raise ValueError(f"Expected a non-empty value for `account_token` but received {account_token!r}")
return await self._get(
path_template("/v1/accounts/{account_token}/signals", account_token=account_token),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=SignalsResponse,
)

async def retrieve_spend_limits(
self,
account_token: str,
Expand Down Expand Up @@ -584,6 +665,9 @@ def __init__(self, accounts: Accounts) -> None:
self.list = _legacy_response.to_raw_response_wrapper(
accounts.list,
)
self.retrieve_signals = _legacy_response.to_raw_response_wrapper(
accounts.retrieve_signals,
)
self.retrieve_spend_limits = _legacy_response.to_raw_response_wrapper(
accounts.retrieve_spend_limits,
)
Expand All @@ -602,6 +686,9 @@ def __init__(self, accounts: AsyncAccounts) -> None:
self.list = _legacy_response.async_to_raw_response_wrapper(
accounts.list,
)
self.retrieve_signals = _legacy_response.async_to_raw_response_wrapper(
accounts.retrieve_signals,
)
self.retrieve_spend_limits = _legacy_response.async_to_raw_response_wrapper(
accounts.retrieve_spend_limits,
)
Expand All @@ -620,6 +707,9 @@ def __init__(self, accounts: Accounts) -> None:
self.list = to_streamed_response_wrapper(
accounts.list,
)
self.retrieve_signals = to_streamed_response_wrapper(
accounts.retrieve_signals,
)
self.retrieve_spend_limits = to_streamed_response_wrapper(
accounts.retrieve_spend_limits,
)
Expand All @@ -638,6 +728,9 @@ def __init__(self, accounts: AsyncAccounts) -> None:
self.list = async_to_streamed_response_wrapper(
accounts.list,
)
self.retrieve_signals = async_to_streamed_response_wrapper(
accounts.retrieve_signals,
)
self.retrieve_spend_limits = async_to_streamed_response_wrapper(
accounts.retrieve_spend_limits,
)
89 changes: 89 additions & 0 deletions src/lithic/resources/cards/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
FinancialTransactionsWithStreamingResponse,
AsyncFinancialTransactionsWithStreamingResponse,
)
from ...types.signals_response import SignalsResponse
from ...types.card_spend_limits import CardSpendLimits
from ...types.spend_limit_duration import SpendLimitDuration
from ...types.shared_params.carrier import Carrier
Expand Down Expand Up @@ -1110,6 +1111,44 @@ def renew(
cast_to=Card,
)

def retrieve_signals(
self,
card_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SignalsResponse:
"""
Returns behavioral feature state derived from a card's transaction history.

These signals expose the same data used by behavioral rule attributes (e.g.
`AMOUNT_Z_SCORE` with `scope: CARD`, `IS_NEW_COUNTRY` with `scope: CARD`) and
custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to inspect
feature values before writing rules and debug rule behavior.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not card_token:
raise ValueError(f"Expected a non-empty value for `card_token` but received {card_token!r}")
return self._get(
path_template("/v1/cards/{card_token}/signals", card_token=card_token),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=SignalsResponse,
)

def retrieve_spend_limits(
self,
card_token: str,
Expand Down Expand Up @@ -2300,6 +2339,44 @@ async def renew(
cast_to=Card,
)

async def retrieve_signals(
self,
card_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SignalsResponse:
"""
Returns behavioral feature state derived from a card's transaction history.

These signals expose the same data used by behavioral rule attributes (e.g.
`AMOUNT_Z_SCORE` with `scope: CARD`, `IS_NEW_COUNTRY` with `scope: CARD`) and
custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to inspect
feature values before writing rules and debug rule behavior.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not card_token:
raise ValueError(f"Expected a non-empty value for `card_token` but received {card_token!r}")
return await self._get(
path_template("/v1/cards/{card_token}/signals", card_token=card_token),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=SignalsResponse,
)

async def retrieve_spend_limits(
self,
card_token: str,
Expand Down Expand Up @@ -2474,6 +2551,9 @@ def __init__(self, cards: Cards) -> None:
self.renew = _legacy_response.to_raw_response_wrapper(
cards.renew,
)
self.retrieve_signals = _legacy_response.to_raw_response_wrapper(
cards.retrieve_signals,
)
self.retrieve_spend_limits = _legacy_response.to_raw_response_wrapper(
cards.retrieve_spend_limits,
)
Expand Down Expand Up @@ -2524,6 +2604,9 @@ def __init__(self, cards: AsyncCards) -> None:
self.renew = _legacy_response.async_to_raw_response_wrapper(
cards.renew,
)
self.retrieve_signals = _legacy_response.async_to_raw_response_wrapper(
cards.retrieve_signals,
)
self.retrieve_spend_limits = _legacy_response.async_to_raw_response_wrapper(
cards.retrieve_spend_limits,
)
Expand Down Expand Up @@ -2574,6 +2657,9 @@ def __init__(self, cards: Cards) -> None:
self.renew = to_streamed_response_wrapper(
cards.renew,
)
self.retrieve_signals = to_streamed_response_wrapper(
cards.retrieve_signals,
)
self.retrieve_spend_limits = to_streamed_response_wrapper(
cards.retrieve_spend_limits,
)
Expand Down Expand Up @@ -2624,6 +2710,9 @@ def __init__(self, cards: AsyncCards) -> None:
self.renew = async_to_streamed_response_wrapper(
cards.renew,
)
self.retrieve_signals = async_to_streamed_response_wrapper(
cards.retrieve_signals,
)
self.retrieve_spend_limits = async_to_streamed_response_wrapper(
cards.retrieve_spend_limits,
)
Expand Down
1 change: 1 addition & 0 deletions src/lithic/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from .hold_list_params import HoldListParams as HoldListParams
from .hold_void_params import HoldVoidParams as HoldVoidParams
from .kyc_exempt_param import KYCExemptParam as KYCExemptParam
from .signals_response import SignalsResponse as SignalsResponse
from .statement_totals import StatementTotals as StatementTotals
from .card_embed_params import CardEmbedParams as CardEmbedParams
from .card_renew_params import CardRenewParams as CardRenewParams
Expand Down
Loading