Skip to main content
POST
/
event-subscriptions
Create an event subscription
curl --request POST \
  --url https://api.getdialed.ai/flows/event-subscriptions \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "definition_id": "def_a1b2c3d4",
  "enabled": true,
  "event_type": "call.completed"
}
'
import requests

url = "https://api.getdialed.ai/flows/event-subscriptions"

payload = {
"definition_id": "def_a1b2c3d4",
"enabled": True,
"event_type": "call.completed"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({definition_id: 'def_a1b2c3d4', enabled: true, event_type: 'call.completed'})
};

fetch('https://api.getdialed.ai/flows/event-subscriptions', 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://api.getdialed.ai/flows/event-subscriptions",
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([
'definition_id' => 'def_a1b2c3d4',
'enabled' => true,
'event_type' => 'call.completed'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$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://api.getdialed.ai/flows/event-subscriptions"

payload := strings.NewReader("{\n \"definition_id\": \"def_a1b2c3d4\",\n \"enabled\": true,\n \"event_type\": \"call.completed\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
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://api.getdialed.ai/flows/event-subscriptions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"definition_id\": \"def_a1b2c3d4\",\n \"enabled\": true,\n \"event_type\": \"call.completed\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.getdialed.ai/flows/event-subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"definition_id\": \"def_a1b2c3d4\",\n \"enabled\": true,\n \"event_type\": \"call.completed\"\n}"

response = http.request(request)
puts response.read_body
{
  "created_at": "2026-07-09T09:00:00Z",
  "definition_id": "def_a1b2c3d4",
  "enabled": true,
  "event_type": "call.completed",
  "id": "evsub_1a2b3c4d5e6f",
  "org_id": "org_e5f6g7h8",
  "updated_at": "2026-07-09T09:00:00Z"
}
{
"detail": "Authentication required"
}
{
"detail": "Admin role required"
}
{
"detail": "Definition not found"
}
{
"detail": "Validation error"
}
{
"detail": "Rate limit exceeded"
}

Authorizations

X-API-Key
string
header
required

Body

application/json

POST /event-subscriptions body.

event_type
string
required
Minimum string length: 1
definition_id
string
required
enabled
boolean
default:true

Response

Successful Response

GET response.

id
string
required
org_id
string
required
event_type
string
required
definition_id
string
required
enabled
boolean
required
created_at
string<date-time>
required
updated_at
string<date-time>
required