Back to Smithery

Subscribe to trigger

docs-api-reference-connect-subscribe-to-trigger.md

latest9.2 KB
Original Source

POST

/

connect

/

{namespace}

/

{connectionId}

/

.triggers

/

{triggerName}

Try it

Subscribe to trigger

cURL

curl --request POST \
  --url https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "params": {},
  "delivery": {
    "url": "https://my-app.example.com/events",
    "secret": "whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE="
  }
}
'
import requests

url = "https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}"

payload = {
    "params": {},
    "delivery": {
        "url": "https://my-app.example.com/events",
        "secret": "whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE="
    }
}
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({
    params: {},
    delivery: {
      url: 'https://my-app.example.com/events',
      secret: 'whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE='
    }
  })
};

fetch('https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}', 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.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}",
  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([
    'params' => [

    ],
    'delivery' => [
        'url' => 'https://my-app.example.com/events',
        'secret' => 'whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE='
    ]
  ]),
  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.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}"

	payload := strings.NewReader("{\n \"params\": {},\n \"delivery\": {\n \"url\": \"https://my-app.example.com/events\",\n \"secret\": \"whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE=\"\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.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n \"params\": {},\n \"delivery\": {\n \"url\": \"https://my-app.example.com/events\",\n \"secret\": \"whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE=\"\n }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}")

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 \"params\": {},\n \"delivery\": {\n \"url\": \"https://my-app.example.com/events\",\n \"secret\": \"whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE=\"\n }\n}"

response = http.request(request)
puts response.read_body

200

400

404

{
  "id": "trg_01HW1234567890",
  "refreshBefore": "2026-04-22T13:00:00.000Z"
}
{
  "error": "validation_error",
  "message": "Invalid request"
}
{
  "error": "not_found",
  "message": "Resource not found"
}

Authorizations

[​

](#authorization-authorization)

Authorization

string

header

required

Smithery API key as Bearer token

Path Parameters

[​

](#parameter-namespace)

namespace

string

required

[​

](#parameter-connection-id)

connectionId

string

required

[​

](#parameter-trigger-name)

triggerName

string

required

Body

application/json

[​

](#body-params)

params

object

required

Trigger-specific parameters defined by the trigger inputSchema

Show child attributes

[​

](#body-delivery)

delivery

object

required

Show child attributes

Response

200

application/json

Subscription created or refreshed

[​

](#response-id)

id

string

required

Stable subscription id derived from (namespace, connection, name, params, delivery.url). Used by the receiver to route via X-MCP-Subscription-Id.

Example:

"trg_01HW1234567890"

[​

](#response-refresh-before)

refreshBefore

string

required

ISO 8601 timestamp at which the subscription expires unless refreshed.

Example:

"2026-04-22T13:00:00.000Z"

Was this page helpful?

YesNo

⌘I

Subscribe to trigger

cURL

curl --request POST \
  --url https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "params": {},
  "delivery": {
    "url": "https://my-app.example.com/events",
    "secret": "whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE="
  }
}
'
import requests

url = "https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}"

payload = {
    "params": {},
    "delivery": {
        "url": "https://my-app.example.com/events",
        "secret": "whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE="
    }
}
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({
    params: {},
    delivery: {
      url: 'https://my-app.example.com/events',
      secret: 'whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE='
    }
  })
};

fetch('https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}', 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.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}",
  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([
    'params' => [

    ],
    'delivery' => [
        'url' => 'https://my-app.example.com/events',
        'secret' => 'whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE='
    ]
  ]),
  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.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}"

	payload := strings.NewReader("{\n \"params\": {},\n \"delivery\": {\n \"url\": \"https://my-app.example.com/events\",\n \"secret\": \"whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE=\"\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.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n \"params\": {},\n \"delivery\": {\n \"url\": \"https://my-app.example.com/events\",\n \"secret\": \"whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE=\"\n }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.smithery.ai/connect/{namespace}/{connectionId}/.triggers/{triggerName}")

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 \"params\": {},\n \"delivery\": {\n \"url\": \"https://my-app.example.com/events\",\n \"secret\": \"whsec_dGVzdF9zZWNyZXRfMjRfYnl0ZXNfbWluaW11bSE=\"\n }\n}"

response = http.request(request)
puts response.read_body

200

400

404

{
  "id": "trg_01HW1234567890",
  "refreshBefore": "2026-04-22T13:00:00.000Z"
}
{
  "error": "validation_error",
  "message": "Invalid request"
}
{
  "error": "not_found",
  "message": "Resource not found"
}