# Create Workflow

POST /api/v2/projects/{projectId}/workflows

Creates a workflow definition: the trigger event, audience filters, frequency, and delay between runs. Creating one never starts a run and never sends anything. Steps and edges are added separately.

## Request

- projectId: string, path, required — ID of the project that owns the workflow.
- contactsFilterGroups: object[], required — Audience filter groups. A contact must match at least one group to enter the workflow.
  - filters: object[], required — Attribute filters combined with groupType.
    - attributeDistinctId: string, required — Contact attribute distinct id to filter on.
    - operator: equals | contains | notEquals | notContains | gt | gte | lt | lte | on | since | before | between | last, required — Comparison operator for the attribute value.
    - value: string, required — Value to compare the attribute against.
    - attributeType: string | number | boolean | date | url | email, default string — Attribute type. Defaults to string when omitted.
  - groupType: AND | OR | NOT, required — How filters in this group are combined.
  - oneDayEventFilters: object[] — Event filters evaluated over the last 24 hours only.
    - eventName: string, required — Analytics event name.
    - operator: performed | notPerformed, required — Whether the contact performed the event in the last 24 hours.
  - requireSubscribed: boolean — When true, the group is ANDed with `$subscribed == true`. Set by email sending, not the filter UI.
- frequency: ONCE | EVERY, required — ONCE runs a contact through at most once. EVERY re-enters them each time the trigger fires, subject to maxRuns and minDelay.
- name: string, required — Display name of the workflow.
- status: INACTIVE | PAUSED | ACTIVE, required — INACTIVE, PAUSED, or ACTIVE.
- triggerEvent: string, required — Name of the analytics event 
…

## Response

- 200: Successful response
  - contactsFilterGroups: object[], required
    - filters: object[], required — Attribute filters combined with groupType.
    - groupType: AND | OR | NOT, required — How filters in this group are combined.
    - oneDayEventFilters: object[] — Event filters evaluated over the last 24 hours only.
    - requireSubscribed: boolean — When true, the group is ANDed with `$subscribed == true`. Set by email sending, not the filter UI.
  - createdAt: string, required
  - frequency: ONCE | EVERY, required, default ONCE
  - id: string, required
  - name: string, required
  - projectId: string, required
  - status: INACTIVE | PAUSED | ACTIVE, required, default INACTIVE
  - triggerEvent: string, required
  - updatedAt: string, required
  - maxRuns: integer
  - minDelayAmount: integer, default 5
  - minDelayUnit: MINUTES | HOURS | DAYS, default MINUTES
- 400: Invalid input data
- 401: Authorization not provided
- 403: Insufficient access
- 500: Internal server error
