> ## 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.

# Submit timesheets

> Submit all timesheets for an owner up to the given period, or to the last submittable timesheet.

The response contains all affected timesheets, with a feedback about each item's status, subsequent to the submission action :
* `success` when the timesheet is submitted successfully.
* `noAction` if the timesheet has already been submitted.
* `error` in case of an error.

Timesheets are created and their status are set to `submitted`. In some cases, timesheets may then be automatically `approved`, depending on the approval workflow settings.

Once submitted, all timeentries on the period for that user can no longer be modified. In order to be able to modify them, the timesheet must first be rejected through `cancel`, `deny` or `invalidate` operations (depends on the current timesheet status).

If you have set up account transfer authorizations in Lucca Timesheet, and need to adjust them before submitting timesheets, only the timesheet containing itself the `startsAt` date you set will be associated with the `Transfer` provided  (i.e. the last timesheet).

If you need to handle account transfer authorizations, we strongly suggest to do as many requests as there are timesheets to submit for a given owner, in chronological order, so that you can provide each timesheet its corresponding Transfer.

Please see [this guide](../docs/Use-cases/Timmi%20Timesheet/Mass-submit-timesheets.md) on how to submit Timesheets the right way.



## OpenAPI

````yaml /openapi-specs/timmi-timesheet.yaml post /timmi-timesheet/api/timesheets/submit
openapi: 3.1.0
info:
  title: Lucca Timesheet API (not v3)
  version: '1.0'
  description: The latest documentation for Lucca Timesheet 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.**


          **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: TimeEntries
    description: TimeEntries are the actual working hours observed by a user.
  - name: Workflow
    description: All actions regarding the approval process of timesheets.
paths:
  /timmi-timesheet/api/timesheets/submit:
    parameters:
      - $ref: '#/components/parameters/Authorization'
    post:
      tags:
        - Workflow
      summary: Submit timesheets
      description: >-
        Submit all timesheets for an owner up to the given period, or to the
        last submittable timesheet.


        The response contains all affected timesheets, with a feedback about
        each item's status, subsequent to the submission action :

        * `success` when the timesheet is submitted successfully.

        * `noAction` if the timesheet has already been submitted.

        * `error` in case of an error.


        Timesheets are created and their status are set to `submitted`. In some
        cases, timesheets may then be automatically `approved`, depending on the
        approval workflow settings.


        Once submitted, all timeentries on the period for that user can no
        longer be modified. In order to be able to modify them, the timesheet
        must first be rejected through `cancel`, `deny` or `invalidate`
        operations (depends on the current timesheet status).


        If you have set up account transfer authorizations in Lucca Timesheet,
        and need to adjust them before submitting timesheets, only the timesheet
        containing itself the `startsAt` date you set will be associated with
        the `Transfer` provided  (i.e. the last timesheet).


        If you need to handle account transfer authorizations, we strongly
        suggest to do as many requests as there are timesheets to submit for a
        given owner, in chronological order, so that you can provide each
        timesheet its corresponding Transfer.


        Please see [this
        guide](../docs/Use-cases/Timmi%20Timesheet/Mass-submit-timesheets.md) on
        how to submit Timesheets the right way.
      operationId: post-timmi-timesheet-api-timesheets-submit
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                ownerId:
                  type: integer
                  description: Reference to the owner of submittable timesheets.
                startsAt:
                  type: string
                  example: '2024-05-27T00:00:00'
                  format: date-time
                  description: First day of the last timesheet to submit.
                endsAt:
                  type: string
                  format: date-time
                  example: '2024-07-01T00:00:00'
                  description: Last day of the last timesheet to submit. Optional.
                transfers:
                  type: array
                  description: Array of suggested transfer from one account to another.
                  items:
                    $ref: '#/components/schemas/Transfer.V4'
              required:
                - ownerId
                - startsAt
            examples:
              Example 1:
                value:
                  ownerId: 90
                  startsAt: '2024-05-06T00:00:00'
                  endsAt: '2024-05-13T00:00:00'
                  transfers: []
        description: ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkflowItem'
              examples: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
              examples: {}
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
              examples: {}
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:
    Transfer.V4:
      title: Transfer v4
      type: object
      description: >-
        Define the amount to be transferred from the debited account to the
        credited account of referenced transferAuthorization.


        Two Timesheet accounts can be linked with a transfer authorization,
        allowing upon timesheet submission or approval workflow steps to adjust
        a certain duration amount from the to-be-debited account to the
        to-be-credited account.


        Such transfer authorization must be setup at the statute level. 
      properties:
        transferAuthorizationId:
          type: integer
          minimum: 1
          description: Unique identifier of the transfer authorization.
        amount:
          $ref: '#/components/schemas/Duration'
          description: >-
            Duration to be transferred from the debited account to the credited
            account.
        comment:
          type: string
          description: >-
            A comment to add business context to the transfer action. Visible on
            the Lucca Timesheet user interface.
    WorkflowItem:
      title: WorkflowItem
      type: object
      description: >-
        A WorkflowItem is an individual workflow action performed by a user.


        The expectedNextActor object is a User. [See API
        reference.](reference/Directory-v3.yaml/components/schemas/User)
      properties:
        id:
          type: integer
          description: Unique id of the WorkflowItem.
        exceptionMessage:
          type: string
          description: Any human readable error message.
        startsOn:
          type: string
          pattern: yyyy-MM-dd
          format: date
          description: >-
            The Timesheet the WorkflowItem is related on starting date
            (included).
        endsOn:
          type: string
          format: date
          pattern: yyyy-MM-dd
          description: The Timesheet the WorkflowItem is related on ending date (excluded).
        expectedNextActor:
          type: object
          description: A Directory 'User'. See API reference for up-to-date attributes.
        status:
          type: string
          description: >-
            - "success" for a succesfull workflow operation.

            - "error" if any error was met, and therefore an excetion message is
            set.

            - "noAction" if the workflow operation was not performed. 
    Duration:
      title: Duration
      type: object
      properties:
        iso:
          type: string
          format: duration
          description: ISO-8601 formatted duration.
          example: PT7H30M
        unit:
          type: string
          enum:
            - day
            - hour
      description: ''

````