Using the API
API Endpoint
All API requests are sent to Re:infer as JSON objects to an endpoint over HTTPS.
Development and production environments
In Re:infer, development and production data and workflows are separated by placing them in separate organisations, each of which is permissioned separately (so that developers can have admin access in the development organisations while having stricter access controls in production). Both development and production data are accessed over the same API URL.
Authentication
All API requests require authentication to identify the user making the request. Authentication is provided through an access token. The developer access token can be obtained from your Manage Account page.
You need to include the following HTTP header for every API call you make, where $REINFER_TOKEN
is your Re:infer API token.
The bash examples in the API Reference assume that you have saved your token in an environment variable. The Python and Node examples in the API Reference assume that the token has been stored in a local variable REINFER_TOKEN
via your chosen config solution.
- Bash
- Node
- Python
- Response
Permissions
Each API endpoint in the API Reference lists its required permissions. You can view the permissions you have by going to your Manage Account page. The page shows the Organisations you have access to and the Permissions you have in each organisation.
Errors
We use conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx
range indicate success, codes in the 4xx
range indicate an error that resulted from the provided request and codes in the 5xx
range indicate a problem with the Re:infer platform.
Requests that error will also return a body with a status
value of error
instead of ok
, and an error message describing the error.
- Bash
- Node
- Python
- Response
Note that your request can fail due to issues in your network before it reaches Re:infer. In such cases the response you receive will look different from the Re:infer error response described above.
Performance Timing
We use the Server-Timing HTTP header to communicate the time taken for requests to our API to be processed. We include a single metric, total
, which you can use to measure how long our platform took to process your request free from latency of the network request.
An example of the header as it will be seen in a response:
Server-Timing
values are always in milliseconds, so in this case the API request with this header value took 37.7 milliseconds to process on our platform.