> ## Documentation Index
> Fetch the complete documentation index at: https://developers.lucca.fr/llms.txt
> Use this file to discover all available pages before exploring further.

# Assign a Working Time Arrangement to an Employee

> <Warning>
You may not benefit from this feature. Working-time-arrangements are the
replacement for the workcycles. If this feature has not been deployed on
your environment, please contact our support.
</Warning>

Assigns a new working time arrangement to a single employee, effective from the specified start date (assignmentStart).

This operation will:
1. End the current assignment with an end date set to the eve of `assignmentStart`.
2. Create a work-contract amendment for the employee at `assignmentStart`, that gives them the new working time arrangement.



## OpenAPI

````yaml /openapi-specs/schedule.yaml post /schedule/api/employee-assignments
openapi: 3.1.0
info:
  title: Time Settings API
  version: '1.0'
  description: |
    Welcome on the documentation for the Time Settings API.
  contact:
    name: API Support
    url: https://support.lucca.fr
    email: contact@luccasoftware.com
  license:
    name: Unlicensed
    url: https://www.luccasoftware.com
servers:
  - url: https://{host}
    description: Your Lucca account URL.
    variables:
      host:
        default: example.ilucca.net
        description: >-
          The URL of your dedicated Lucca account: `{account}.{env}.{region}`.


          Account reflects your company name. Env indicates the environment.
          Region depends on your server location.


          **Please, use your test or sandbox environments (and not your
          production env.) for testing purposes.**


          Environments:

          - `ilucca`: production environment for customers.

          - `ilucca-test`: test environment for customers.

          - `ilucca-demo`: demo environment for prospects.


          Regions:

          - `.ch` for Swiss located accounts.

          - `.net` for the others.


          Regarding sandboxes, the pattern differs:
          `https://{account}-{sandboxName}.sandbox.{server}.luccasoftware.com`,
          where:

          - `{sandboxName}` is automatically generated upon creation.

          - `{server}` may be "eu1", "eu2" or "ch1".
security: []
tags:
  - name: UserDates
    description: Aggregates work schedule events.
  - name: WorkCycleExceptions
    description: Override an employee's theoretical working hours.
  - name: Working Time Arrangements
    description: Employees recurring working hours.
  - name: Collective Schedules
    description: Describes the working hours pattern of a working-time-arrangement.
  - name: employee-assignments
    description: Assignations of employees to working time arrangements.
paths:
  /schedule/api/employee-assignments:
    parameters:
      - $ref: '#/components/parameters/Authorization'
    post:
      tags:
        - employee-assignments
      summary: Assign a Working Time Arrangement to an Employee
      description: >-
        <Warning>

        You may not benefit from this feature. Working-time-arrangements are the

        replacement for the workcycles. If this feature has not been deployed on

        your environment, please contact our support.

        </Warning>


        Assigns a new working time arrangement to a single employee, effective
        from the specified start date (assignmentStart).


        This operation will:

        1. End the current assignment with an end date set to the eve of
        `assignmentStart`.

        2. Create a work-contract amendment for the employee at
        `assignmentStart`, that gives them the new working time arrangement.
      operationId: post-assign-working-time-arrangements
      requestBody:
        content:
          application/json:
            schema:
              title: EmployeeAssignmentCandidate
              allOf:
                - $ref: '#/components/schemas/EmployeeAssignmentCandidate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WtaEmployeeAssignment'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
components:
  parameters:
    Authorization:
      name: Authorization
      required: true
      description: 'API key. Value must be formatted like so: `lucca application={api_key}`.'
      in: header
      schema:
        type: string
  schemas:
    EmployeeAssignmentCandidate:
      title: EmployeeAssignmentCandidate
      type: object
      required:
        - workingTimeArrangementId
        - startsOn
        - employeeId
      properties:
        employeeId:
          type: integer
          format: int32
          minimum: 0
        workingTimeArrangementId:
          type: integer
          format: int32
          minimum: 0
        startsOn:
          type: string
          format: date
    WtaEmployeeAssignment:
      title: WtaEmployeeAssignment
      type: object
      required:
        - employee
        - startsOn
        - workContractId
      properties:
        id:
          type: integer
          format: int32
          minimum: 0
        workContractId:
          type: integer
          format: int32
          minimum: 0
        workingTimeArrangement:
          title: WorkingTimeArrangementLite
          allOf:
            - $ref: '#/components/schemas/WorkingTimeArrangementLite'
        startsOn:
          type: string
          format: date
        endsOn:
          type:
            - 'null'
            - string
          format: date
        employee:
          title: WtaEmpoyee
          allOf:
            - $ref: '#/components/schemas/WtaEmployee'
    ProblemDetail:
      title: ProblemDetail
      type: object
      properties:
        type:
          type: string
          format: uri
          description: Type of problem encountered.
        title:
          type: string
          description: Human-readable description of the type of problem encountered.
        detail:
          type: string
          description: Human-readable description of the problem encountered.
    WorkingTimeArrangementLite:
      title: WorkingTimeArrangementLite
      type: object
      required:
        - id
        - name
        - unit
      properties:
        id:
          type: integer
          format: int32
          minimum: 0
          readOnly: true
        name:
          type: string
        unit:
          $ref: '#/components/schemas/EventUnit'
    WtaEmployee:
      title: WtaEmployee
      type: object
      required:
        - department
        - displayName
        - employeeNumber
        - establishmentId
        - establishmentName
        - firstName
        - id
        - jobQualificationName
        - lastName
      properties:
        id:
          type: integer
          format: int32
          minimum: 0
        firstName:
          type: string
        lastName:
          type: string
        displayName:
          type: string
          readOnly: true
        jobQualificationName:
          type: string
        employeeNumber:
          type: string
        establishmentId:
          type: integer
          format: int32
          minimum: 0
        establishmentName:
          type: string
        department:
          $ref: '#/components/schemas/WtaDepartment'
    EventUnit:
      title: Event Unit (enum)
      x-internal: true
      x-tags:
        - Core
      type: string
      enum:
        - day
        - hour
        - time
      description: |-
        An event can be set in:
        - Day: "I worked for a half day last Monday".
        - Hour: "I worked for 2 hours last Monday".
        - Time: "I worked between 10:00 AM and 12:00 AM last Monday".
    WtaDepartment:
      title: Department
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int32
          minimum: 0
        name:
          type: string

````