Overview
The TurnShift API lets you integrate shift scheduling into your existing workflows. Build custom integrations, automate repetitive tasks, or sync TurnShift with your internal tools.
What you can do with the API:
- Manage shifts — Create, update, and delete shifts programmatically
- Automate bookings — Assign team members to shifts based on your own logic
- Sync teams — Keep your TurnShift teams in sync with your HR system
- Build dashboards — Pull schedule data into your own reporting tools
- Integrate with Slack/Discord — Create custom bots that interact with your schedules
All endpoints return JSON and use standard HTTP methods.Read = read-onlyWrite = modifies data
Authentication
All API requests require a Bearer token in the Authorization header:
Authorization: Bearer <your-api-token>Quick Start
Test your API token by fetching your organization info.
curl -H "Authorization: Bearer <your-api-token>" \
https://turnshift.app/api/v1/meExpected response:
{
"organization": {
"id": 123,
"name": "Your Organization",
"slug": "your-org",
"createdAt": "2024-01-01T00:00:00.000Z"
}
}Common Examples
Here are curl examples for the most common API operations.
Fetch all teams in your organization.
curl -H "Authorization: Bearer <your-api-token>" \
https://turnshift.app/api/v1/teamsAdd a team member by email. Replace :teamId with the team ID.
curl -X POST \
-H "Authorization: Bearer <your-api-token>" \
-H "Content-Type: application/json" \
-d '{"user": "[email protected]"}' \
https://turnshift.app/api/v1/teams/1/membersFetch all shifts in your organization.
curl -H "Authorization: Bearer <your-api-token>" \
https://turnshift.app/api/v1/shiftsAssign a user to a shift on a specific date. Add ?notify=true to send a Slack notification.
curl -X POST \
-H "Authorization: Bearer <your-api-token>" \
-H "Content-Type: application/json" \
-d '{"user": "[email protected]"}' \
https://turnshift.app/api/v1/shifts/1/bookings/2024-01-15Remove a user from a shift on a specific date. Add ?notify=true to send a Slack notification.
curl -X DELETE \
-H "Authorization: Bearer <your-api-token>" \
-H "Content-Type: application/json" \
-d '{"user": "[email protected]"}' \
https://turnshift.app/api/v1/shifts/1/bookings/2024-01-15Users Read
List users in your organization and view their team memberships.
/api/v1/usersList all users in your organization
Response:
{
"users": [
{
"id": 1,
"email": "[email protected]",
"name": "John Doe",
"timezone": "America/New_York",
"teams": [{ "id": 1, "name": "Support" }]
}
]
}Organization Read
Retrieve information about your organization.
/api/v1/meGet organization information
Response:
{
"organization": {
"id": 123,
"name": "Acme Inc",
"slug": "acme-inc",
"createdAt": "2024-01-01T00:00:00.000Z"
}
}Shifts Read Write
Create, update, and delete shifts. Configure shift times, timezones, and notification settings.
/api/v1/shiftsList all shifts
/api/v1/shiftsCreate a new shift
Request body:
{
"name": "Morning Support",
"startTime": "09:00",
"endTime": "17:00",
"timeZone": "Europe/Paris",
"slackChannelId": 123
}/api/v1/shifts/:shiftIdGet shift details
/api/v1/shifts/:shiftIdUpdate a shift
/api/v1/shifts/:shiftIdDelete a shift
Bookings Read Write
Assign users to shifts on specific dates and retrieve booking schedules.
Specifying users: You can identify users by their numeric ID (e.g., 123) or email (e.g., [email protected]).
/api/v1/shifts/:shiftId/bookings?year=2024&month=1Get bookings for a month
Response:
{
"shift": { "id": 1, "name": "Support" },
"year": 2024,
"month": 1,
"bookings": {
"2024-01-15": [
{ "id": 1, "email": "[email protected]", "name": "John Doe" }
],
"2024-01-16": []
}
}/api/v1/shifts/:shiftId/bookings/:dateBook a user for a shift on a specific date
Query parameters:
notify=true(optional) - Send a Slack notification to the user
Request body:
{
"user": "[email protected]" // or user ID: "123"
}/api/v1/shifts/:shiftId/bookings/:dateRemove a booking
Query parameters:
notify=true(optional) - Send a Slack notification to the user
Request body:
{
"user": "[email protected]"
}Teams Read Write
Create, update, and delete teams. Teams group users together for shift assignments.
/api/v1/teamsList all teams
/api/v1/teamsCreate a team
Request body:
{ "name": "Support Team" }/api/v1/teams/:teamIdGet team details
/api/v1/teams/:teamIdUpdate a team
/api/v1/teams/:teamIdDelete a team
Team Members Read Write
Add and remove users from teams.
Specifying users: You can identify users by their numeric ID (e.g., 123) or email (e.g., [email protected]).
/api/v1/teams/:teamId/membersList team members
/api/v1/teams/:teamId/membersRemove a member from a team
Request body:
{ "user": "[email protected]" }Error Responses
Errors return a JSON object with error and optional details:
{
"error": "Unauthorized",
"details": "Invalid API token"
}| Status | Meaning |
|---|---|
| 400 | Bad request / Validation error |
| 401 | Unauthorized (invalid or missing token) |
| 403 | Forbidden (organization blocked) |
| 404 | Resource not found |
| 405 | Method not allowed |
TurnShift API v1