Attach a workflow to an expiry
post
https://api.expiryedge.com/v1/createExpiryWorkflowAttachmenteditor or admin60/minAny method
Request
curl -X POST 'https://api.expiryedge.com/v1/createExpiryWorkflowAttachment' \
-H "Authorization: Bearer $EXPIRYEDGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"expiry_id": "exp_4Tq9sLm2",
"workflow_id": "wf_3Kd9Tx",
"trigger_type": "before_expiry",
"trigger_days": 30,
"trigger_time": "09:00",
"carry_to_renewal": true,
"notify_on_start": true,
"notify_on_completion": true,
"notify_on_step_assignment": true,
"notify_on_stall": false,
"notify_channels": {
"email": true,
"in_app": true,
"sms": false,
"whatsapp": false,
"teams": false
},
"notify_recipients": [
"u_71bXq"
]
}'Response
{
"message": "Workflow attachment created successfully",
"attachment": {
"id": "att_1Mz7",
"expiry_id": "exp_4Tq9sLm2",
"workflow_id": "wf_3Kd9Tx",
"workflow_title": "Annual license renewal",
"expiry_name": "State dental license - Dr. Lee",
"organization_id": "org_northwind",
"created_by": "u_71bXq",
"team_id": null,
"trigger_type": "before_expiry",
"trigger_days": 30,
"trigger_time": "09:00",
"trigger_date": "2026-09-15T09:00:00.000Z",
"trigger_status": "pending",
"notify_on_start": true,
"notify_on_step_assignment": true,
"notify_on_completion": true,
"notify_on_stall": false,
"stall_threshold_days": 3,
"notify_recipients": [
"u_71bXq"
],
"notify_channels": {
"email": true,
"sms": false,
"whatsapp": false,
"in_app": true,
"teams": false
},
"current_run_id": null,
"last_run_id": null,
"run_count": 0,
"is_deleted": false,
"carry_to_renewal": true,
"created_at": "2026-09-27T14:05:00.000Z",
"updated_at": "2026-09-27T14:05:00.000Z"
}
}Starts a run of the workflow when the trigger fires (before_expiry / after_expiry need trigger_days 0-365; manual attachments start paused).
Max 5 attachments per expiry (400). The same workflow with the same trigger type returns 409 with existing_attachment_id. You are always added to notify_recipients.
expiry_idstringrequiredworkflow_idstringrequiredtrigger_typestringrequiredAllowedbefore_expiryon_expiryafter_expiryon_doneon_renewalmanualnotify_on_startbooleanDefaulttruenotify_on_step_assignmentbooleanDefaulttruenotify_on_completionbooleanDefaulttruenotify_on_stallbooleanDefaultfalsestall_threshold_daysintegerDefault3notify_recipientsarray of stringUser ids of your organization.notify_channelsobjecttrigger_daysintegerRequired forbefore_expiry/after_expiry.min: 0 · max: 365trigger_timestringHH:mmin the organization timezone (date-based triggers).Default09:00pattern: ^\d{2}:\d{2}$carry_to_renewalbooleanCopy the attachment to the renewed expiry.Defaulttruenotification_configobject
201
Created.
messagestringrequiredattachmentobjectrequired
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. |
409 | This workflow is already attached to the expiry with the same trigger type. |
429 | Too many requests for this endpoint from your IP. Wait Retry-After seconds. |
500 | Unexpected server error. Retry later; quote requestId to support. |
