Menu

JSON and EDN

How bodies and answers are written: JSON with snake_case keys or EDN with kebab-case keywords, amounts as decimal strings.

  • JSON. Bodies and answers are JSON objects with snake_case keys, sent and answered as application/json.
  • EDN. A body may be sent as application/edn: a map with kebab-case keyword keys. It is read as data, never evaluated. An answer is EDN when the Accept header prefers application/edn, every refusal included.
  • Anything else is refused 415 unsupported-media-type.
  • Amounts (credits, credit charges) are decimal strings, such as "0.000123": read them as exact decimals, never as floating-point numbers.
  • Refusals are {"error": {"code", "message"}}: see errors.

In this reference, a path is written as the document has it: /domains/{domain} means the domain's name in its place. The examples are curl commands; $WEIRD_API_KEY stands for an API key and $WEIRD_ACCESS_TOKEN for a session's access token.

Credit charges#

One thing has a price: a credit (credit_price of GET /public/charges and GET /credits/topup: net, vat and total, VAT included). Everything else is a credit charge, in credits.

Credit charges are listed by GET /credits/charges: contract → rate → decimal credits, with the change that is scheduled, if any. An operation's charges (x-weird-charged) name a contract and a rate of that list, with:

  • billed: before (taken from the credits before the operation runs), after (charged after a successful answer; a refused or failed request is not charged; these are added up and booked hourly), once, hourly (while what it creates exists) or usage (per use);
  • times: what multiplies the rate.

So the exact credit charge can be shown before confirming. A charge the credits do not cover is refused 402 insufficient-funds.