Create or update a webhook subscription

Subscribes an endpoint to the given events (url and events are required). The endpoint must use HTTP or HTTPS, have a valid host, and contain no username or password. Deliveries are signed with HMAC-SHA-256 in the X-Webhook-Signature header when a secret is set. The signing secret is never returned. Optional headers are sent with every delivery for endpoints that require their own authentication; their values are never returned, the response reports headerNames instead, Content-Type, Host and X-Webhook-Signature cannot be overridden, and an endpoint carrying headers must use HTTPS. An optional bodyTemplate replaces the standard envelope for endpoints that expect a fixed shape, and the signature is computed over the rendered body. Providing an existing id updates that subscription instead; omitted fields keep their stored values. Both creating and updating answer 201 with the saved subscription.

POST
/v1/webhooks

Authorization

apiKeyAuth
x-api-key<token>

API key authentication. Create an API key in your user profile and include it in the x-api-key header.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://customermates.com/api/v1/webhooks" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "url": "http://example.com",
  "description": "string",
  "events": [
    "record.created"
  ],
  "bodyTemplate": "string",
  "enabled": true,
  "pausedReason": "triggerFieldDeleted",
  "recordTrigger": {
    "query": {
      "typeId": "caab7c42-4ce7-4bd5-bbab-6017cec730b7",
      "filters": [],
      "relationships": [],
      "relatedFilters": [
        {
          "path": [
            {
              "relationId": "4b4bc808-5132-481f-afc2-e3872bf12049",
              "direction": "outgoing"
            }
          ],
          "operator": "any",
          "filters": [
            {
              "fieldId": "84922011-b03d-4966-bc95-c5b49bc2e342",
              "operator": "eq",
              "value": {
                "kind": "text",
                "value": "string"
              },
              "values": [
                {
                  "kind": "text",
                  "value": "string"
                }
              ]
            }
          ],
          "relationships": [],
          "search": "string",
          "recordIds": [
            "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          ]
        }
      ],
      "search": "string"
    },
    "changedFieldIds": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ]
  },
  "recordSources": [
    {
      "query": {
        "typeId": "caab7c42-4ce7-4bd5-bbab-6017cec730b7",
        "filters": [],
        "relationships": [],
        "relatedFilters": [
          {
            "path": [
              {
                "relationId": "4b4bc808-5132-481f-afc2-e3872bf12049",
                "direction": "outgoing"
              }
            ],
            "operator": "any",
            "filters": [
              {
                "fieldId": "84922011-b03d-4966-bc95-c5b49bc2e342",
                "operator": "eq",
                "value": {
                  "kind": "text",
                  "value": "string"
                },
                "values": [
                  {
                    "kind": "text",
                    "value": "string"
                  }
                ]
              }
            ],
            "relationships": [],
            "search": "string",
            "recordIds": [
              "497f6eca-6276-4993-bfeb-53cbbbba6f08"
            ]
          }
        ],
        "search": "string"
      },
      "changedFieldIds": [
        "497f6eca-6276-4993-bfeb-53cbbbba6f08"
      ],
      "events": [
        "record.created"
      ]
    }
  ],
  "recordOwnerUserId": "226b2093-6809-4140-8367-54923cad94f7",
  "createdAt": "string",
  "updatedAt": "string",
  "hasSecret": true,
  "headerNames": [
    "string"
  ]
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
Empty