Subscribes a delivery URI to a specific event/eventType pair. See the Webhooks guide for the full event catalog.
POST
/
api
/
webhook
/
subscriptions
Create an event subscription
curl --request POST \
--url https://gateway-api.guardhousehq.com/api/webhook/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'external-gh-apim-sub-key: <api-key>' \
--data '
{
"subscriberId": 123,
"uri": "<string>"
}
'import requests
url = "https://gateway-api.guardhousehq.com/api/webhook/subscriptions"
payload = {
"subscriberId": 123,
"uri": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"external-gh-apim-sub-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'external-gh-apim-sub-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({subscriberId: 123, uri: '<string>'})
};
fetch('https://gateway-api.guardhousehq.com/api/webhook/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://gateway-api.guardhousehq.com/api/webhook/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([
'subscriberId' => 123,
'uri' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"external-gh-apim-sub-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://gateway-api.guardhousehq.com/api/webhook/subscriptions"
payload := strings.NewReader("{\n \"subscriberId\": 123,\n \"uri\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("external-gh-apim-sub-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://gateway-api.guardhousehq.com/api/webhook/subscriptions")
.header("Authorization", "Bearer <token>")
.header("external-gh-apim-sub-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"subscriberId\": 123,\n \"uri\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway-api.guardhousehq.com/api/webhook/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["external-gh-apim-sub-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriberId\": 123,\n \"uri\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": {
"code": 123,
"errorMessage": "<string>"
},
"data": {
"id": 123,
"webhookSubscriberEventFilterId": 123,
"uri": "<string>",
"isActive": true,
"createdDateTime": "2023-11-07T05:31:56Z",
"modifiedDateTime": "2023-11-07T05:31:56Z"
},
"count": 123,
"message": "<string>",
"errors": [
{
"code": 100,
"message": "<string>"
}
]
}{
"status": {
"code": 123,
"errorMessage": "<string>"
},
"data": "<unknown>",
"count": 123,
"message": "<string>",
"errors": [
{
"code": 100,
"message": "<string>"
}
]
}{
"status": {
"code": 123,
"errorMessage": "<string>"
},
"data": "<unknown>",
"count": 123,
"message": "<string>",
"errors": [
{
"code": 100,
"message": "<string>"
}
]
}Authorizations
JWT issued by POST /api/external/token/request. Send as Authorization: Bearer <token>.
Guardhouse API Management subscription key. Required on every request. The same value is used by all API consumers within a region — contact Guardhouse Support for the subscription key.
Body
application/json
⌘I
Create an event subscription
curl --request POST \
--url https://gateway-api.guardhousehq.com/api/webhook/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'external-gh-apim-sub-key: <api-key>' \
--data '
{
"subscriberId": 123,
"uri": "<string>"
}
'import requests
url = "https://gateway-api.guardhousehq.com/api/webhook/subscriptions"
payload = {
"subscriberId": 123,
"uri": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"external-gh-apim-sub-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'external-gh-apim-sub-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({subscriberId: 123, uri: '<string>'})
};
fetch('https://gateway-api.guardhousehq.com/api/webhook/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://gateway-api.guardhousehq.com/api/webhook/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([
'subscriberId' => 123,
'uri' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"external-gh-apim-sub-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://gateway-api.guardhousehq.com/api/webhook/subscriptions"
payload := strings.NewReader("{\n \"subscriberId\": 123,\n \"uri\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("external-gh-apim-sub-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://gateway-api.guardhousehq.com/api/webhook/subscriptions")
.header("Authorization", "Bearer <token>")
.header("external-gh-apim-sub-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"subscriberId\": 123,\n \"uri\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway-api.guardhousehq.com/api/webhook/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["external-gh-apim-sub-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriberId\": 123,\n \"uri\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": {
"code": 123,
"errorMessage": "<string>"
},
"data": {
"id": 123,
"webhookSubscriberEventFilterId": 123,
"uri": "<string>",
"isActive": true,
"createdDateTime": "2023-11-07T05:31:56Z",
"modifiedDateTime": "2023-11-07T05:31:56Z"
},
"count": 123,
"message": "<string>",
"errors": [
{
"code": 100,
"message": "<string>"
}
]
}{
"status": {
"code": 123,
"errorMessage": "<string>"
},
"data": "<unknown>",
"count": 123,
"message": "<string>",
"errors": [
{
"code": 100,
"message": "<string>"
}
]
}{
"status": {
"code": 123,
"errorMessage": "<string>"
},
"data": "<unknown>",
"count": 123,
"message": "<string>",
"errors": [
{
"code": 100,
"message": "<string>"
}
]
}