curl --request POST \
--url https://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"dest": "https://erp.example.com/epcis/callbacks",
"signatureToken": "a-shared-secret-of-your-choosing",
"stream": true
}
'import requests
url = "https://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions"
payload = {
"dest": "https://erp.example.com/epcis/callbacks",
"signatureToken": "a-shared-secret-of-your-choosing",
"stream": True
}
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({
dest: 'https://erp.example.com/epcis/callbacks',
signatureToken: 'a-shared-secret-of-your-choosing',
stream: true
})
};
fetch('https://www.closient.com/epcis/api/2.0/queries/{query_name}/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://www.closient.com/epcis/api/2.0/queries/{query_name}/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([
'dest' => 'https://erp.example.com/epcis/callbacks',
'signatureToken' => 'a-shared-secret-of-your-choosing',
'stream' => true
]),
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://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions"
payload := strings.NewReader("{\n \"dest\": \"https://erp.example.com/epcis/callbacks\",\n \"signatureToken\": \"a-shared-secret-of-your-choosing\",\n \"stream\": true\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://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"dest\": \"https://erp.example.com/epcis/callbacks\",\n \"signatureToken\": \"a-shared-secret-of-your-choosing\",\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.closient.com/epcis/api/2.0/queries/{query_name}/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 \"dest\": \"https://erp.example.com/epcis/callbacks\",\n \"signatureToken\": \"a-shared-secret-of-your-choosing\",\n \"stream\": true\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "2026-10-21T09:30:00Z",
"dest": "https://erp.example.com/epcis/callbacks",
"lastNotifiedAt": "2026-10-21T10:02:11Z",
"subscriptionID": "7fT3kQm9XwB2nLs8vYc4Rz"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}Subscribe to a named query
Register a webhook that receives an EPCISQueryDocument each time a capture adds events the named query selects (GS1 EPCIS 2.0 REST binding, POST /queries/{queryName}/subscriptions). Answers 201 with a Location header. Only stream: true is served; a schedule, reportIfEmpty or initialRecordTime is refused with 400 naming it, as is a dest that is not a public address. With a signatureToken, callbacks carry GS1-Signature: sha256=<hex> (HMAC-SHA256 of the body). Callbacks are retried on failure. Caller must hold OWNER or MANAGER on an organization.
curl --request POST \
--url https://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"dest": "https://erp.example.com/epcis/callbacks",
"signatureToken": "a-shared-secret-of-your-choosing",
"stream": true
}
'import requests
url = "https://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions"
payload = {
"dest": "https://erp.example.com/epcis/callbacks",
"signatureToken": "a-shared-secret-of-your-choosing",
"stream": True
}
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({
dest: 'https://erp.example.com/epcis/callbacks',
signatureToken: 'a-shared-secret-of-your-choosing',
stream: true
})
};
fetch('https://www.closient.com/epcis/api/2.0/queries/{query_name}/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://www.closient.com/epcis/api/2.0/queries/{query_name}/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([
'dest' => 'https://erp.example.com/epcis/callbacks',
'signatureToken' => 'a-shared-secret-of-your-choosing',
'stream' => true
]),
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://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions"
payload := strings.NewReader("{\n \"dest\": \"https://erp.example.com/epcis/callbacks\",\n \"signatureToken\": \"a-shared-secret-of-your-choosing\",\n \"stream\": true\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://www.closient.com/epcis/api/2.0/queries/{query_name}/subscriptions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"dest\": \"https://erp.example.com/epcis/callbacks\",\n \"signatureToken\": \"a-shared-secret-of-your-choosing\",\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.closient.com/epcis/api/2.0/queries/{query_name}/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 \"dest\": \"https://erp.example.com/epcis/callbacks\",\n \"signatureToken\": \"a-shared-secret-of-your-choosing\",\n \"stream\": true\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "2026-10-21T09:30:00Z",
"dest": "https://erp.example.com/epcis/callbacks",
"lastNotifiedAt": "2026-10-21T10:02:11Z",
"subscriptionID": "7fT3kQm9XwB2nLs8vYc4Rz"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}Authorizations
Path Parameters
The name the query was created with (POST /queries).
Body
POST /queries/{queryName}/subscriptions body: where to send matches, and how to sign them.
URL callbacks are POSTed to as an EPCISQueryDocument. Must be a public https address; a private, loopback or otherwise disallowed destination is refused with 400.
2048^[^\x00]{0,}$Shared secret. When set, each callback carries GS1-Signature: sha256=<hex>, the HMAC-SHA256 of the exact request body keyed with this token. Write-only: never returned.
255^[^\x00]{0,255}$Must be true: each capture that adds events matching the query notifies once. Scheduled subscriptions are not served.
Not served. A request that sets it is refused with 400.
Not served (scheduled subscriptions only). Setting it is refused with 400.
Not served. A request that sets it is refused with 400.
^[^\x00]{0,}$Response
Created
A registered subscription, as GET returns it. The signatureToken is never included.
Identifier of the subscription; use it in the URL path.
URL callbacks are POSTed to.
When the subscription was registered.
When a callback last received a 2xx answer; absent until one has.