The Xagle Production Schedule API
REST access to the Production Schedule add-on: the production lines, the calendar of scheduled jobs and blocked time, and the backlog of work waiting to be scheduled. The API reads and writes the same records the in-app Production Schedule page uses, so anything created here shows up on the calendar immediately (and vice versa).
All endpoints require authentication: POST /api/v1/login with email + password returns {"token": "..."}; pass it as Authorization: Bearer {token} on every call. Responses follow the standard envelope: {"success": true, "message": "...", "data": ...} on success, {"success": false, "message": "..."} on failure, and {"errors": {field: [...]}} with HTTP 422 on validation failure.
Availability: only when the Production Schedule add-on is enabled for the company. The endpoints use the production_schedule.view / create / update / delete permissions of the token's user.
Status codes: 200 read/update, 201 created, 404 event or invoice not found, 422 validation failure, 400 business-rule failure (already complete, block cannot be unscheduled, invoice is scheduled so it cannot be dismissed), 409 duplicate in-flight idempotency key.
Dates and times: every datetime in a response is ISO 8601 with the company's timezone offset, for example 2031-03-10T08:00:00-04:00. When you send a datetime you may include an offset (2031-03-10T12:00:00Z) and it is converted to company time; a value without an offset (2031-03-10 08:00:00) is taken as company-local time. Invoice dates are plain YYYY-MM-DD.
Idempotency: POST /events honours an Idempotency-Key header (max 80 characters). A retry with the same key and body replays the stored response with an Idempotency-Replayed: true header instead of creating a second event.
For the feature itself (lines, backlog, jobs, blocks, Production Complete and the forecast as users see it) read Production Schedule in the Add-Ons chapter.
Endpoints
| Operation | Endpoint | Permission |
|---|---|---|
| List scheduled events in a window | GET /api/v1/production-schedule/events | view |
| Show one event | GET /api/v1/production-schedule/events/{id} | view |
| Backlog (waiting to be scheduled) | GET /api/v1/production-schedule/backlog | view |
| Production lines | GET /api/v1/production-schedule/lines | view |
| Block types | GET /api/v1/production-schedule/block-types | view |
| Production forecast (outlook, or one item with a promise date) | GET /api/v1/production-schedule/forecast | view |
| Create an invoice job, ad-hoc job or block | POST /api/v1/production-schedule/events | create |
| Move / re-line / retitle an event | PUT /api/v1/production-schedule/events/{id} | update |
| Mark production complete | POST /api/v1/production-schedule/events/{id}/complete | update |
| Reopen | POST /api/v1/production-schedule/events/{id}/reopen | update |
| Return a job to the backlog | POST /api/v1/production-schedule/events/{id}/unschedule | update |
| Delete an event | DELETE /api/v1/production-schedule/events/{id} | delete |
| Keep an invoice out of the backlog ("Don't Schedule") | POST /api/v1/production-schedule/invoices/{invoice_id}/dismiss | update |
The event record
Every event endpoint returns the same shape. An event is one of three types: invoice (a job tied to an invoice), adhoc (a free-text job) or block (blocked time such as maintenance or a holiday, tied to a block type). Jobs can sit in the backlog (no start_at) or on the calendar; blocks are always on the calendar.
{
"id": 42,
"type": "invoice",
"title": "INV2603118 · Acme Manufacturing",
"note": null,
"production_line_id": 1,
"production_line": {"id": 1, "name": "Assembly Bay 1", "bg_color": "#3788d8", "text_color": "#ffffff", "display_order": 0, "inactive": false},
"block_type_id": null,
"block_type": null,
"item_master_id": null,
"item": null,
"quantity": null,
"start_at": "2031-03-10T08:00:00-04:00",
"end_at": "2031-03-10T12:00:00-04:00",
"is_scheduled": true,
"is_completed": false,
"completed_at": null,
"completed_by": null,
"is_dismissed": false,
"invoice": {
"id": 118,
"number": "INV2603118",
"status": "sent",
"client_id": 7,
"client_name": "Acme Manufacturing",
"invoice_date": "2031-03-01",
"due_at": "2031-03-31",
"kit_lines": [
{"invoice_item_id": 301, "item_master_id": 55, "sku": "KIT-FORK-24", "name": "24in Fork Kit", "quantity": 3}
]
},
"created_at": "2031-03-01T09:12:44-05:00",
"updated_at": "2031-03-02T15:40:10-05:00"
}
item_master_id, item ({id, sku, name}) and quantity say what an adhoc job produces; they feed the production forecast and are null for invoice jobs (which produce their invoice.kit_lines) and for blocks.
title is derived for invoice jobs (invoice number and client) and for blocks without their own title (the block type name). invoice.kit_lines lists the invoice lines whose item is a pre-build kit; it is what the schedule shows in the job tooltip and what you would build after production completes. invoice, production_line and block_type are null when they do not apply.
List events
GET /api/v1/production-schedule/events?start=2031-03-09&end=2031-03-16
Returns every scheduled event that overlaps the window (start and end are required; end must be after start). Because the window bounds the result, the list is not paginated. Backlog items are not included; use the backlog endpoint for those. Results are ordered by start time.
Optional filters: production_line_id, type (invoice / adhoc / block), completed (1 for completed only, 0 for open only).
Backlog
GET /api/v1/production-schedule/backlog
Everything waiting to be scheduled, in two lists, plus the add-on settings that shaped the result:
{
"success": true,
"data": {
"settings": {"backlog_days": 30, "eligibility": "kit_items", "statuses": "draft_sent"},
"events": [ ...event records with start_at null... ],
"invoices": [ ...event-shaped records with "id": null... ]
}
}
eventsare backlog rows that already exist: ad-hoc jobs created without a start, invoice jobs added to the backlog, and jobs sent back from the calendar. Completed and dismissed rows are excluded.invoicesare invoices that qualify under the add-on settings but have no schedule row yet. They are returned in the event shape so you can treat the backlog as one list, withid: nullbecause there is nothing to address until you create a job for them (or dismiss them). The invoice itself is underinvoice.settingsecho the Production Schedule settings:backlog_days(invoices dated within this many days),eligibility(kit_items= only invoices with a pre-build kit line,all),statuses(draft,draft_sent= draft and sent but not fully paid,draft_sent_paid).
Lines and block types
GET /api/v1/production-schedule/lines returns the active production lines in display order (id, name, bg_color, text_color, display_order, inactive). Add ?include_inactive=1 to include retired lines. Lines are managed in the app; there are no write endpoints for them.
GET /api/v1/production-schedule/block-types returns the block types (id, name, bg_color, text_color) used when blocking out time.
Create an event
POST /api/v1/production-schedule/events — body (JSON). type chooses the shape:
| Field | invoice | adhoc | block |
|---|---|---|---|
type | required: invoice, adhoc or block | ||
invoice_id | required (must be an invoice, not a quote or credit memo) | — | — |
title | ignored (derived) | required | optional (defaults to the block type name) |
note | optional, max 2000 characters | ||
block_type_id | — | — | required |
start_at | optional: omit to put the job in the backlog | optional: omit to put the job in the backlog | required |
production_line_id | required whenever start_at is sent | required | |
end_at | optional; must be after start_at | ||
duration_hours | optional, 0.25–1000; used when end_at is omitted. Default 4 hours. | ||
item_master_id | — | optional: the item this job produces | — |
quantity | — | required with item_master_id, greater than 0 | — |
Returns 201 with the new event. One exception: an invoice can have only one schedule row, so posting type: invoice for an invoice that already has a row (in the backlog, on the calendar, or dismissed) updates that row instead and returns 200. This also clears a "Don't Schedule" dismissal, which is how you undo one.
POST /api/v1/production-schedule/events
{"type": "invoice", "invoice_id": 118, "production_line_id": 1, "start_at": "2031-03-10 08:00:00", "duration_hours": 4}
POST /api/v1/production-schedule/events
{"type": "adhoc", "title": "Rebuild test fixture", "note": "Before the Thursday run"}
POST /api/v1/production-schedule/events
{"type": "block", "block_type_id": 2, "production_line_id": 1, "title": "Quarterly maintenance", "start_at": "2031-03-11T08:00:00-04:00", "end_at": "2031-03-11T17:00:00-04:00"}
Update an event
PUT /api/v1/production-schedule/events/{id} — every field optional: title (ignored for invoice jobs), note, production_line_id, start_at, end_at, duration_hours, and for ad-hoc jobs item_master_id and quantity (send item_master_id: null to clear what the job produces).
start_atalone moves the event and keeps its current duration.end_atalone keeps the current start; it must be after it.duration_hoursalone recomputes the end from the current start.- Scheduling a backlog job (sending
start_atfor an event with no dates) requires aproduction_line_id, either in the same request or already on the event.
Returns 200 with the updated event. To clear the dates and send a job back to the backlog use unschedule, not an update.
Complete, reopen, unschedule, delete
POST .../events/{id}/complete marks production complete (completed_at, completed_by). It returns 400 if the event is already complete. Completing never moves stock. For an invoice job the response's invoice.kit_lines tells you what was built; building the finished kits and consuming components is a separate step through the inventory endpoints, exactly as the in-app "Build Now" prompt is a separate step.
POST .../events/{id}/reopen clears the completion.
POST .../events/{id}/unschedule clears the dates on an invoice or ad-hoc job, returning it to the backlog. Blocks cannot be unscheduled (400); delete them instead.
DELETE .../events/{id} removes the event row. Deleting an invoice job does not touch the invoice; if the invoice still qualifies it reappears in the backlog's invoices list.
Dismiss an invoice
POST /api/v1/production-schedule/invoices/{invoice_id}/dismiss is the API form of "Don't Schedule": the invoice stops appearing in the backlog. Returns the (dismissed) event record with is_dismissed: true. It is refused with 400 while the invoice is on the calendar; unschedule it first. To reverse a dismissal, create an invoice job for the invoice again.
Production forecast
GET /api/v1/production-schedule/forecast answers "when can a customer have one?" from the schedule itself. Supply is stock on hand now plus every open scheduled job that produces the item: an invoice job counts for its own invoice, an ad-hoc job with item_master_id and quantity is a batch anyone can draw on. Demand is the unshipped quantity on draft and sent invoice lines, oldest invoice first, skipping invoices marked Don't Schedule. Supply is handed out in that order, so every batch knows which invoices it covers and every invoice line gets an expected completion date. Beyond the last planned batch the forecast adds projected batches that repeat the spacing and size of the planned batches; it needs at least two scheduled batches for the item to measure the rhythm; with fewer, the item's lead_time is the spacing and the last batch (or, with none, the item's reorder_qty) the size (cadence_source is batches or lead_time). Without either it reports reason: not_enough_batches rather than guessing. The item's min_stock_qty is the stock target: projection continues until uncommitted units across stock, planned and projected supply reach it, so an item built to stock gets a next batch with no invoice at all.
Without parameters it returns one summary per made item (active, source_method: make or kit_item_type: requires_pre_building) whether or not anything is ordered, plus any item an open scheduled job produces, minus items with hide_from_production_outlook: 1 (writable through the items API; a hidden item still answers the per-item call below and can still be what a job produces):
{
"success": true,
"data": [
{
"item_master_id": 1,
"sku": "TF2500",
"name": "Torque Forks Model TF2500",
"as_of": "2031-03-01T09:00:00-05:00",
"on_hand": 0,
"committed": 9,
"planned": 6,
"projected": 3,
"uncovered": 0,
"spare": 0,
"stock_target": 2,
"target_reached_at": {"at": "2031-04-18T17:00:00-04:00", "source": "projected", "is_projected": true},
"next_available": {"at": "2031-04-04T17:00:00-04:00", "source": "projected", "event_id": null, "title": "Projected batch 1", "is_projected": true},
"cadence_days": 14,
"batch_size": 3,
"cadence_based_on": 2,
"cadence_source": "batches",
"reason": null
}
]
}
With item_master_id={id} it returns the full forecast for that item: summary (as above), supply (each planned source with the invoices it covers and its uncommitted remainder), demand (each open invoice line with expected_at, is_projected, uncovered and what it is covered_by) and projected (the ghost batches). Add quantity=N to also get promise: the date by which N more units ordered now could be done, extending the projection as far as needed within the caps.
GET /api/v1/production-schedule/forecast?item_master_id=1&quantity=2
"promise": {"quantity": 2, "at": "2031-04-04T17:00:00-04:00", "source": "projected", "is_projected": true}
sourceis one ofstock,invoice_job,batchorprojected.- Projection stops once open demand is covered and uncommitted units reach the item's
min_stock_qty(at least one spare unit, or the requested quantity, when no level is set), after at most 12 batches or one year;reason: horizon_exceededmeans demand or the stock target outruns that. spareis the uncommitted quantity in stock and on planned jobs (projected batches excluded);stock_targetis the item'smin_stock_qty(0 when none);target_reached_atis when stock, planned then projected supply first reach it, null when the target is 0 or out of reach.- Completed jobs are not supply (their output is in stock or shipped) but they still count toward the batch cadence for 90 days.
- Dates are company-local completion times of the covering job, not ship dates.
Notes
- Event ids are stable across scheduling, unscheduling and completion, so you can keep them as references in an external system.
- The calendar page itself uses a different, calendar-shaped feed; the records above are the plain underlying data and are the supported integration surface.
- Requests from a company without the add-on enabled get
404for every endpoint on this page.