Set daily spending limits on messaging profiles to prevent unexpected costs. Handle limit-reached webhooks and manage overrides.
Messaging profiles can be configured with a daily spending limit to prevent unexpected costs from bugs, traffic spikes, or human error. When the limit is reached, outbound messages are rejected until the limit resets at midnight UTC.
The daily_spend_limit value is a string representing USD (e.g., "0.50", "10.00", "100.00"). It applies per messaging profile — use separate profiles for different budgets.
There may be a short delay between reaching the limit and enforcement. A small number of additional messages may be sent during this window, causing current_cost to slightly exceed configured_limit.
The running spend total resets automatically at midnight UTC each day. After reset, messages can be sent until the limit is exceeded again.
Changing the daily_spend_limit or daily_spend_limit_enabled values does not reset the running total. Only the midnight UTC reset clears accumulated spend.
Temporary override (disable and re-enable)
If you’ve hit the limit but need to send urgent messages, temporarily disable the limit:
Report incorrect code
Copy
Ask AI
# 1. Disable the limitclient.messaging_profiles.update( profile_id, daily_spend_limit_enabled=False)# 2. Send urgent messagesclient.messages.send(from_=from_number, to=to_number, text="Urgent message")# 3. Re-enable the limitclient.messaging_profiles.update( profile_id, daily_spend_limit_enabled=True)
Re-enabling does not reset the counter. If you were at 10.00ofa10.00 limit, re-enabling will immediately block again. Either increase the limit or wait for the midnight UTC reset.
Increase the limit
Raise the daily_spend_limit to allow more messages until the new limit is reached:
Report incorrect code
Copy
Ask AI
# Increase from $10 to $25client.messaging_profiles.update( profile_id, daily_spend_limit="25.00")
This takes effect immediately — if current spend is 10.02andthenewlimitis25.00, messages will flow again until $25.00 is reached.