Files
plumbing/docs/Servicem8-List Webhook Subscriptions.md
2026-04-28 09:44:22 +10:00

7.3 KiB
Executable File

List Webhook Subscriptions

List all your current webhook subscriptions

OpenAPI definition

{
  "openapi": "3.1.0",
  "info": {
    "title": "Webhooks API",
    "description": "API for managing webhook subscriptions. This specification includes 25 dynamically registered webhook events.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.servicem8.com"
    }
  ],
  "paths": {
    "/webhook_subscriptions": {
      "get": {
        "operationId": "get_webhook_subscriptions",
        "tags": [
          "Webhook Subscription"
        ],
        "summary": "List Webhook Subscriptions",
        "description": "List all your current webhook subscriptions\n",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive",
                "all"
              ],
              "default": "active"
            },
            "description": "Filter subscriptions by status. Use `all` to include deactivated subscriptions."
          }
        ],
        "responses": {
          "200": {
            "description": "An array of Webhook Subscriptions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Webhook"
                  }
                },
                "examples": {
                  "example-1": {
                    "value": [
                      {
                        "type": "object",
                        "object": "job",
                        "callback_url": "https://example.com/hooks/JobChanged",
                        "fields": [
                          "uuid",
                          "status"
                        ],
                        "unique_id": "integration-a",
                        "active": true
                      },
                      {
                        "type": "event",
                        "event": "job.created",
                        "callback_url": "https://example.com/hooks/JobCreated",
                        "unique_id": "integration-a",
                        "active": true
                      },
                      {
                        "type": "object",
                        "object": "job",
                        "callback_url": "https://example.com/hooks/JobChanged",
                        "fields": [
                          "uuid",
                          "status"
                        ],
                        "unique_id": "integration-a",
                        "active": false,
                        "last_failure_reason": "Webhook request failed for over 12 hours",
                        "last_failure_at": "2026-04-14 03:25:00"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Webhook": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ObjectWebhook"
          },
          {
            "$ref": "#/components/schemas/EventWebhook"
          }
        ]
      },
      "ObjectWebhook": {
        "type": "object",
        "required": [
          "type",
          "object",
          "callback_url",
          "fields",
          "active"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "object"
            ],
            "description": "Type of webhook subscription."
          },
          "object": {
            "type": "string",
            "description": "Object type for this subscription (e.g. job, company)."
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "description": "The URL that will receive the webhook when an update is triggered."
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of fields watched for changes."
          },
          "unique_id": {
            "type": "string",
            "description": "Optional unique identifier for grouping subscriptions."
          },
          "active": {
            "type": "boolean",
            "description": "Whether the subscription is active."
          },
          "last_failure_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "The most recent recorded failure reason for this subscription, if any."
          },
          "last_failure_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Timestamp of the most recent recorded failure for this subscription, if any."
          }
        }
      },
      "EventWebhook": {
        "type": "object",
        "required": [
          "type",
          "event",
          "callback_url",
          "active"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ],
            "description": "Type of webhook subscription."
          },
          "event": {
            "type": "string",
            "description": "Event name for this subscription. See CreateEventWebhookRequest for the full list of supported events.",
            "enum": [
              "company.created",
              "company.updated",
              "form.response_created",
              "inbox.message_received",
              "job.badge_added",
              "job.badge_removed",
              "job.checked_in",
              "job.checked_out",
              "job.completed",
              "job.created",
              "job.invoice_paid",
              "job.invoice_sent",
              "job.note_added",
              "job.photo_added",
              "job.queued",
              "job.quote_accepted",
              "job.quote_sent",
              "job.review_received",
              "job.status_changed",
              "job.updated",
              "job.video_added",
              "proposal.sent",
              "proposal.viewed",
              "staff.clocked_off",
              "staff.clocked_on"
            ]
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "description": "The URL that will receive the webhook when the event occurs."
          },
          "unique_id": {
            "type": "string",
            "description": "Optional unique identifier for grouping subscriptions."
          },
          "active": {
            "type": "boolean",
            "description": "Whether the subscription is active."
          },
          "last_failure_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "The most recent recorded failure reason for this subscription, if any."
          },
          "last_failure_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Timestamp of the most recent recorded failure for this subscription, if any."
          }
        }
      }
    }
  }
}