Lithic.Resources.AuthRules (Lithic v1.0.0)

Copy Markdown View Source

Auth Rules V2 — real-time card authorization controls.

Supports: Conditional Action Rules, Velocity Limit Rules, Hold Adjustment Rules, Custom Code Rules (TypeScript→WASM), and Authorization Challenges.

Lifecycle

# Create a velocity rule
{:ok, rule} = Lithic.AuthRules.create(%{
  name: "Daily spend limit",
  parameters: %{
    scope: "CARD",
    limits: [%{limit: 100_00, period: "DAY"}]
  }
})

# Draft → promote versioning
{:ok, _} = Lithic.AuthRules.draft(rule["token"], %{parameters: updated_params})
{:ok, _} = Lithic.AuthRules.promote(rule["token"])

# Backtest against historical data
{:ok, backtest} = Lithic.AuthRules.request_backtest(rule["token"], %{
  start: "2024-01-01T00:00:00Z",
  end: "2024-03-01T00:00:00Z"
})

Summary

Functions

Draft a new version of a rule without activating it.

Get calculated feature/signal values for a rule.

Retrieve a performance report for a rule.

List backtests for a rule.

List rule evaluation results.

List versions of a rule.

Promote the drafted version of a rule to active.

Request a backtest of a rule against historical transactions.

Functions

create(params, opts \\ [])

@spec create(
  map(),
  keyword()
) :: {:ok, map()} | {:error, Lithic.Error.t()}

delete(rule_token, opts \\ [])

@spec delete(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Lithic.Error.t()}

draft(rule_token, params, opts \\ [])

@spec draft(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Lithic.Error.t()}

Draft a new version of a rule without activating it.

get(rule_token, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Lithic.Error.t()}

get_backtest(rule_token, backtest_token, opts \\ [])

@spec get_backtest(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Lithic.Error.t()}

Get backtest results.

get_calculated_features(rule_token, opts \\ [])

@spec get_calculated_features(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Lithic.Error.t()}

Get calculated feature/signal values for a rule.

get_performance_report(rule_token, opts \\ [])

@spec get_performance_report(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Lithic.Error.t()}

Retrieve a performance report for a rule.

list(opts \\ [])

@spec list(keyword()) :: {:ok, Lithic.Page.t(map())} | {:error, Lithic.Error.t()}

list_backtests(rule_token, opts \\ [])

@spec list_backtests(
  String.t(),
  keyword()
) :: {:ok, Lithic.Page.t(map())} | {:error, Lithic.Error.t()}

List backtests for a rule.

list_evaluation_results(rule_token, opts \\ [])

@spec list_evaluation_results(
  String.t(),
  keyword()
) :: {:ok, Lithic.Page.t(map())} | {:error, Lithic.Error.t()}

List rule evaluation results.

list_versions(rule_token, opts \\ [])

@spec list_versions(
  String.t(),
  keyword()
) :: {:ok, Lithic.Page.t(map())} | {:error, Lithic.Error.t()}

List versions of a rule.

promote(rule_token, opts \\ [])

@spec promote(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Lithic.Error.t()}

Promote the drafted version of a rule to active.

request_backtest(rule_token, params, opts \\ [])

@spec request_backtest(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Lithic.Error.t()}

Request a backtest of a rule against historical transactions.

stream(opts \\ [])

@spec stream(keyword()) :: Enumerable.t()

update(rule_token, params, opts \\ [])

@spec update(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Lithic.Error.t()}