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

# Update Token Payroll State

> Sets a token payroll's state under a dispatch lock, refusing to reopen a COMPLETED payroll.

Not available to API keys yet. It will need `payroll:write`.

## OpenAPI

````yaml api-reference/openapi.json POST /stablecoin-payroll/update-token-payroll-state
openapi: 3.1.0
info:
  title: Toku API
  version: 1.0.0
servers:
  - url: https://api.toku.com
security:
  - bearerAuth: []
paths:
  /stablecoin-payroll/update-token-payroll-state:
    post:
      operationId: updateTokenPayrollState
      summary: Update Token Payroll State
      description: >-
        Sets a token payroll's state under a dispatch lock, refusing to reopen a
        COMPLETED payroll.


        Not available to API keys yet. It will need `payroll:write`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTokenPayrollStateRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateTokenPayrollStateResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not found
        '409':
          description: Conflict
        '429':
          description: Response 429
components:
  schemas:
    UpdateTokenPayrollStateRequest:
      type: object
      properties:
        tokenPayrollId:
          type: string
          minLength: 1
          maxLength: 200
        state:
          type: string
          enum:
            - DRAFT
            - PENDING
            - OVERDUE
            - LOCKED
            - IN_PROGRESS
            - APPROVED
            - COMPLETED
            - CANCELLED
      required:
        - tokenPayrollId
        - state
    UpdateTokenPayrollStateResponse:
      type: object
      properties:
        tokenPayroll:
          type: object
          properties:
            tokenPayrollID:
              type: string
            orgID:
              type: string
            payPeriodStart:
              type: string
            payPeriodEnd:
              type: string
            payDate:
              type: string
            externalPayrollID:
              type:
                - string
                - 'null'
            fiatCurrency:
              type: string
            payrollEntityId:
              type:
                - string
                - 'null'
            state:
              type: string
            type:
              type: string
            createdAt:
              type: string
            updatedAt:
              type: string
          required:
            - tokenPayrollID
            - orgID
            - payPeriodStart
            - payPeriodEnd
            - payDate
            - externalPayrollID
            - fiatCurrency
            - payrollEntityId
            - state
            - type
            - createdAt
            - updatedAt
      required:
        - tokenPayroll
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
````
