Attach a workflow to an expiry

posthttps://api.expiryedge.com/v1/createExpiryWorkflowAttachment
editor or admin60/minJede Methode
Anfrage
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"
  ]
}'
Antwort
{
  "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.

Body-Parameter

application/json
  • expiry_idstringerforderlich
  • workflow_idstringerforderlich
  • trigger_typestringerforderlich
    Erlaubtbefore_expiryon_expiryafter_expiryon_doneon_renewalmanual
  • notify_on_startboolean
    Standard true
  • notify_on_step_assignmentboolean
    Standard true
  • notify_on_completionboolean
    Standard true
  • notify_on_stallboolean
    Standard false
  • stall_threshold_daysinteger
    Standard 3
  • notify_recipientsarray of string
    User ids of your organization.
  • notify_channelsobject
  • trigger_daysinteger
    Required for before_expiry / after_expiry.
    min: 0 · max: 365
  • trigger_timestring
    HH:mm in the organization timezone (date-based triggers).
    Standard 09:00pattern: ^\d{2}:\d{2}$
  • carry_to_renewalboolean
    Copy the attachment to the renewed expiry.
    Standard true
  • notification_configobject

Rückgabe

201
Created.
  • messagestringerforderlich
  • attachmentobjecterforderlich

Fehler

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.