Leave
Leave endpoints need the Leave product. Requesting needs leave:request:create; reading your balances leave:balance:read_own. Approving goes through the shared approval inbox. Full details: Leave API.
Recipe: check your balance
curl -s "$OPEX/api/leave/balances/mine" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{items: [.items[] | {type_name, year, total_allowance, used_days, pending_days}]}'{ "items": [ { "type_name": "Annual", "year": 2026, "total_allowance": 12, "used_days": 0, "pending_days": 0 } ]}Pass year=2027 for another year. Types without a yearly quota (sick leave, for example) have no balance row.
Recipe: request two days off
A request needs a leave type and a colleague who covers for you.
TYPE_ID=$(curl -s "$OPEX/api/leave/types" -H "X-API-Key: $OPEX_API_KEY" \ | jq -r '.items[] | select(.name == "Annual") | .id')PEER_ID=$(curl -s "$OPEX/api/leave/peers?search=dewi" -H "X-API-Key: $OPEX_API_KEY" \ | jq -r '.items[0].id')
curl -s -X POST "$OPEX/api/leave/requests" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"type_id\":\"$TYPE_ID\",\"start_date\":\"2028-09-11\",\"end_date\":\"2028-09-12\", \"reason\":\"Family trip\",\"covering_peer_id\":\"$PEER_ID\"}" \ | jq '{id, status, days, start_date, end_date}'{ "id": "e3cbf033-8e44-4432-9a7d-55dd59f8c4bb", "status": "pending", "days": 2, "start_date": 1852243200000, "end_date": 1852329600000}Dates go in as calendar days and come back as epoch milliseconds at UTC midnight; days counts working days. Common refusals: leave_balance_not_allocated (no quota for that year yet: ask your admin), overlapping_leave, and zero_working_days (the range is only weekends or holidays). Cancel with POST /api/leave/requests/{id}/cancel.