# Create a new shift for a factory (/docs/api-reference/shifts/ShiftsController_createShift)

`POST /api/factories/{factoryId}/shifts`

Base URL: https://api.xentr.ai

Authentication: bearer token (`Authorization: Bearer <token>`).

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `factoryId` | path | yes | string | Factory ID |

## Request body

Required.

Content type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Shift name.",
      "example": "Morning"
    },
    "startTime": {
      "type": "string",
      "description": "Shift start time (HH:MM, 24h, factory-local).",
      "example": "07:00"
    },
    "endTime": {
      "type": "string",
      "description": "Shift end time (HH:MM, 24h, factory-local).",
      "example": "15:00"
    },
    "daysOfWeek": {
      "description": "Days of week this shift runs. 0=Sunday..6=Saturday.",
      "example": [
        1,
        2,
        3,
        4,
        5
      ],
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "isActive": {
      "type": "boolean",
      "description": "Whether this shift is active.",
      "example": true
    }
  },
  "required": [
    "name",
    "startTime",
    "endTime",
    "daysOfWeek"
  ]
}
```

## Responses

### 201: Created shift