Authentication
Everything the dashboard does is available over the API. It is a plain REST service, so any language that can make an HTTP request can use it.
Base URL
https://api.glytos.com/api/v1API keys
Create a key under API keys in the dashboard. It is shown once, at creation - it is stored hashed and cannot be retrieved afterwards. If you lose it, create another and delete the old one.
Send it as a bearer token:
curl https://api.glytos.com/api/v1/workflows \
-H "Authorization: Bearer $GLYTOS_API_KEY"const response = await fetch('https://api.glytos.com/api/v1/workflows', {
headers: { Authorization: `Bearer ${process.env.GLYTOS_API_KEY}` },
});
const agents = await response.json();import os, httpx
response = httpx.get(
"https://api.glytos.com/api/v1/workflows",
headers={"Authorization": f"Bearer {os.environ['GLYTOS_API_KEY']}"},
)
agents = response.json()$client = new \GuzzleHttp\Client(['base_uri' => 'https://api.glytos.com/api/v1/']);
$response = $client->get('workflows', [
'headers' => ['Authorization' => 'Bearer ' . getenv('GLYTOS_API_KEY')],
]);
$agents = json_decode((string) $response->getBody(), true);use Illuminate\Support\Facades\Http;
$agents = Http::withToken(config('services.glytos.key'))
->baseUrl('https://api.glytos.com/api/v1')
->get('workflows')
->json();req, _ := http.NewRequest("GET", "https://api.glytos.com/api/v1/workflows", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("GLYTOS_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()require 'net/http'
uri = URI('https://api.glytos.com/api/v1/workflows')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = "Bearer #{ENV['GLYTOS_API_KEY']}"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("GLYTOS_API_KEY"));
var agents = await client.GetStringAsync("https://api.glytos.com/api/v1/workflows");An API key belongs on your server, never in a browser, a mobile app or a public repository. For voice in a browser, mint a short-lived web-call token server-side instead - see Web calls.
Scope
A key belongs to one organization, and requests act within it. To work across organizations, use a key from each.
Starting a conversation
Open a text session against an agent, seeding any variables it should know:
curl -X POST https://api.glytos.com/api/v1/workflows/$AGENT_UUID/sessions \
-H "Authorization: Bearer $GLYTOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"variables": {"customer_name": "Ada"}}'import { Glytos } from '@glytos/node';
const glytos = new Glytos({ apiKey: process.env.GLYTOS_API_KEY! });
const session = await glytos.sessions.create(agentUuid, {
variables: { customer_name: 'Ada' },
});from glytos import Glytos
glytos = Glytos(api_key=os.environ["GLYTOS_API_KEY"])
session = glytos.sessions.create(agent_uuid, variables={"customer_name": "Ada"})$session = Http::withToken(config('services.glytos.key'))
->baseUrl('https://api.glytos.com/api/v1')
->post("workflows/{$agentUuid}/sessions", [
'variables' => ['customer_name' => 'Ada'],
])
->json();Then read the reference for everything else, or use an SDK and skip the plumbing.