Custom Fields
Custom fields allow you to attach additional structured data to shifts. Field definitions are created in the Connecteam UI, and values can be set and updated via the API.
Overview
Custom fields enable you to track shift-specific information such as:
- Project codes
- Cost centers
- Client names
- Equipment IDs
- Any other metadata relevant to your business
How It Works
1. Define Fields (UI Only)
Custom field definitions must be created in the Connecteam UI:
- Navigate to your Scheduler settings
- Go to Custom Fields section
- Create fields with types like text, number, dropdown, etc.
2. Get Field Definitions (API)
Retrieve available custom fields using the API:
curl --request GET \
--url https://api.connecteam.com/scheduler/v1/schedulers/9454799/custom-fields/shifts \
--header 'X-API-KEY: YOUR_API_KEY'3. Set Values (API)
When creating or updating shifts, include custom field values:
{
"customFields": [
{
"id": "field_abc123",
"value": "PROJ-2024-001"
}
]
}API Endpoint
Get Custom Field Definitions
Endpoint:
GET /scheduler/v1/schedulers/{schedulerId}/custom-fields/shifts
Response:
{
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"data": {
"customFields": [
{
"id": "field_abc123",
"title": "Project Code",
"type": "text",
"required": false,
"order": 1
},
{
"id": "field_def456",
"title": "Cost Center",
"type": "dropdown",
"required": true,
"options": [
{"id": "opt1", "label": "Operations"},
{"id": "opt2", "label": "Sales"}
],
"order": 2
}
]
},
"paging": {
"offset": 1
}
}Working with Custom Fields
Creating Shifts with Custom Fields
Include custom field values in the shift creation request:
curl --request POST \
--url 'https://api.connecteam.com/scheduler/v1/schedulers/9454799/shifts' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: YOUR_API_KEY' \
--data '[
{
"startTime": 1736924400,
"endTime": 1736953200,
"title": "Project Shift",
"isPublished": true,
"assignedUserIds": [9170357],
"customFields": [
{
"id": "field_abc123",
"value": "PROJ-2024-001"
},
{
"id": "field_def456",
"value": "CC-Operations"
}
]
}
]'
NoteSee Creating Shifts for full details on shift creation.
Getting Shifts with Custom Fields
Custom fields are automatically included in shift responses:
curl --request GET \
--url 'https://api.connecteam.com/scheduler/v1/schedulers/9454799/shifts/6784dacb3c07733b0a849f49' \
--header 'X-API-KEY: YOUR_API_KEY'Response:
{
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"data": {
"id": "6784dacb3c07733b0a849f49",
"title": "Project Shift",
"startTime": 1736924400,
"endTime": 1736953200,
"customFields": [
{
"id": "field_abc123",
"title": "Project Code",
"value": "PROJ-2024-001"
},
{
"id": "field_def456",
"title": "Cost Center",
"value": "CC-Operations"
}
]
}
}
NoteSee Getting Shifts for full query and filtering options.
Updating Custom Field Values
Update custom field values on existing shifts:
curl --request PUT \
--url 'https://api.connecteam.com/scheduler/v1/schedulers/9454799/shifts' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: YOUR_API_KEY' \
--data '[
{
"shiftId": "6784dacb3c07733b0a849f49",
"customFields": [
{
"id": "field_abc123",
"value": "PROJ-2024-002"
}
]
}
]'
Partial UpdatesYou only need to include the fields you want to change. Other custom field values remain unchanged.
NoteSee Updating Shifts for full update capabilities.
Custom Field Types
The following field types are supported (configured in UI):
| Type | Description | Value Format |
|---|---|---|
| Text | Single-line text input | String |
| Number | Numeric input | Number or string |
| Dropdown | Single selection from options | Option ID (string) |
| Multi-select | Multiple selections | Array of option IDs |
| Date | Date picker | ISO 8601 date string |
| Checkbox | Boolean toggle | Boolean |
Best Practices
1. Retrieve Definitions First
Always fetch custom field definitions before setting values:
// 1. Get available custom fields
const fields = await getCustomFields(schedulerId);
// 2. Find the field you need
const projectCodeField = fields.find(f => f.title === 'Project Code');
// 3. Set the value
const shift = {
title: 'Morning Shift',
startTime: 1736924400,
endTime: 1736953200,
customFields: [
{ id: projectCodeField.id, value: 'PROJ-001' }
]
};2. Handle Required Fields
Respect the required flag when creating shifts:
const requiredFields = fields.filter(f => f.required);
// Ensure all required fields have values
const customFields = requiredFields.map(field => ({
id: field.id,
value: getValueForField(field)
}));3. Validate Dropdown Options
For dropdown fields, ensure values match available options:
const costCenterField = fields.find(f => f.title === 'Cost Center');
const validOption = costCenterField.options.find(opt => opt.label === 'Sales');
customFields.push({
id: costCenterField.id,
value: validOption.id // Use option ID, not label
});4. Batch Operations
When creating multiple shifts with the same custom fields:
curl --request POST \
--url 'https://api.connecteam.com/scheduler/v1/schedulers/9454799/shifts' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: YOUR_API_KEY' \
--data '[
{
"startTime": 1736924400,
"endTime": 1736953200,
"title": "Shift 1",
"assignedUserIds": [9170357],
"customFields": [{"id": "field_abc123", "value": "PROJ-001"}]
},
{
"startTime": 1736953200,
"endTime": 1736982000,
"title": "Shift 2",
"assignedUserIds": [9170358],
"customFields": [{"id": "field_abc123", "value": "PROJ-001"}]
}
]'Common Use Cases
Project Tracking
Track which project each shift belongs to:
{
"customFields": [
{"id": "field_project", "value": "PROJ-2024-001"},
{"id": "field_phase", "value": "Construction"}
]
}Cost Center Allocation
Assign shifts to specific cost centers for accounting:
{
"customFields": [
{"id": "field_cost_center", "value": "CC-Operations"},
{"id": "field_budget_code", "value": "BG-2024-Q1"}
]
}Client Assignment
Track which client a shift is for:
{
"customFields": [
{"id": "field_client", "value": "Acme Corp"},
{"id": "field_site", "value": "Downtown Office"}
]
}Equipment Tracking
Record equipment needed for shifts:
{
"customFields": [
{"id": "field_vehicle", "value": "VAN-042"},
{"id": "field_tools", "value": ["tool_drill", "tool_saw"]}
]
}Error Handling
Invalid Field ID
{
"detail": "Custom field with id 'invalid_field' does not exist"
}Solution: Fetch current field definitions and use valid IDs.
Missing Required Field
{
"detail": "Required custom field 'Cost Center' is missing"
}Solution: Include all fields marked as required: true.
Invalid Dropdown Value
{
"detail": "Invalid option 'invalid_opt' for field 'Department'"
}Solution: Use option IDs from the field definition.
Related Pages
- Getting Shifts - Query shifts with custom fields
- Creating Shifts - Create shifts with custom field values
- Updating Shifts - Update custom field values
- Shifts Overview - Complete guide to shifts
Updated 7 days ago
