FansquareAPI reference
Open the app

Planning

Declare an absence

POST/v1/absences

An employee is absent one day, today or later: their shifts that day go to the replacement, if one is given, otherwise they stay without anyone (see GET /v1/planning/coverage). One absence per employee and day. The replacement takes their shifts on every creator: a key limited to some creators cannot write absences (403 absence_needs_all_creators). Confirm with the user first.

Required scopewrite:planning
Rate limit30 requests per minute
curl -X POST 'https://api.fansquare.so/v1/absences' \
  -H "Authorization: Bearer $API_KEY" \
  -H "Fansquare-Version: Amethyste" \
  -H "Content-Type: application/json" \
  -d '{
  "employee_id": "9926b1f9-74a9-4ab5-a716-1c14f6bcc475",
  "date": "string",
  "kind": "absence",
  "reason": "string",
  "replacement_id": "03cef609-3d3c-42bd-a9e5-04182baf2362"
}'
{
  "id": "40a6e358-bd2a-4cff-a59e-5709874d3f5b",
  "employee_id": "9926b1f9-74a9-4ab5-a716-1c14f6bcc475",
  "date": "string",
  "kind": "absence",
  "replacement_id": "03cef609-3d3c-42bd-a9e5-04182baf2362",
  "declared_by_self": true
}

Parameters

Headers

  • Fansquare-Versionstringrequired

    API version to pin. Accepts the mineral name or the release date of a version.

Body

application/json

  • employee_idstringrequired

    The absent employee (Fansquare user id).

    min length 1
  • datestringrequired

    Day of the absence, in the agency time zone.

    pattern ^\d{4}-\d{2}-\d{2}$
  • kindstring

    absence (default) or day_off.

    Valuesabsenceday_off
  • reasonstring | null

    Reason, 200 characters at most. Written, never read back: it may be health data.

    max length 200
  • replacement_idstring | null

    Who takes their shifts that day.

    min length 1

Response

Created, application/json

  • idstringrequired

    Absence id.

  • employee_idstringrequired

    Fansquare user id.

  • datestringrequired

    Day (YYYY-MM-DD), in the agency time zone.

  • kindstringrequired

    absence or day_off.

    Valuesabsenceday_off
  • replacement_idstring | nullrequired

    Who takes their shifts that day.

  • declared_by_selfbooleanrequired

    The employee declared it themselves.

curl -X POST 'https://api.fansquare.so/v1/absences' \
  -H "Authorization: Bearer $API_KEY" \
  -H "Fansquare-Version: Amethyste" \
  -H "Content-Type: application/json" \
  -d '{
  "employee_id": "9926b1f9-74a9-4ab5-a716-1c14f6bcc475",
  "date": "string",
  "kind": "absence",
  "reason": "string",
  "replacement_id": "03cef609-3d3c-42bd-a9e5-04182baf2362"
}'
{
  "id": "40a6e358-bd2a-4cff-a59e-5709874d3f5b",
  "employee_id": "9926b1f9-74a9-4ab5-a716-1c14f6bcc475",
  "date": "string",
  "kind": "absence",
  "replacement_id": "03cef609-3d3c-42bd-a9e5-04182baf2362",
  "declared_by_self": true
}