Rest API
Introduction to the CloudTruth API

Introduction

Does CloudTruth have an API? Of course we do!
The CloudTruth API is the same API used by our SaaS offering. Anything that you can do in our GUI, you can do programmatically via the API.

Overview

The CloudTruth API is a pretty standard RESTful-like HTTP API. You perform GET, PUT, POST, PATCH and DELETE operations models hosted by our web service. Operations require a JWT or API Access Token in the Authorization header of the call. Parameters are passed to the web service via JSON in the body of the request. Results are returned as JSON structures in the body of the response.
Our complete REST API documentation is automatically generated and can be found here:
CloudTruth Management API
We also provide an interactive web interface to the API:
CloudTruth Management API

Getting Started

We will start you off with a basic example of a GET operation that will list your CloudTruth Environments. From the environment_list schema docs we can find the GET request query parameters and typical response.
get
https://api.cloudtruth.io/api/v1/
environments/
environments_list
Now you can issue a get request with your API Access token, here is a basic example in Python and Bash to get you going.
Python
Bash
import requests
token = "Your API Access token"
headers = {'Authorization': f'Api-Key {token}'}
url = "https://api.cloudtruth.io/api/v1/environments/"
response = requests.get(url, headers=headers)
environments = response.json()
print(json.dumps(environments, indent=4, sort_keys=True))
token="Your API Access token"
curl -s --header "Content-Type: application/json" \
--header "Authorization: Api-Key ${token}" \
--request GET \
https://api.cloudtruth.io/api/v1/environments/
You can checkout out our repo for a few additional working examples.
GitHub - cloudtruth-demo/rest-api-examples: Demo RESTful API code that interacts with CloudTruth
GitHub
Copy link
On this page
Introduction
Overview
Getting Started
get
environments_list