FansquareAPI reference
Open the app

Planning

Create a shift

POST/v1/shifts

Plans employees on a creator: one series per employee, once or repeated, from today on (a past day is refused, 409 planning_day_in_past). Give named_shift_id, or start_time and end_time (HH:mm in the agency time zone; an end before the start ends the next day). The planning never gives access to the creator. Confirm with the user first; if the call gets no response, list the shifts before retrying (a blind retry creates a duplicate).

Required scopewrite:planning
Rate limit30 requests per minute
curl -X POST 'https://api.fansquare.so/v1/shifts' \
  -H "Authorization: Bearer $API_KEY" \
  -H "Fansquare-Version: Amethyste" \
  -H "Content-Type: application/json" \
  -d '{
  "creator_id": "m81IhLxdhzDGYs54rNp2",
  "employee_ids": [
    "9926b1f9-74a9-4ab5-a716-1c14f6bcc475"
  ],
  "date": "string",
  "named_shift_id": "5afc7856-2404-4a6c-a7e5-5042b84bf795",
  "start_time": "string",
  "end_time": "string",
  "repeat": "none",
  "week_days": [
    "MO"
  ],
  "until_date": "2026-10-12T21:14:00.000Z"
}'
{
  "data": [
    {
      "id": "40a6e358-bd2a-4cff-a59e-5709874d3f5b",
      "creator_id": "m81IhLxdhzDGYs54rNp2",
      "employee_id": "9926b1f9-74a9-4ab5-a716-1c14f6bcc475",
      "starts_at": "2026-10-12T21:14:00.000Z",
      "ends_at": "2026-10-12T21:14:00.000Z",
      "timezone": "Europe/Paris",
      "repeat": "none",
      "week_days": [
        "string"
      ],
      "until": "2026-10-12T21:14:00.000Z",
      "named_shift_id": "5afc7856-2404-4a6c-a7e5-5042b84bf795",
      "from_work_profile": true,
      "replaces_shift_id": "29249479-15d7-43cf-ad43-e93d0d2f1c9b"
    }
  ]
}

Parameters

Headers

  • Fansquare-Versionstringrequired

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

Body

application/json

  • creator_idstringrequired

    Fansquare creator id (GET /v1/creators).

    min length 1
  • employee_idsarray of stringsrequired

    Who works it: one series per employee (ids of GET /v1/planning/team).

    min length 1min items 1max items 20
  • datestringrequired

    Day of the shift, or the first day of a repeated one.

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

    A named shift (GET /v1/named-shifts), instead of hours.

    format uuid
  • start_timestring

    Start, HH:mm in the agency time zone.

    pattern ^([01]\d|2[0-3]):[0-5]\d$
  • end_timestring

    End, HH:mm in the agency time zone.

    pattern ^([01]\d|2[0-3]):[0-5]\d$
  • repeatstring

    none (default), daily, weekly or biweekly.

    Valuesnonedailyweeklybiweekly
  • week_daysarray of strings

    Days of a weekly shift (default: the day of date).

    ValuesMOTUWETHFRSASUmin items 1max items 7
  • until_datestring

    Last day of the repetition, included. Omit for no end.

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

Response

Created, application/json

  • dataarray of objectsrequired
    • idstringrequired

      Series id (shift_id).

    • creator_idstringrequired

      Fansquare creator id.

    • employee_idstringrequired

      Fansquare user id.

    • starts_atstringrequired

      Start of its first shift (ISO 8601).

      format date-time
    • ends_atstringrequired

      End of its first shift (ISO 8601).

      format date-time
    • timezonestringrequired

      The time zone of the rule (the agency time zone when it was set).

    • repeatstringrequired

      none, daily, weekly, biweekly, monthly or yearly.

    • week_daysarray of strings | nullrequired

      Days of a weekly series, in its time zone.

    • untilstring | nullrequired

      End of the series (excluded), null without end.

      format date-time
    • named_shift_idstring | nullrequired

      The named shift it comes from.

    • from_work_profilebooleanrequired

      Made by a work profile.

    • replaces_shift_idstring | nullrequired

      A one-day change: the series whose day it replaces.

curl -X POST 'https://api.fansquare.so/v1/shifts' \
  -H "Authorization: Bearer $API_KEY" \
  -H "Fansquare-Version: Amethyste" \
  -H "Content-Type: application/json" \
  -d '{
  "creator_id": "m81IhLxdhzDGYs54rNp2",
  "employee_ids": [
    "9926b1f9-74a9-4ab5-a716-1c14f6bcc475"
  ],
  "date": "string",
  "named_shift_id": "5afc7856-2404-4a6c-a7e5-5042b84bf795",
  "start_time": "string",
  "end_time": "string",
  "repeat": "none",
  "week_days": [
    "MO"
  ],
  "until_date": "2026-10-12T21:14:00.000Z"
}'
{
  "data": [
    {
      "id": "40a6e358-bd2a-4cff-a59e-5709874d3f5b",
      "creator_id": "m81IhLxdhzDGYs54rNp2",
      "employee_id": "9926b1f9-74a9-4ab5-a716-1c14f6bcc475",
      "starts_at": "2026-10-12T21:14:00.000Z",
      "ends_at": "2026-10-12T21:14:00.000Z",
      "timezone": "Europe/Paris",
      "repeat": "none",
      "week_days": [
        "string"
      ],
      "until": "2026-10-12T21:14:00.000Z",
      "named_shift_id": "5afc7856-2404-4a6c-a7e5-5042b84bf795",
      "from_work_profile": true,
      "replaces_shift_id": "29249479-15d7-43cf-ad43-e93d0d2f1c9b"
    }
  ]
}