> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://support.xperiencehr.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Flexible Shift API

The **Flexible Shift API** in XperienceHR provides a RESTful interface for managing employee flexible work schedules via XML payloads. External systems can assign, update, or delete daily shift assignments—complete with start/end times, break durations, reporting groups, projects, and activities—ensuring accurate workforce planning and time tracking.

This API processes **XML** payloads submitted to the endpoint and returns structured XML responses indicating success or detailed error messages. Authentication is enforced via an **API key** passed as a query parameter.

By integrating the Flexible Shift API, organizations can automate schedule assignments, enforce flexible working policies, and simplify downstream payroll and reporting processes.
---

# Overview

**API Type:** REST  
**Supported Formats:** XML  
**API Key:** Generated in the app configuration  
**Method:** *POST*
---

# Operations

### Assign or Update Shift Day

Creates or updates one or more shift-day assignments.

| **Field** | **Type** | **Required** | **Description** |
| ---- |
| login | string | ✅ | Employee login identifier. |
| date | date | ✅ | Assignment date in `YYYY-MM-DD` format. Must fall within the employee’s calendar. |
| start | time | ❌ | Shift start time (`HH:MM`). |
| end | time | ❌ | Shift end time (`HH:MM`). |
| breakDuration | integer | ❌ | Break length in minutes. |
| ReportingGroup name | string | ❌ | Reporting group name (must exist in system). |
| Project name | string | ❌ | Project name (must exist in system). |
| Activity name | string | ❌ | Activity name (must exist in system). |

||| Employees must have an active Work Calendar with **Flexible Working Days** enabled before assigning shifts ⚠️

###### Endpoint
---

### Delete Shift Day

Removes existing shift-day assignments. Include only the `<login>` and `<date>` fields.

###### Endpoint
---

### Error Handling

Common errors help in debugging and correcting API usage issues.

**Example 1: Not Flexible Work Calendar**

**Example 2: Wrong Project**
---

### HTTP Response Codes
* **2XX Success** - Operation completed successfully.
* **4XX Client Error** - Likely an issue with the request, such as incorrect parameters or insufficient permissions. Returns an error message in text or XML format.
* **5XX Server Error** - Indicates a server issue. Report this error if encountered.
