Getting started
The Teleport API is organized around REST. It uses standard HTTP verbs, authentication and response codes. It accepts JSON-encoded request bodies and also returns JSON-encoded responses. To describe requests and responses, this documentation display them as Typescript interfaces.
The base URL of the Teleport API is https://api.teleport.withthegrid.com
.
Autentication
The Teleport API uses tokens to authenticate requests. You must send an Authorization header (Authorization: Bearer [token]
) with your request.
TIP
If you do have a Teleport but no token, contact us at support@withthegrid.com to get one.
Encoding
As stated in the introduction, request and response bodies are JSON-encoded. Date-objects in JSON should be communicated as ISO 8601 strings, specifically as yyyy-mm-ddThh:mm:ss[.mmm]Z
.
Errors
Errors are returned by using the 4xx (for client side) and 5xx (for server side) HTTP status codes. The response contains a JSON-encoded body: { key: string, details?: unknown }
. The key
is unique for the HTTP status code and can be used for automated client side error handling. The details
property (if present) contains debugging information that can help fixing the issue. Specific routes can return specific errors, which are listed with that route. In addition, every route can return the following generic errors.