Create endpoint
curl --request POST \
--url https://akapulu.com/api/endpoints/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Book Appointment",
"url": "https://api.yourcompany.com/v1/book-appointment",
"headers": {
"Authorization": "Bearer {{secret.crm_token}}"
},
"body": {
"patient_id": "{{runtime.patient_id}}"
}
}
'import requests
url = "https://akapulu.com/api/endpoints/create"
payload = {
"name": "Book Appointment",
"url": "https://api.yourcompany.com/v1/book-appointment",
"headers": { "Authorization": "Bearer {{secret.crm_token}}" },
"body": { "patient_id": "{{runtime.patient_id}}" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Book Appointment',
url: 'https://api.yourcompany.com/v1/book-appointment',
headers: {Authorization: 'Bearer {{secret.crm_token}}'},
body: JSON.stringify({patient_id: '{{runtime.patient_id}}'})
})
};
fetch('https://akapulu.com/api/endpoints/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://akapulu.com/api/endpoints/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Book Appointment',
'url' => 'https://api.yourcompany.com/v1/book-appointment',
'headers' => [
'Authorization' => 'Bearer {{secret.crm_token}}'
],
'body' => [
'patient_id' => '{{runtime.patient_id}}'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://akapulu.com/api/endpoints/create"
payload := strings.NewReader("{\n \"name\": \"Book Appointment\",\n \"url\": \"https://api.yourcompany.com/v1/book-appointment\",\n \"headers\": {\n \"Authorization\": \"Bearer {{secret.crm_token}}\"\n },\n \"body\": {\n \"patient_id\": \"{{runtime.patient_id}}\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://akapulu.com/api/endpoints/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Book Appointment\",\n \"url\": \"https://api.yourcompany.com/v1/book-appointment\",\n \"headers\": {\n \"Authorization\": \"Bearer {{secret.crm_token}}\"\n },\n \"body\": {\n \"patient_id\": \"{{runtime.patient_id}}\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://akapulu.com/api/endpoints/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Book Appointment\",\n \"url\": \"https://api.yourcompany.com/v1/book-appointment\",\n \"headers\": {\n \"Authorization\": \"Bearer {{secret.crm_token}}\"\n },\n \"body\": {\n \"patient_id\": \"{{runtime.patient_id}}\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "created",
"id": "22222222-3333-4444-5555-666666666666"
}{
"error": "name is required"
}{
"error": "Invalid API key"
}Endpoints
Create Endpoint
Create an HTTP endpoint the assistant can call from a scenario tool.
POST
/
endpoints
/
create
Create endpoint
curl --request POST \
--url https://akapulu.com/api/endpoints/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Book Appointment",
"url": "https://api.yourcompany.com/v1/book-appointment",
"headers": {
"Authorization": "Bearer {{secret.crm_token}}"
},
"body": {
"patient_id": "{{runtime.patient_id}}"
}
}
'import requests
url = "https://akapulu.com/api/endpoints/create"
payload = {
"name": "Book Appointment",
"url": "https://api.yourcompany.com/v1/book-appointment",
"headers": { "Authorization": "Bearer {{secret.crm_token}}" },
"body": { "patient_id": "{{runtime.patient_id}}" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Book Appointment',
url: 'https://api.yourcompany.com/v1/book-appointment',
headers: {Authorization: 'Bearer {{secret.crm_token}}'},
body: JSON.stringify({patient_id: '{{runtime.patient_id}}'})
})
};
fetch('https://akapulu.com/api/endpoints/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://akapulu.com/api/endpoints/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Book Appointment',
'url' => 'https://api.yourcompany.com/v1/book-appointment',
'headers' => [
'Authorization' => 'Bearer {{secret.crm_token}}'
],
'body' => [
'patient_id' => '{{runtime.patient_id}}'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://akapulu.com/api/endpoints/create"
payload := strings.NewReader("{\n \"name\": \"Book Appointment\",\n \"url\": \"https://api.yourcompany.com/v1/book-appointment\",\n \"headers\": {\n \"Authorization\": \"Bearer {{secret.crm_token}}\"\n },\n \"body\": {\n \"patient_id\": \"{{runtime.patient_id}}\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://akapulu.com/api/endpoints/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Book Appointment\",\n \"url\": \"https://api.yourcompany.com/v1/book-appointment\",\n \"headers\": {\n \"Authorization\": \"Bearer {{secret.crm_token}}\"\n },\n \"body\": {\n \"patient_id\": \"{{runtime.patient_id}}\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://akapulu.com/api/endpoints/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Book Appointment\",\n \"url\": \"https://api.yourcompany.com/v1/book-appointment\",\n \"headers\": {\n \"Authorization\": \"Bearer {{secret.crm_token}}\"\n },\n \"body\": {\n \"patient_id\": \"{{runtime.patient_id}}\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "created",
"id": "22222222-3333-4444-5555-666666666666"
}{
"error": "name is required"
}{
"error": "Invalid API key"
}Create an HTTP endpoint the assistant can call from a scenario
http tool.
Required request fields:
name(unique per user)url
headers— JSON object. Put{{secret.*}}placeholders here, not inbody.body— JSON object. Use{{runtime.*}}/{{llm.*}}templates as needed.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
⌘I

