PilotFoxDocs

Set the Discord webhook

PUT
/api/v1/sites/{siteId}/notifications/discord

Sets the webhook URL (stored encrypted, never returned) or switches it on or off. Setting a URL or switching it on needs revenue:read too (403 otherwise), since the webhook then receives every sale. Whoever sets the URL is recorded: once that member or API key can no longer read the site's revenue (or is deleted), the webhook gets nothing and its lastError says so until the URL is set again. 400 for a URL that is not the service's incoming webhook URL, or for switching before a URL is set.

Requires site:update on the site (an API key, or a signed-in member's role). Share links: 401.

Authorization

headerx-api-key<token>

An organization API key (ak_…), with the permissions and the sites it was created with. For servers and scripts: no cookie and no Origin check. Also accepted as Authorization: Bearer ak_… (apiKeyBearer). A request carries one credential: a key sent with a share token or a live session cookie is 400 (details.reason: ambiguous_credentials).

Scope: site:update

Path Parameters

siteId*string

Request Body

application/json
  1. body
url?string

A Discord incoming webhook URL (https://discord.com/api/webhooks/…); stored encrypted, never returned

Lengthlength <= 512
enabled?boolean

Off keeps the webhook but sends nothing (default on with a new URL)

Response Body

OK

application/json
  1. response
data*
Example Request
curl -X PUT 'https://pilotfox.app/api/v1/sites/string/notifications/discord' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response200
{  "data": {    "recipients": [      "string"    ],    "members": [      {        "userId": "string",        "name": "string",        "email": "string"      }    ],    "webhooks": [      {        "kind": "slack",        "connected": true,        "enabled": true,        "urlHint": "string",        "lastError": "string",        "lastSentAt": "string"      }    ]  }}