Skip to main content
WEBHOOK
customer.state_changed
{
  "type": "<string>",
  "timestamp": "2023-11-07T05:31:56Z",
  "data": {
    "id": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "metadata": {},
    "external_id": "usr_1337",
    "email": "<string>",
    "email_verified": true,
    "name": "John Doe",
    "billing_address": {
      "line1": "<string>",
      "line2": "<string>",
      "postal_code": "<string>",
      "city": "<string>",
      "state": "<string>"
    },
    "tax_id": {
      "[0]": "<string>"
    },
    "organization_id": "<string>",
    "deleted_at": "2023-11-07T05:31:56Z",
    "active_subscriptions": [
      {
        "id": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "modified_at": "2023-11-07T05:31:56Z",
        "metadata": {},
        "amount": 123,
        "currency": "<string>",
        "current_period_start": "2023-11-07T05:31:56Z",
        "current_period_end": "2025-03-03T13:37:00Z",
        "trial_start": "2025-02-03T13:37:00Z",
        "trial_end": "2025-03-03T13:37:00Z",
        "cancel_at_period_end": true,
        "canceled_at": null,
        "started_at": "2025-01-03T13:37:00Z",
        "ends_at": null,
        "product_id": "<string>",
        "discount_id": null,
        "meters": [
          {
            "created_at": "2023-11-07T05:31:56Z",
            "modified_at": "2023-11-07T05:31:56Z",
            "id": "<string>",
            "consumed_units": 123,
            "credited_units": 123,
            "amount": 123,
            "meter_id": "<string>"
          }
        ],
        "custom_field_data": {}
      }
    ],
    "granted_benefits": [
      {
        "id": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "modified_at": "2023-11-07T05:31:56Z",
        "granted_at": "2023-11-07T05:31:56Z",
        "benefit_id": "<string>",
        "benefit_metadata": {},
        "properties": {
          "account_id": "<string>",
          "guild_id": "<string>",
          "role_id": "<string>",
          "granted_account_id": "<string>"
        }
      }
    ],
    "active_meters": [
      {
        "id": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "modified_at": "2023-11-07T05:31:56Z",
        "meter_id": "<string>",
        "consumed_units": 123,
        "credited_units": 123,
        "balance": 123
      }
    ],
    "type": "individual"
  }
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.spairehq.com/llms.txt

Use this file to discover all available pages before exploring further.

Body

application/json

Sent when a customer state has changed.

It's triggered when:

  • Customer is created, updated or deleted.
  • A subscription is created or updated.
  • A benefit is granted or revoked.

Discord & Slack support: Basic

type
string
required
Allowed value: "customer.state_changed"
Example:

"customer.state_changed"

timestamp
string<date-time>
required
data
CustomerState · object
required

A customer along with additional state information:

  • Active subscriptions
  • Granted benefits
  • Active meters

Response

Successful Response