---
title: "Create attendance schedule"
method: POST
path: "/v2/organizations/{organization_id}/attendance_schedules"
tags: ["attendance_schedules"]
---

# Create attendance schedule

`POST /v2/organizations/{organization_id}/attendance_schedules`

## Request

- Base URL: `https://api.hubstaff.com`
- URL: `https://api.hubstaff.com/v2/organizations/{organization_id}/attendance_schedules`
- Auth: OAuth 2
  - Authorization code: `https://account.hubstaff.com/authorizations/new`
  - Token URL: `https://account.hubstaff.com/access_tokens` scopes: `hubstaff:read`, `hubstaff:write`
- TypeScript: <https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/docs/v2/organizations/:organization_id/attendance_schedules/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates an expected work shift for a user.

Returns the created attendance schedule.

For repeating schedules, specify repeat_schedule (weekly/bi_weekly) and weekdays. Use repeat_until to set an end date. Use excluded_dates to skip specific dates.

## Path parameters

- `organization_id` integer, required

## Request body

- PostV2OrganizationsOrganizationIdAttendanceSchedules: Create attendance schedule
  - `user_id` integer, required: User ID
  - `start_date` string, date, required: Attendance Schedule Start Date
  - `start_time` string, required: Attendance Schedule Start Time, 24 hour time in 30 minutes intervals (h:mm)
  - `duration` integer, required: Shift duration in seconds
  - `minimum_time` integer, required: Minimum shift time in seconds
  - `use_time_zone` 'organization' | 'user', required: What time zone to use
  - `repeat_schedule` 'never' | 'weekly' | 'bi_weekly', required: Shift repetition schedule
  - `weekdays` string[]: Shift repetition week days
  - `repeat_until` string, date: Shift end date
  - `excluded_dates` string[]: Excluded dates from the repetition schedule

## Response `200`

attendance schedule created

- object
  - `attendance_schedule` AttendanceSchedule: AttendanceSchedule model
    - `id` integer, required: Attendance schedule ID
    - `user_id` integer, required: User ID
    - `organization_id` integer, required: Organization ID
    - `created_at` string, date-time, required: When the record was created
    - `updated_at` string, date-time, required: When the record was last updated
    - `start_date` string, date, required: Shift start date
    - `use_time_zone` string, required: What time zone to use
    - `start_time` string, date-time, required: Shift start time (only hh:mm:ss
    - `duration` integer, required: Shift duration
    - `minimum_time` integer, required: Minimum shift time
    - `repeat_schedule` string, required: Shift repetition schedule
    - `repeat_until` string, date: Shift end date
    - `weekdays` string[]: Shift repetition week days
    - `excluded_dates` string[]: Excluded dates from the repetition schedule

## Other responses

- `400`: Invalid parameters
- `401`: Unauthorized
- `403`: API access is only for organizations on an active plan
- `404`: Could not find record
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/hubstaff/apis/hubstaff-v2-api.md) - [All operations](https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/revisions/c6b90e4e4bdc?raw)
