Skip to main content
The server stores every saved contract version. Use these endpoints to save new contracts, see what’s saved and remove contracts you no longer need.

Save a contract

Send the contract’s source as the plain-text body of POST /contracts:
The server parses the script before saving it. If it’s valid, the server responds with 201 Created:
  • If the source has a syntax error, the contract isn’t saved and the server responds with 400 and a LexError or ParseError.
  • If that path, name and version already exists, the server responds with 409 and a ContractExists error. Save it under a new version instead.
Saving only checks that the script parses. Problems that appear while running, such as a type mismatch or an unknown resource, are reported when the contract is invoked.

List contracts

GET /contracts returns every saved contract version with its parameters:

Delete a contract

Delete every version of a contract:
Delete a single version by adding @<version>:
A successful delete responds with 204 No Content. If no matching contract exists, the server responds with 404 and an UnknownContract error.
Deleting can’t be undone. Anyone invoking a deleted version, or the latest version after all versions are deleted, gets a 404.