Skip to main content
Invoke a saved contract with a POST request to /run/ followed by its path and name. Pass parameters as a JSON object under the parameters key.

Build the URL

Replace each dot in the contract’s path with a slash, and end with the contract’s name: Without a version, the latest version runs. See Versioning.

Pass parameters

The request body is a JSON object with a parameters object inside it:
  • Every declared parameter must be supplied. Use null to pass no value.
  • Parameters the contract doesn’t declare are rejected.
  • For a contract without parameters, send {} or leave out the body entirely.
If a parameter is missing, unknown or has the wrong type, the server responds with 400 and a ParameterError:

How JSON becomes RequestScript values

Each parameter is converted from JSON to its declared type: Numbers aren’t converted to strings, strings aren’t converted to booleans, and so on. A value of the wrong kind is a ParameterError.

Sending large or precise numbers

JSON numbers lose precision in many clients once they go beyond about 15 significant digits. For int64 and decimal parameters, send the value as a string to keep every digit. Whole numbers larger than 9,007,199,254,740,991 must be sent as strings: sent as JSON numbers, they’re rejected with a ParameterError.

Values inside objects

An object parameter has no declared types for its properties, so their types are inferred: whole numbers become int32, or int64 if they’re too big for int32, and other numbers become decimal.

The response

A successful invocation returns 200 with the script’s return value:
See JSON encoding for how each type appears in the response, and Errors for every error response.