POST
/2010-04-01/Accounts/{AccountSid}/Usage/Triggers.jsonCreate a usage trigger
Creates a new usage trigger for an account. Supply CallbackUrl, TriggerValue, and UsageCategory, then optionally configure the callback method, recurrence, trigger field, and friendly name. The response contains the created trigger and its generated identifier.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
AccountSidstringrequired
The 34-character SID of the account that will create the usage trigger, matching the `AC` SID format.
Form data defining the callback, threshold, usage category, and optional recurrence settings for the usage trigger.
CallbackUrlstringrequired
The URL we should call using `callback_method` when the trigger fires.
TriggerValuestringrequired
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`.
UsageCategorystringrequired
The usage category that the trigger should watch. Use one of the supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) for this value.
CallbackMethodstringoptional
The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`.
FriendlyNamestringoptional
A descriptive string that you create to describe the resource. It can be up to 64 characters long.
Recurringstringoptional
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.
TriggerBystringoptional
The field in the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource that fires the trigger. Can be: `count`, `usage`, or `price`, as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
201Returns the created usage trigger, including its generated SID, account, callback configuration, current value, firing dates, recurrence, trigger criteria, and resource URI.
account_sidstringoptional
The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the trigger monitors.
api_versionstringoptional
The API version used to create the resource.
callback_methodstringoptional
The HTTP method we use to call `callback_url`. Can be: `GET` or `POST`.
callback_urlstringoptional
The URL we call using the `callback_method` when the trigger fires.
current_valuestringoptional
The current value of the field the trigger is watching.
date_createdstringoptional
The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
date_firedstringoptional
The date and time in GMT that the trigger was last fired specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
date_updatedstringoptional
The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
friendly_namestringoptional
The string that you assigned to describe the trigger.
recurringstringoptional
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.
sidstringoptional
The unique string that that we created to identify the UsageTrigger resource.
trigger_bystringoptional
The field in the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource that fires the trigger. Can be: `count`, `usage`, or `price`, as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
trigger_valuestringoptional
The value at which the trigger will fire. Must be a positive, numeric value.
uristringoptional
The URI of the resource, relative to `https://api.twilio.com`.
usage_categorystringoptional
The usage category the trigger watches. Must be one of the supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories).
usage_record_uristringoptional
The URI of the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to `https://api.twilio.com`.
Error handling
CallbackUrl, TriggerValue, and UsageCategory are required. CallbackUrl must be a valid URI, CallbackMethod must be GET or POST, Recurring must be daily, monthly, yearly, or alltime, and TriggerBy must be count, usage, or price; FriendlyName can be up to 64 characters.