SA ShiftAlert DeveloperAPI reference

Integration documentation

ShiftAlert API

Use the ShiftAlert API to import departments, crew, managers, and shifts from scheduling, dispatch, spreadsheet, or CRM systems, then read imported shift status and call-result fields back.

Base URLhttps://app.shiftalert.eu/api/v1

Examples use the production API. For an isolated local installation, use that installation's origin followed by /api/v1. API contract v1.0 is independent of the ShiftAlert application release number.

Getting started

  1. Open Integrations in ShiftAlert.
  2. Create a Custom API token for the company.
  3. Send batches to /imports/ with a bearer token.
  4. Use Idempotency-Key for safe retries.
  5. Read import jobs or shift status using the GET endpoints below.

Authentication

Every API request needs a company-scoped bearer token generated from the Integrations page. ShiftAlert stores only the token hash and last four characters.

Authorization: Bearer sa_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Reference

Endpoints

REST JSON
POST /imports/

Bulk upsert departments, workers, managers, and shifts. Valid shifts create or update ShiftAlert shifts and prepare wake-up/check-call protection.

Send at least one non-empty departments, workers, managers, or shifts array. The JSON body must be at most 1 MiB (1,048,576 bytes); larger requests return 413. Importing shifts can reserve credits and make them eligible for scheduled calls when protection and operational settings permit.

start_at is required for each shift; end_at is optional. Date-times without an offset use the company's configured time zone, falling back to Europe/Copenhagen. Date-times with an explicit offset are converted to that company time zone. Returned timestamps use company-local YYYY-MM-DD HH:MM:SS without an offset.

Past calendar dates and missing or invalid assigned worker phones produce row errors. Shifts that already have alert attempts are retained with action: locked. Insufficient credits or other protection restrictions can leave an imported shift unprotected with a warning; a successful HTTP response alone does not mean every shift is protected.

workers[].name maps to Crew Name. Crew Comment is free text and is not used for CSV/API identity matching. shifts[].route maps to the Alerts table Shift number, and shifts[].comment maps to the Alert/Shift Comment.

Worker external IDs are source-scoped and shown in Crew as read-only Integration IDs.

source.name identifies the external system and is shown when users hover the API badge on Alerts. Optional source.comment is stored as the import batch note in Import history.

Phone numbers are Danish-only. Accepted input formats are 12345678, 4512345678, +4512345678, or 004512345678. ShiftAlert stores and returns digits only, for example 4512345678. Invalid assigned worker phones block the row; invalid manager phones are warnings and are not saved.

  • Same source and same external ID matches the existing crew member.
  • Same phone can link a new external ID to an existing crew member.
  • Same name with a different phone creates a separate crew member with a suffix and records a warning.
  • External ID and phone conflicts block the row for review instead of silently changing identities.

Headers

Authorization: Bearer <token>
Content-Type: application/json
Idempotency-Key: dispatch-2026-11-30-run-1

Idempotency-Key is optional but recommended for retries. Reusing a key on the same connection returns the original job even if the new body differs; use a new key for a changed batch. A new job returns 201 with idempotent: false; a replay returns 200 with idempotent: true.

Request body

{
  "source": { "name": "Local Dispatch", "comment": "Published dispatch batch" },
  "departments": [{ "external_id": "dep-ops", "name": "Operations" }],
  "workers": [{ "external_id": "drv-100", "name": "Alex Driver", "phone": "4512345678", "department_external_id": "dep-ops" }],
  "managers": [{ "external_id": "mgr-10", "name": "Mia Manager", "phone": "4587654321", "email": "mia@example.com", "department_external_ids": ["dep-ops"] }],
  "shifts": [{
    "external_id": "shift-9001",
    "start_at": "2026-11-30 06:00:00",
    "end_at": "2026-11-30 14:00:00",
    "department_external_id": "dep-ops",
    "worker_external_id": "drv-100",
    "manager_external_id": "mgr-10",
    "route": "SA-1001",
    "location": "Copenhagen",
    "comment": "Gate B"
  }]
}

Response

The following is an abridged successful response. The real row also includes target IDs, raw input, and the complete normalized object.

{
  "data": {
    "id": 123,
    "status": "completed",
    "created_count": 1,
    "updated_count": 0,
    "unchanged_count": 0,
    "deleted_count": 0,
    "skipped_count": 0,
    "error_count": 0,
    "warning_count": 0,
    "active_issue_count": 0,
    "rows": [{
      "row_index": 1,
      "entity_type": "shift",
      "row_status": "ok",
      "action": "created",
      "target_trip_id": 42,
      "warnings": [],
      "errors": [],
      "import_issues": [],
      "normalized": {
        "external_id": "shift-9001",
        "start_dt": "2026-11-30 06:00:00",
        "num": "SA-1001",
        "worker_phone": "4512345678"
      }
    }]
  },
  "idempotent": false
}

Shift row action reports the data outcome independently from row_status: created, updated, unchanged, locked, or skipped. The shared job format also includes deleted and deleted_count for provider reconciliation such as Planday; Custom API imports do not delete missing shifts. Job responses include row_pagination for the first 500 row records; use GET below to retrieve subsequent pages. The example above omits this metadata and the worker row for brevity.

Job statuses

  • pending: the job was created and is still being processed.
  • completed: processing finished without warnings or errors counted in the shift summary; inspect individual rows too.
  • completed_with_errors: the shift summary counted at least one warning or error; inspect counts and rows.

Always inspect individual row_status, warnings, and errors, including worker rows. Job counters summarize shifts and may not reflect every reference-entity warning or locked-row warning.

GET /imports/?id=123

Return one import job with counts and row-level errors or warnings. active_issue_count counts distinct affected entity keys from this job that are still unresolved, not individual messages. Rows include an additive import_issues array with issue code, severity, message, and active/resolved state. Dated shift issues are also shown as Warning on Alerts; the Source column shows API and the submitted source name.

The company default manager must have a valid profile phone before shift rows can be applied. The Owner is used automatically unless Settings selects another manager. Missing readiness records each shift row as an error/skipped row without creating or charging a shift. Add the phone in Account or Managers, then submit a new import job; replaying an existing idempotency key returns that existing job.

GET https://app.shiftalert.eu/api/v1/imports/?id=123&limit=100&offset=0
Authorization: Bearer <token>

Row pagination

  • id: required import job ID belonging to the token's company.
  • limit: optional integer from 1 to 500; default 500.
  • offset: optional non-negative integer; default 0. Malformed pagination parameters return 400.

The data.rows array contains one page ordered by row index and then internal row ID. Counts and active_issue_count cover the whole job. data.row_pagination.total counts all row records, including worker rows, so it can differ from the shift count total_count.

"row_pagination": {
  "limit": 100,
  "offset": 0,
  "total": 730,
  "has_more": true,
  "next_offset": 100
}

Repeat GET with offset set to next_offset until has_more is false and next_offset is null. An offset at or beyond the end returns an empty rows array with the full total. For a stable traversal, read a completed job.

GET /shifts/

Return shifts linked to the current API connection and their stored status/call-result fields. This endpoint does not list every company shift.

from and to are required inclusive calendar dates in exact YYYY-MM-DD format, using the company's time zone. Missing values, impossible dates such as 2026-02-29, and from later than to return 400. A valid range with no matching shifts returns 200 and an empty data array.

GET https://app.shiftalert.eu/api/v1/shifts/?from=2026-11-30&to=2026-12-01
Authorization: Bearer <token>

Response

{
  "data": [{
    "id": 42,
    "external_id": "shift-9001",
    "start_at": "2026-11-30 06:00:00",
    "end_at": "2026-11-30 14:00:00",
    "route": "SA-1001",
    "location": "Copenhagen",
    "comment": "Gate B",
    "department": { "id": 3, "name": "Operations" },
    "worker": { "id": 8, "name": "Alex Driver", "phone": "4512345678" },
    "manager": { "id": 5, "name": "Mia Manager", "phone": "4587654321" },
    "protected": true,
    "unprotected_reason": "",
    "cancel_call": false,
    "resolved": false,
    "call_status": { "r1": 0, "a1": "", "r2": 0, "a2": "", "call_manager": false },
    "time_zone": "Europe/Copenhagen",
    "manager_call_paused": false,
    "recurring_call_paused": false,
    "alert_status": {
      "code": "pending",
      "display_code": "pending",
      "label": "Pending",
      "resolved": false,
      "has_import_issue": false,
      "shift_started": false,
      "shift_result": "",
      "resolution_source": "",
      "first_stage_inflight": false,
      "second_stage_inflight": false,
      "remaining_calls": {
        "worker": true,
        "manager": false
      }
    }
  }],
  "pagination": { "limit": 1, "offset": 0, "total": 1 }
}

Call and protection fields

  • protected: the shift's recorded protection flag. unprotected_reason contains the reason when protection was not applied. Protection does not prove that a call was made or answered.
  • cancel_call: worker alerts are stopped for this shift; manager reminders are controlled separately.
  • resolved: the stored resolved flag is set, or the second-stage answer is Y.
  • r1 / r2: stored attempt counters for the first and second worker-call stages.
  • a1 / a2: stored stage results. Y means confirmed; an empty string has no recorded result; _ is a failure marker. Other legacy values are not confirmation.
  • call_manager: stored manager-escalation flag; this flag alone does not mean a manager call is active.

Alerts status snapshot

Available since product V1.3.46; API version remains v1.0. Existing response fields keep their meaning and types. The new alert_status object follows the same rules as Alerts, using the company time zone, attempt limit and current worker queue state.

  • manager_call_paused: manual pause for the current manager escalation series. Independent of worker cancel_call. A new escalation may rearm reminders under the existing rules.
  • recurring_call_paused: calls paused by the recurring schedule for this occurrence. time_zone is the company IANA zone, or empty if unset.
  • alert_status.code: pending, needs_attention, critical, confirmed, resolved, lost, or alerts_stopped.
  • display_code and label: the status shown in Alerts. An active dated import issue takes priority as warning / Warning; otherwise a pending recurring occurrence can show calls_paused / Calls paused. A pause does not hide an existing incident.
  • alert_status.resolved: derived completion flag for Confirmed, Resolved or Lost; it does not stop calls. The legacy top-level resolved remains unchanged. For example, a recorded no-show after a confirmed phone answer keeps top-level true but produces Critical and nested false.
  • has_import_issue reports the active dated import warning for this shift. See the import-job response for issue details. shift_started uses the company time zone and is false if that zone is missing or invalid.
  • shift_result: recorded attendance, normalized to an empty string, showed_up, no_show_valid, or no_show_no_reason. resolution_source is the stored decision, such as handling, worker_attended, replacement_arranged, lost, or auto_confirmed.
  • first_stage_inflight / second_stage_inflight: a worker job is queued, dispatching or active. This does not prove that the phone is ringing or answered.
  • remaining_calls.worker / remaining_calls.manager: calls that may still continue under Alerts controls, attempts, stage progress and the post-start window. Missing time zone, Recurring pause and final phone confirmation prevent both. These flags do not guarantee scheduling, provider availability, credits or call completion.

Status priority follows Alerts: lost decision; manual/legacy resolution; missed/failed or already-started unconfirmed protected shift; final confirmation; first-stage failure/manager escalation/handling; worker alerts stopped; pending. Warning and Calls paused are display overrides. This is a read-time snapshot and can change as calls or manager decisions progress.

Only stored shifts linked to this connection are returned. Rejected imports without a stored shift can appear as synthetic Warning rows in Alerts; use /imports/ for those errors.

The pagination object on this endpoint describes the returned date-range result: limit and total equal its size and offset is zero. It does not implement limit/offset query paging; use smaller date ranges when needed.

Errors

Public API errors return JSON with an error.message string.

{ "error": { "message": "Invalid bearer token." } }
200 OK 201 Created 400 Bad request 401 Unauthorized 403 Forbidden 404 Not found 405 Method not allowed 413 Body exceeds 1 MiB 429 Rate limit exceeded 500 Import failed

Rate limits

Each API token is limited to 60 requests per rolling minute. A limited request returns HTTP 429. Send batches instead of one request per shift where possible.

CSV import

The CSV importer uses the same normalizer as the Custom API. The Import UI labels fields with ShiftAlert screen names: Date, Time, Shift number, Comment, Crew member, External ID, Phone, Department, and Manager. Supported mapped keys include shift_date, start_time, end_time, worker_name, worker_external_id, worker_phone, department, route, location, comment, manager_name, manager_phone, and external_id. comment is saved as the Alert/Shift comment. Phone values use the same Danish format rules and are saved without +.