Lifecycle & Status
This page explains how Operations move across statuses and what you can change at each step.
Keep in mind
- Author in DRAFT. Publish to ACTIVE when ready. Deactivate to INACTIVE.
- Buyers can only use Operations that are ACTIVE and within the [startDate, endDate] window.
- Automatic status change: when
endDatepasses, an ACTIVE Operation becomes INACTIVE.
🧭 State model at a glance
graph LR %% ---------- States ---------- D[DRAFT] A[ACTIVE] I[INACTIVE] X[DELETED] %% ---------- Transitions ---------- D -->|Publish<br>dates valid| A A -->|Deactivate| I A -->|Auto at endDate| I I -->|Reactivate<br>dates valid| A D -->|Delete<br>no links| X I -->|Delete<br>no links| X %% ---------- Notes ---------- ND[Editable in DRAFT<br>lines, accounts, metadata] NA[Buyer visible when within<br>start and end window] D -.-> ND A -.-> NA %% ---------- Styles (shared palette) ---------- classDef total fill:#e8f1ff,stroke:#2f6feb,stroke-width:2px,color:#0b3d91; classDef visible fill:#ecfdf5,stroke:#10b981,stroke-width:2px,color:#064e3b; classDef resp fill:#f2f4f7,stroke:#475569,stroke-width:2px,color:#111827; classDef diff fill:#fff4e5,stroke:#f59e0b,stroke-width:2px,color:#7a3e00; class D total; class A visible; class I resp; class X resp; class ND diff; class NA diff; style D rx:8,ry:8 style A rx:8,ry:8 style I rx:8,ry:8 style X rx:8,ry:8 style ND rx:8,ry:8 style NA rx:8,ry:8 %% ---------- Accent key path (edge index starts at 0) ---------- %% 0: D->A, 1: A->I, 2: A->I (auto), 3: I->A, 4: D->X, 5: I->X, 6: D-.->ND, 7: A-.->NA linkStyle 2 stroke:#ef4444,stroke-width:2px
🛠️ What you can do in each status
| Action / Field | DRAFT | ACTIVE | INACTIVE |
|---|---|---|---|
| Edit name/description/locales | ✅ | 🔒 | 🔒 |
| Edit external ID | ✅ | 🔒 | 🔒 |
| Set type (PUBLIC/PRIVATE) | ✅ (initial choice) | 🔒 (immutable) | 🔒 (immutable) |
| Change type (PUBLIC/PRIVATE) | 🔒 | 🔒 | 🔒 |
| Set startDate / endDate | ✅ | 🔒 | 🔒 |
| Manage lines (add/update/remove) | ✅ | 🔒 (locked; avoid breaking orders) | 🔒 (locked; avoid breaking orders) |
| Attach/detach Accounts (PRIVATE) | ✅ | 🔒 | ✅ |
| Publish (→ ACTIVE) | ✅ | — | — |
| Deactivate (→ INACTIVE) | — | ✅ (manual) | — |
| Re-activate (→ ACTIVE) | — | — | ✅ (ensurenow < endDate) |
| Duplicate | ✅ (new copy is DRAFT) | ✅ (copy current snapshot) | ✅ |
| Delete | ✅ (if no orders linked) | 🔒 | 🔒 |
Locked = blocked to avoid inconsistencies in the Operation workflow or with existing orders.
📅 Dates & buyer visibility
- An Operation becomes buyer-visible when:
status = ACTIVE AND
now ∈ [startDate, endDate]AND the Account/Store/Locale rules are satisfied. - If you set ACTIVE while
now < startDate, the Operation is scheduled: it will appear to buyers starting atstartDate(no auto-activation step is needed). - When
endDatepasses, the platform automatically sets status to INACTIVE (if it was ACTIVE).
Practical scheduling Set up everything in DRAFT, then publish (ACTIVE). If the campaign starts later, use a futurestartDate— the system will gate buyer visibility until that date.
👮 Ownership & permissions (recap)
- Only the creator/owner can modify an Operation.
- Operator users can see any Operation and can set PUBLIC type.
- Customer Users (admin) require a specific right to create/manage Operations and can only attach Accounts they are attached to.
- Standard Djust headers are required on all calls (e.g.,
dj-client,dj-api-key, optionaldj-store,dj-store-view).
🤖 Automation status changes (Not yet released)
- Auto-deactivation: if
status=ACTIVEandnow > endDate, status becomes INACTIVE automatically. - No auto-activation from DRAFT: activation is manual (publish). Use
startDateto gate visibility after activation. - Background processing should be idempotent; re-running checks must not flip states incorrectly.
graph LR A[Publish request<br>set status=ACTIVE] --> DATES[Dates valid] DATES -- Yes --> ACT[Status ACTIVE] DATES -- No --> REJ[Reject] ACT --> START[Now on or after<br>startDate] START -- Yes --> V[Buyer-visible<br>within scope] START -- No --> H[Hidden until<br>startDate] AJ[Scheduled job] --> CHECK[Now > endDate<br>AND status ACTIVE] CHECK -- Yes --> INACT[Set status=INACTIVE] CHECK -- No --> KEEP[No change] %% ---------- Styles ---------- classDef total fill:#e8f1ff,stroke:#2f6feb,stroke-width:2px,color:#0b3d91; classDef diff fill:#fff4e5,stroke:#f59e0b,stroke-width:2px,color:#7a3e00; classDef acct fill:#f5e9ff,stroke:#8a2be2,stroke-width:2px,color:#3b0764; classDef view fill:#ede9fe,stroke:#7c3aed,stroke-width:1.5px,color:#1e1b4b; classDef union fill:#e9d5ff,stroke:#6d28d9,stroke-width:1.5px,color:#3b0764; classDef visible fill:#ecfdf5,stroke:#10b981,stroke-width:2px,color:#064e3b; classDef op fill:#e0f7fa,stroke:#06b6d4,stroke-width:2px,color:#065f46; classDef inter fill:#fee2e2,stroke:#ef4444,stroke-width:2px,color:#7f1d1d; classDef resp fill:#f2f4f7,stroke:#475569,stroke-width:2px,color:#111827; class DATES,START,CHECK diff; class ACT,KEEP visible; class V visible; class REJ,H inter; class INACT resp; class AJ total; style A rx:8,ry:8 style DATES rx:8,ry:8 style ACT rx:8,ry:8 style START rx:8,ry:8 style V rx:8,ry:8 style H rx:8,ry:8 style AJ rx:8,ry:8 style CHECK rx:8,ry:8 style INACT rx:8,ry:8 style KEEP rx:8,ry:8
🧪 Common scenarios
Schedule a future campaign
- Create in DRAFT → add lines/accounts → set
startDatein the future → setendDate. - Publish (→ ACTIVE).
- Buyers will see it starting at
startDate.
Pause early
- Set status to INACTIVE before
endDate. - Optionally adjust dates and re-activate later.
Re-run a past campaign
- Duplicate the finished Operation (new copy in DRAFT).
- Update dates/lines/accounts as needed → publish.
Cannot delete?
- Ensure no cart or order is linked to the Operation. Otherwise, deletion is blocked by design.
🔗 API quicklinks
Status change
- PATCH /v1/operations/(operationId) — ADM-OPERATION-201 (Update Operation status (activate / deactivate)).
Dates & metadata
- PUT /v1/operations/(operationId) — ADM-OPERATION-200 (Update an Operation (e.g., startDate, endDate, name/description)).
- Most edits are DRAFT-only; use PATCH above to change status.
Read / verify
- GET /v1/operations/(operationId) — ADM-OPERATION-500 (Get Operation by ID).
- GET /v1/operations — ADM-OPERATION-550 (List Operations).
- Useful filters: status, ids, name, type, startDateFrom, startDateTo, endDateFrom, endDateTo, ownerIds (also sort, locale).
Deletion (end-of-life)
- DELETE /v1/operations/(operationId) — ADM-OPERATION-300 (Delete Operation).
- Rejected if any cart/order is linked.
Shop (for visibility checks)
- GET /shop/operations - OPERATION-550 (Returns only ACTIVE Operations within the current date window.)
- GET /shop/operations/(id) - OPERATION-500 (Returns 404 if not ACTIVE or outside the window.)
Updated 23 days ago
