Create a new UsageTrigger

POST /2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json

Webhooks that notify you of usage thresholds

Create a new UsageTrigger

Path parameters

Body

  • CallbackMethod string(http-method)

    The HTTP method we should use to call callback_url. Can be: GET or POST and the default is POST.

    Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

  • CallbackUrl string(uri) Required

    The URL we should call using callback_method when the trigger fires.

  • A descriptive string that you create to describe the resource. It can be up to 64 characters long.

  • The frequency of a recurring UsageTrigger. Can be: daily, monthly, or yearly for recurring triggers or empty for non-recurring triggers. A trigger will only fire once during each period. Recurring times are in GMT.

    Values are daily, monthly, yearly, or alltime.

  • The field in the UsageRecord resource that should fire the trigger. Can be: count, usage, or price as described in the UsageRecords documentation. The default is usage.

    Values are count, usage, or price.

  • TriggerValue string Required

    The usage value at which the trigger should fire. For convenience, you can use an offset value such as +30 to specify a trigger_value that is 30 units more than the current usage value. Be sure to urlencode a + as %2B.

  • UsageCategory string Required

    The usage category that the trigger should watch. Use one of the supported usage categories for this value.

Responses

  • Created

    Hide response attributes Show response attributes object
    • account_sid string | null

      The SID of the Account that this trigger monitors

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • api_version string | null

      The API version used to create the resource

    • callback_method string(http-method) | null

      The HTTP method we use to call callback_url

      Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

    • callback_url string(uri) | null

      he URL we call when the trigger fires

    • current_value string | null

      The current value of the field the trigger is watching

    • date_created string(date-time-rfc-2822) | null

      The RFC 2822 date and time in GMT that the resource was created

    • date_fired string(date-time-rfc-2822) | null

      The RFC 2822 date and time in GMT that the trigger was last fired

    • date_updated string(date-time-rfc-2822) | null

      The RFC 2822 date and time in GMT that the resource was last updated

    • friendly_name string | null

      The string that you assigned to describe the trigger

    • recurring string | null

      The frequency of a recurring UsageTrigger

      Values are daily, monthly, yearly, or alltime.

    • sid string | null

      The unique string that identifies the resource

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^UT[0-9a-fA-F]{32}$.

    • trigger_by string | null

      The field in the UsageRecord resource that fires the trigger

      Values are count, usage, or price.

    • trigger_value string | null

      The value at which the trigger will fire

    • uri string(uri) | null

      The URI of the resource, relative to https://api.twilio.com

    • usage_category string | null

      The usage category the trigger watches

    • usage_record_uri string | null

      The URI of the UsageRecord resource this trigger watches

POST /2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json
curl \
 -X POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json \
 --user "username:password" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d 'CallbackMethod=HEAD&CallbackUrl=https%3A%2F%2Fexample.com&FriendlyName=string&Recurring=daily&TriggerBy=count&TriggerValue=string&UsageCategory=a2p-registration-fees'
Request example
{
  "CallbackMethod": "HEAD",
  "CallbackUrl": "https://example.com",
  "FriendlyName": "string",
  "Recurring": "daily",
  "TriggerBy": "count",
  "TriggerValue": "string",
  "UsageCategory": "a2p-registration-fees"
}
Request examples
{
  "CallbackMethod": "HEAD",
  "CallbackUrl": "https://example.com",
  "FriendlyName": "string",
  "Recurring": "daily",
  "TriggerBy": "count",
  "TriggerValue": "string",
  "UsageCategory": "a2p-registration-fees"
}
Response examples (201)
{
  "account_sid": "string",
  "api_version": "string",
  "callback_method": "HEAD",
  "callback_url": "https://example.com",
  "current_value": "string",
  "date_created": "string",
  "date_fired": "string",
  "date_updated": "string",
  "friendly_name": "string",
  "recurring": "daily",
  "sid": "string",
  "trigger_by": "count",
  "trigger_value": "string",
  "uri": "https://example.com",
  "usage_category": "a2p-registration-fees",
  "usage_record_uri": "string"
}
Response examples (201)
{
  "account_sid": "string",
  "api_version": "string",
  "callback_method": "HEAD",
  "callback_url": "https://example.com",
  "current_value": "string",
  "date_created": "string",
  "date_fired": "string",
  "date_updated": "string",
  "friendly_name": "string",
  "recurring": "daily",
  "sid": "string",
  "trigger_by": "count",
  "trigger_value": "string",
  "uri": "https://example.com",
  "usage_category": "a2p-registration-fees",
  "usage_record_uri": "string"
}