> ## Documentation Index
> Fetch the complete documentation index at: https://docs.partners.api.cobee.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Close Payroll Cycle

## Overview

<Tip>
  **Note**: This endpoint is available only in Sandbox environment. A payroll cycle can not be manually closed on production and this is an automatic process that occurs without human intervention.
</Tip>

This endpoint allows you to finalize the current payroll cycle and start a new one.

Once a payroll cycle is finalized, it cannot be modified. This is useful for ensuring that all employee benefits and expenses are accurately recorded and processed for the specified period.


## OpenAPI

````yaml POST /companies/{companyId}/payroll-cycles/{payrollCycleId}
openapi: 3.0.1
info:
  title: Partners API
  description: >-
    Partners API definition where you can check the documentation for the
    different available operations to integrate with the platform.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://pre-partners-api.cobee.io/api/v3
  - url: https://partners-api.cobee.io/api/v3
security:
  - bearerAuth: []
paths:
  /companies/{companyId}/payroll-cycles/{payrollCycleId}:
    post:
      summary: Close the current payroll cycle and open a new one.
      parameters:
        - name: companyId
          in: path
          required: true
          description: The unique identifier of the company
          schema:
            type: string
            format: uuid
          example: dfe4e8a9-ff19-4b3b-953a-2d64c6e88539
        - name: payrollCycleId
          in: path
          required: true
          description: The unique identifier of the payroll cycle
          schema:
            type: string
            format: uuid
          example: dfe4e8a9-ff19-4b3b-953a-2d64c6e88539
      responses:
        '200':
          description: Payroll Cycle successfully closed
          content:
            application/json:
              example:
                message: Payroll Cycle successfully closed
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: 'Invalid request: ''payrollCycleId'' field is required'
        '401':
          description: Unauthorised - Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: Unauthorised
        '404':
          description: Not Found - The payroll cycle ID was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: Payroll cycle not found
        '409':
          description: Payroll cycle already closed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: Payroll cycle already closed
        '500':
          description: Internal Server Error - Something went wrong on our end
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: 'Internal server error: Unable to process request'
components:
  schemas:
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
      example:
        message: 'Bad request: Invalid field value'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````