Edit a Shift

Changes an ended shift's start, end or type. Send only what you want to change. Active shifts can't be edited, so end them first.

PATCH

/api/v1/server/shifts/{shiftId}

Request

curl -X PATCH "https://api.melonly.com/api/v1/server/shifts/{shiftId}" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "endedAt": 1794778000000,
  "performedBy": "7264722635089514496"
}'

Response

200

Success

{
  "data": {
    "breakTimestamps": [
      {
        "endedAt": 1794777600000,
        "startedAt": 1794777000000
      }
    ],
    "createdAt": 1794776859830,
    "endedAt": 1794790000000,
    "id": "7527830759214682112",
    "memberId": "7308965405773533184",
    "serverId": "7294057520392310784",
    "type": "7400000000000000000",
    "wave": 12
  }
}

Authorization

Authorizationstringrequired
Your API token as Bearer YOUR_TOKEN. Create one in your server's dashboard settings.

Path parameters

shiftIdstringrequired

Body

performedBystringrequired
Member ID of the staff member editing it.
endedAtinteger | null
New end time. Must be after the start and not in the future.
startedAtinteger | null
New start time.
typestring | null
New shift type ID.

Response

200 Success

breakTimestampsobject[]required
Breaks taken, oldest first. See the break object.
createdAtintegerrequired
When the shift started.
idstringrequired
Shift ID.
memberIdstringrequired
Member ID of the member on shift.
serverIdstringrequired
Server ID, or department ID for department shifts.
waveintegerrequired
Activity wave the shift counts towards.
autoEndboolean | null
Whether the shift ends automatically.
endedAtinteger | null
When the shift ended. Missing while it's active.
endedBystring | null
Member ID of who ended it, if not the member.
typestring | null
Shift type ID. Missing for the default type.

Errors

StatusMeaning
400Invalid request. validation_failed lists each invalid field in details.fields.
401Missing, invalid or expired token
403Success
404Not found
409The shift is still active
429Rate limited. See Retry-After and details.
500Internal server error
502next did not confirm the write. Check whether it applied before retrying.
503Write endpoints are not configured on this deployment