Integrate External Services with the CTO.ai API
It’s possible to collect Insights Events data from any external platform via our Workflow Events API. If your team doesn’t use GitHub, wants to start collecting Events from other CI/CD systems, or needs more control over how Events are sent to the CTO.ai platform, our API lets you build an event collection system that meets your requirements.
Gain Insight from Any Platform
Before you begin, you may want to review our documentation on Insights Events to better understand the concepts implemented by our API.
API Tokens
You need an API token to use this feature. Before you can generate your API token, you must contact support for a ClientID
and ClientSecret
. Store the credentials you receive from us somewhere safe.
Using the CTO.ai CLI, sign in to your existing CTO.ai user account by running the ops account:signin
command (or ops account:signup
if you don’t already have an account with us). After you have signed in, you can generate a new API token using the credentials you received from CTO.ai support:
ops generate:token
When prompted by the CLI, enter your ClientID
, ClientSecret
, and CTO.ai account password. Your new token will then be generated.
Copy the newly-generated API token returned by the CLI and store it somewhere safe, as anyone with this token can use it to access the CTO.ai API on your behalf.
Team UUID
Sending data to the CTO.ai platform requires you to specify which CTO.ai team should receive the data, via its UUID.
Using the ops team:switch
command of the CTO.ai CLI, switch to the team that should be receiving events from your external application:
ops team:switch
Then, run the ops team:info
command to get your team’s UUID:
ops team:info
This will print out information about your current team, including the team UUID.
POSTing Insights Events
The Workflow Events API endpoint is located at:
https://events.cto.ai/
It can accept the Deployment Events defined in our Insights Events documentation.
Example HTTP API Request
This is an example HTTP request for posting data to the CTO.ai Workflow Events API. Please note a few important points about this command line snippet:
your_api_token
should be replaced with the API token you retrieved with the CTO.ai CLI.YOUR_TEAM_ID_HERE
should be replaced with the team UUID you retrieved with the CTO.ai CLI.- The value for the key
event_action
should be eithersuccess
orfailure
, depending on the actual deployment status. - The values for
repo
,environment
,branch
,commit
,image
, andmeta
are all specific to each deployment.
Review our Deployment Events documentation on the Insights Events page for more information about events that are accepted by our API.