Skip to content

Create a limit for an account or subaccount

Request

Creates a limit tracker for the given metric. When called by a parent account, 'subaccount_id' may be used to set the limit on a specific subaccount, otherwise the subaccount ID is taken from the X-Mailgun-On-Behalf-Of header. Settings must be configured at the parent account level using /v2/thresholds/limits-primary

Security
basicAuth
Bodyapplication/jsonrequired
metricstring(github.com-mailgun-thresholds-api-LimitMetric)required

The metric being monitored.

Enum ValueDescription
email_preview_success_count

The number of successful email previews

seed_test_count

The number of inbox placement tests

limitstringrequired

The threshold limit.

subaccount_idstringrequired

Subaccount to set the limit on if using parent account

curl -i -X POST \
  -u '<username>:<password>' \
  https://api.mailgun.net/v2/thresholds/limits \
  -H 'Content-Type: application/json' \
  -d '{
    "metric": "email_preview_success_count",
    "limit": "200",
    "subaccount_id": "67890"
  }'

Responses

A 200 response

Bodyapplication/json
idstring
created_atstring, (date-time)required
updated_atstring, (date-time)
subaccount_idstring
parent_account_idstring
metricstringrequired
limitstringrequired
Response
{ "id": "915ff385-0a9a-4087-86d5-6727ea7d9b49", "created_at": "2026-02-01T10:30:00Z", "updated_at": "0001-01-01T00:00:00Z", "subaccount_id": "67890", "parent_account_id": "12345", "metric": "email_preview_success_count", "limit": "200" }