Create a gateway trigger
curl --request POST \
--url https://api.quiva.ai/trigger/gateway \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-gateway-trigger",
"collection": "my-collection",
"description": "Trigger for API gateway endpoint",
"trigger_type": "gateway",
"gateway_mapping": {
"method": "GET",
"path": "/api/resource",
"is_public": true,
"limit": {
"request": 1000,
"time": 1000
},
"timeout": 30000
}
}
'import requests
url = "https://api.quiva.ai/trigger/gateway"
payload = {
"name": "my-gateway-trigger",
"collection": "my-collection",
"description": "Trigger for API gateway endpoint",
"trigger_type": "gateway",
"gateway_mapping": {
"method": "GET",
"path": "/api/resource",
"is_public": True,
"limit": {
"request": 1000,
"time": 1000
},
"timeout": 30000
}
}
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: 'my-gateway-trigger',
collection: 'my-collection',
description: 'Trigger for API gateway endpoint',
trigger_type: 'gateway',
gateway_mapping: {
method: 'GET',
path: '/api/resource',
is_public: true,
limit: {request: 1000, time: 1000},
timeout: 30000
}
})
};
fetch('https://api.quiva.ai/trigger/gateway', 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.quiva.ai/trigger/gateway",
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' => 'my-gateway-trigger',
'collection' => 'my-collection',
'description' => 'Trigger for API gateway endpoint',
'trigger_type' => 'gateway',
'gateway_mapping' => [
'method' => 'GET',
'path' => '/api/resource',
'is_public' => true,
'limit' => [
'request' => 1000,
'time' => 1000
],
'timeout' => 30000
]
]),
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://api.quiva.ai/trigger/gateway"
payload := strings.NewReader("{\n \"name\": \"my-gateway-trigger\",\n \"collection\": \"my-collection\",\n \"description\": \"Trigger for API gateway endpoint\",\n \"trigger_type\": \"gateway\",\n \"gateway_mapping\": {\n \"method\": \"GET\",\n \"path\": \"/api/resource\",\n \"is_public\": true,\n \"limit\": {\n \"request\": 1000,\n \"time\": 1000\n },\n \"timeout\": 30000\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://api.quiva.ai/trigger/gateway")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-gateway-trigger\",\n \"collection\": \"my-collection\",\n \"description\": \"Trigger for API gateway endpoint\",\n \"trigger_type\": \"gateway\",\n \"gateway_mapping\": {\n \"method\": \"GET\",\n \"path\": \"/api/resource\",\n \"is_public\": true,\n \"limit\": {\n \"request\": 1000,\n \"time\": 1000\n },\n \"timeout\": 30000\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/trigger/gateway")
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\": \"my-gateway-trigger\",\n \"collection\": \"my-collection\",\n \"description\": \"Trigger for API gateway endpoint\",\n \"trigger_type\": \"gateway\",\n \"gateway_mapping\": {\n \"method\": \"GET\",\n \"path\": \"/api/resource\",\n \"is_public\": true,\n \"limit\": {\n \"request\": 1000,\n \"time\": 1000\n },\n \"timeout\": 30000\n }\n}"
response = http.request(request)
puts response.read_body{
"body": {
"name": "my-gateway-trigger",
"collection": "my-collection",
"gateway_mapping_subject": "ms.trigger.gateway.123456",
"stream": "quiva-trigger-config",
"subject": "ms.trigger.gateway.my-gateway-trigger",
"trigger_type": "gateway",
"type": "created"
},
"status_code": 201
}{
"error": "Invalid request: Missing required field 'name' in trigger definition",
"status_code": 400
}{
"error": "Unauthorized: Invalid or missing authentication token",
"status_code": 401
}{
"error": "Internal server error: Unable to process request at this time",
"status_code": 500
}Gateway Triggers
Create a gateway trigger
Creates a new gateway trigger for API endpoint management. A gateway trigger establishes an HTTP endpoint that can be accessed from outside the system and routes requests to appropriate handlers.
Usage Notes:
- The system automatically generates a unique topic for your gateway trigger
- Default timeout is 30 seconds (30000ms) if not specified
- Gateway mappings define the HTTP method, path, and access controls
- Setting
is_public: trueallows the endpoint to be accessed without authentication - Rate limits can be configured per endpoint
- After creation, the gateway endpoint is immediately available for traffic
- The response includes the full subject identifier which may be needed for other operations
POST
/
trigger
/
gateway
Create a gateway trigger
curl --request POST \
--url https://api.quiva.ai/trigger/gateway \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-gateway-trigger",
"collection": "my-collection",
"description": "Trigger for API gateway endpoint",
"trigger_type": "gateway",
"gateway_mapping": {
"method": "GET",
"path": "/api/resource",
"is_public": true,
"limit": {
"request": 1000,
"time": 1000
},
"timeout": 30000
}
}
'import requests
url = "https://api.quiva.ai/trigger/gateway"
payload = {
"name": "my-gateway-trigger",
"collection": "my-collection",
"description": "Trigger for API gateway endpoint",
"trigger_type": "gateway",
"gateway_mapping": {
"method": "GET",
"path": "/api/resource",
"is_public": True,
"limit": {
"request": 1000,
"time": 1000
},
"timeout": 30000
}
}
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: 'my-gateway-trigger',
collection: 'my-collection',
description: 'Trigger for API gateway endpoint',
trigger_type: 'gateway',
gateway_mapping: {
method: 'GET',
path: '/api/resource',
is_public: true,
limit: {request: 1000, time: 1000},
timeout: 30000
}
})
};
fetch('https://api.quiva.ai/trigger/gateway', 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.quiva.ai/trigger/gateway",
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' => 'my-gateway-trigger',
'collection' => 'my-collection',
'description' => 'Trigger for API gateway endpoint',
'trigger_type' => 'gateway',
'gateway_mapping' => [
'method' => 'GET',
'path' => '/api/resource',
'is_public' => true,
'limit' => [
'request' => 1000,
'time' => 1000
],
'timeout' => 30000
]
]),
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://api.quiva.ai/trigger/gateway"
payload := strings.NewReader("{\n \"name\": \"my-gateway-trigger\",\n \"collection\": \"my-collection\",\n \"description\": \"Trigger for API gateway endpoint\",\n \"trigger_type\": \"gateway\",\n \"gateway_mapping\": {\n \"method\": \"GET\",\n \"path\": \"/api/resource\",\n \"is_public\": true,\n \"limit\": {\n \"request\": 1000,\n \"time\": 1000\n },\n \"timeout\": 30000\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://api.quiva.ai/trigger/gateway")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-gateway-trigger\",\n \"collection\": \"my-collection\",\n \"description\": \"Trigger for API gateway endpoint\",\n \"trigger_type\": \"gateway\",\n \"gateway_mapping\": {\n \"method\": \"GET\",\n \"path\": \"/api/resource\",\n \"is_public\": true,\n \"limit\": {\n \"request\": 1000,\n \"time\": 1000\n },\n \"timeout\": 30000\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/trigger/gateway")
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\": \"my-gateway-trigger\",\n \"collection\": \"my-collection\",\n \"description\": \"Trigger for API gateway endpoint\",\n \"trigger_type\": \"gateway\",\n \"gateway_mapping\": {\n \"method\": \"GET\",\n \"path\": \"/api/resource\",\n \"is_public\": true,\n \"limit\": {\n \"request\": 1000,\n \"time\": 1000\n },\n \"timeout\": 30000\n }\n}"
response = http.request(request)
puts response.read_body{
"body": {
"name": "my-gateway-trigger",
"collection": "my-collection",
"gateway_mapping_subject": "ms.trigger.gateway.123456",
"stream": "quiva-trigger-config",
"subject": "ms.trigger.gateway.my-gateway-trigger",
"trigger_type": "gateway",
"type": "created"
},
"status_code": 201
}{
"error": "Invalid request: Missing required field 'name' in trigger definition",
"status_code": 400
}{
"error": "Unauthorized: Invalid or missing authentication token",
"status_code": 401
}{
"error": "Internal server error: Unable to process request at this time",
"status_code": 500
}Authorizations
bearerAuthapiKeyAuth
Body
application/json