Create an auto-send trigger rule on an expiry

posthttps://api.expiryedge.com/v1/createCollectionTriggerRule
editor or admin60/minAny method
Request
curl -X POST 'https://api.expiryedge.com/v1/createCollectionTriggerRule' \
  -H "Authorization: Bearer $EXPIRYEDGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "expiryId": "exp_4Tq9sLm2",
  "templateId": "tpl_W9onboard",
  "triggerType": "before_expiry",
  "triggerDays": 30,
  "triggerTime": "09:00",
  "contactIds": [
    "c_8Hk2pQ"
  ],
  "expiresInDays": 21,
  "dueInDays": 14,
  "carryToRenewal": true
}'
Response
{
  "message": "Trigger created",
  "trigger": {
    "id": "trg_2Vb8",
    "organization_id": "org_northwind",
    "expiry_id": "exp_4Tq9sLm2",
    "expiry_name": "Northwind Dental - State Dental License",
    "template_id": "tpl_W9onboard",
    "template_name": "New client onboarding - Northwind Dental",
    "trigger_type": "before_expiry",
    "trigger_days": 30,
    "trigger_time": "09:00",
    "trigger_date": "2026-09-15T13:00:00.000Z",
    "contact_ids": [
      "c_8Hk2pQ"
    ],
    "group_id": null,
    "group_name": null,
    "expires_in_days": 21,
    "due_in_days": 14,
    "status": "pending",
    "created_request_ids": [],
    "run_count": 0,
    "last_triggered_at": null,
    "triggered_by": null,
    "error_message": null,
    "carry_to_renewal": true,
    "created_by": "u_71bXq",
    "created_by_name": "Priya Shah",
    "created_at": "2026-09-27T14:05:00.000Z",
    "updated_at": "2026-09-27T14:05:00.000Z"
  }
}

Automatically sends a template to contacts relative to an expiry (before/on/after its date, on a date, when marked done, on renewal, or manual only). manual rules start paused, all others pending. The plan limit is checked when the rule fires. The handler does not check the HTTP method.

Body parameters

application/json
  • expiryIdstringrequired
  • templateIdstringrequired
    A non-archived template.
  • triggerTypestringrequired
    Allowedbefore_expiryon_expiryafter_expiryon_dateon_doneon_renewalmanual
  • triggerDaysinteger
    Required for before_expiry / after_expiry.
    min: 0 · max: 3650
  • triggerTimestring
    HH:MM in the organization timezone (date-based types).
    Default 09:00
  • triggerDatestring
    Required for on_date; the exact fire time.
    format: date-time
  • contactIdsarray of string
  • groupIdstring
  • expiresInDaysinteger
    Created requests' links expire this many days after sending.
  • dueInDaysinteger
    Created requests' due date, days after sending.
  • carryToRenewalboolean
    Copy this rule to the next occurrence when the expiry renews.
    Default false

Returns

201
Rule created.
  • messagestringrequired
  • triggerobjectrequired
    An auto-send rule attached to an expiry.

Errors

400
The request is missing required fields or contains invalid values.
401
Missing, expired or invalid bearer token.
403
Authenticated, but your role or organization does not allow this action.
404
The record does not exist or is not in your organization.
429
Too many requests for this endpoint from your IP. Wait Retry-After seconds.