WorkTime ProHandbuch
Zur Anwendung

Beispiele mit curl

Die Beispiele setzen https://zeit.example.de als Adresse voraus.

Anmelden und Token merken

TOKEN=$(curl -s -X POST https://zeit.example.de/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@example.de","password":"Geheim123!"}' \
  | jq -r .accessToken)

Danach in jedem Aufruf:

AUTH="Authorization: Bearer $TOKEN"

Die eigenen Angaben

curl -s https://zeit.example.de/api/v1/auth/me -H "$AUTH" | jq

Kommen

curl -s -X POST https://zeit.example.de/api/v1/time-entries/clock-in \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"employeeId":"…","costCenterRef":"…"}' | jq

Ohne costCenterRef gilt die am Mitarbeiter hinterlegte Kostenstelle. Die Auswahlliste dafür:

curl -s https://zeit.example.de/api/v1/time-entries/refs -H "$AUTH" | jq

Pause und Gehen

curl -s -X POST https://zeit.example.de/api/v1/time-entries/break/start \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"timeEntryId":"…"}'

curl -s -X POST https://zeit.example.de/api/v1/time-entries/break/end \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"timeEntryId":"…"}'

curl -s -X POST https://zeit.example.de/api/v1/time-entries/clock-out \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"timeEntryId":"…"}' | jq

Die Antwort auf das Ausstempeln enthält die Buchung, die vollständige Rechnung und die gefundenen ArbZG-Verstöße.

Den Stand abfragen

curl -s https://zeit.example.de/api/v1/time-entries/status/<employeeId> -H "$AUTH" | jq
{
  "status": "RUNNING",
  "entry": { "id": "…", "startedAt": "2026-09-05T06:02:11.000Z", "breakStartedAt": null },
  "onBreak": false,
  "breakTracking": true,
  "timezone": "Europe/Berlin"
}

breakTracking sagt, ob dieser Mitarbeiter überhaupt einen Pausenknopf bekommt — siehe Pausenerfassung.

Zeit nachtragen

curl -s -X POST https://zeit.example.de/api/v1/time-entries/manual \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{
        "employeeId": "…",
        "startedAt": "2026-09-04T07:00:00.000Z",
        "endedAt":   "2026-09-04T15:30:00.000Z",
        "comment":   "Einstempeln vergessen"
      }' | jq

Freigeben

curl -s -X PATCH https://zeit.example.de/api/v1/time-entries/<id>/approve \
  -H "$AUTH" -H "Content-Type: application/json" -d '{}' | jq

Ablehnen mit /reject und einem comment.

Einsatz beim Kunden

curl -s -X POST https://zeit.example.de/api/v1/projects/time/start \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"projectId":"…"}' | jq

curl -s -X POST https://zeit.example.de/api/v1/projects/time/stop \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"erledigt": true}' | jq

erledigt ist Pflicht; bei false zusätzlich completionNote.

Bericht und Export

curl -s "https://zeit.example.de/api/v1/reports/time?from=2026-08-01&to=2026-08-31&take=100" \
  -H "$AUTH" | jq '.totals'

curl -s "https://zeit.example.de/api/v1/reports/time.csv?from=2026-08-01&to=2026-08-31" \
  -H "$AUTH" -o zeitbericht-august.csv

Zeitraum abschließen

curl -s -X POST https://zeit.example.de/api/v1/time-accounts/<employeeId>/close \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"periodStart":"2026-08-01","periodEnd":"2026-08-31"}' | jq

Mit einem API-Schlüssel

Ohne Anmeldung, ohne Erneuerung:

curl -s "https://zeit.example.de/api/v1/reports/time?from=2026-08-01&to=2026-08-31" \
  -H "X-API-Key: wt_1a2b3c4d.e5f6…" | jq '.totals'

Zustand prüfen

curl -s https://zeit.example.de/api/v1/ready | jq
curl -s -o /dev/null -w '%{http_code}\n' https://zeit.example.de/api/v1/ready

Der Statuscode ist die eigentliche Aussage: 200 wenn es trägt, 503 bei einer Störung.