Skip to navigation

Retrieve a price rule

Takes the ID or the key. Returns the version in force now.

Authentication

AuthorizationBearer

A secret key (rl_sk_test_..., rl_sk_live_...) or a restricted key with limited scopes (rl_rk_test_..., rl_rk_live_...). A restricted key can carry agent: true and an expires_at, and is what a coding agent should hold. Keys end in a checksum so secret scanners can recognize them. People create, roll and revoke keys in the dashboard; GET /v1/api_keys lists them, masked.

Path parameters

price_rulestringRequired

The price rule ID (pr_...) or its key.

Response

The price rule.
idstring
object"price_rule"
keystring
namestring
versioninteger
Starts at 1. Every update adds one.
methodenum

cost_plus: the cost of the usage plus a markup or a target margin. table: a price looked up by dimension values. formula: an expression.

Allowed values:
currencystring
The rule's currency. It matches its rate cards and the plans that use it. Prices are never converted.
on_cost_changeenumDefaults to hold

What the rule does when a new rate card changes the cost it prices from, whether you added it or Runledger published a new catalog price. hold: it keeps pricing from the versions in force when you last saved it, so the margin moves and a person decides whether to change the price from a later date. follow: the price follows the new card from its effective_from.

Allowed values:
livemodeboolean
created_atdatetime
descriptionstringOptional
effective_fromdatetimeOptional
basisenumOptionalDefaults to catalog

What cost_plus and formula rules take the cost from. catalog: the cost models and the event’s quantity and properties, the same at check() and track(). run_cost: the costs trace() recorded under the event’s run_id, for pass-through pricing after the work. check() can’t know that cost yet, so it prices from estimated_usage or, without it, from the observed average.

Allowed values:
inputslist of objectsOptional
markup_percentstringOptional
target_margin_percentstringOptional
rowslist of objectsOptional
formulastringOptional
floor_decimalstringOptional
cap_decimalstringOptional
credit_value_decimalstringOptional
priced_fromlist of objectsOptional

The rate card versions this version prices from. Under hold, they stay until the rule is saved again.

actorobjectOptional

Who made a change. Runledger fills it in from the credential, so a client can’t claim to be someone else: an API key always acts as itself, the dashboard calls the API as the signed-in person, and the MCP server passes the client’s name and the person it acts for. A request that sends a Runledger-Actor header is refused with 400 parameter_unknown.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error