ServiceM8 Webhooks API

Object and event webhook subscriptions.

OpenAPI Specification

servicem8-webhooks-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: ServiceM8 REST Attachments Webhooks API
  description: 'ServiceM8 is field service and job management software for trade and home-service businesses. The REST API is plain JSON over HTTP and closely follows REST principles: every resource (Job, Company, JobActivity, Attachment, and so on) has its own URL and is manipulated in isolation using GET, POST, and DELETE. The base URL is https://api.servicem8.com/api_1.0 and each object type is exposed as a `.json` collection - for example GET /company.json lists companies and GET /company/{uuid}.json retrieves one. Creating a record is a POST to the collection; updating a record is a POST to the record URL; deleting is a DELETE to the record URL.


    Private integrations authenticate with an API key sent in the `X-API-Key` header. Public add-ons authenticate with OAuth 2.0 (authorize at https://go.servicem8.com/oauth/authorize, exchange the code at https://go.servicem8.com/oauth/access_token) and send a Bearer access token.


    Naming note: the ServiceM8 user interface term "Client" or "Customer" maps to the "Company" object in the API. Only a subset of ServiceM8 functionality is modeled here; ServiceM8 documents 60+ objects. Object endpoint filenames other than company.json, jobcontact.json, and companycontact.json (which are confirmed in ServiceM8''s own documentation) are modeled from ServiceM8''s documented resource index and its consistent lowercase object naming convention.'
  version: '1.0'
  contact:
    name: ServiceM8 Developer
    url: https://developer.servicem8.com
  license:
    name: ServiceM8 API Terms
    url: https://www.servicem8.com/terms
servers:
- url: https://api.servicem8.com/api_1.0
  description: ServiceM8 REST API (object endpoints)
- url: https://api.servicem8.com
  description: ServiceM8 webhook subscription endpoints
security:
- apiKeyAuth: []
- oauth2: []
tags:
- name: Webhooks
  description: Object and event webhook subscriptions.
paths:
  /webhook_subscriptions:
    servers:
    - url: https://api.servicem8.com
    get:
      operationId: listWebhookSubscriptions
      tags:
      - Webhooks
      summary: List webhook subscriptions
      responses:
        '200':
          description: An array of webhook subscription records.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WebhookSubscription'
    post:
      operationId: createWebhookSubscription
      tags:
      - Webhooks
      summary: Create or update an object webhook subscription
      description: Subscribe to changes on specific fields of an object type. When a subscribed field changes, ServiceM8 POSTs the object type, changed fields, uuid, and a resource_url to your callback URL.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookSubscription'
      responses:
        '200':
          description: Webhook subscription created or updated.
  /webhook_subscriptions/{uuid}:
    servers:
    - url: https://api.servicem8.com
    parameters:
    - $ref: '#/components/parameters/Uuid'
    get:
      operationId: getWebhookSubscription
      tags:
      - Webhooks
      summary: Retrieve a webhook subscription
      responses:
        '200':
          description: A single webhook subscription record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookSubscription'
    delete:
      operationId: deleteWebhookSubscription
      tags:
      - Webhooks
      summary: Delete a webhook subscription
      responses:
        '200':
          description: Webhook subscription deleted.
components:
  parameters:
    Uuid:
      name: uuid
      in: path
      required: true
      description: The UUID of the record.
      schema:
        type: string
  schemas:
    WebhookSubscription:
      type: object
      properties:
        uuid:
          type: string
        object:
          type: string
          description: The object type to watch, e.g. job or company.
        fields:
          type: string
          description: Comma-separated list of fields to subscribe to.
        callback_url:
          type: string
        unique_id:
          type: string
          description: Optional identifier for grouping subscriptions.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for private/single-account integrations.
    oauth2:
      type: oauth2
      description: OAuth 2.0 for public add-ons. Access tokens expire after 3600 seconds.
      flows:
        authorizationCode:
          authorizationUrl: https://go.servicem8.com/oauth/authorize
          tokenUrl: https://go.servicem8.com/oauth/access_token
          refreshUrl: https://go.servicem8.com/oauth/access_token
          scopes:
            manage_jobs: Read and write jobs
            read_jobs: Read jobs
            manage_customers: Read and write customers (companies)
            read_customers: Read customers (companies)
            manage_staff: Read and write staff
            read_staff: Read staff
            manage_inventory: Read and write materials and inventory
            manage_schedule: Read and write scheduling and job activities
            publish_sms: Send SMS messages
            publish_email: Send email messages
            vendor_logo: Read vendor account information