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

# Employee Sync

> Syncs employees from the org HRIS integration; large sets or forceAsync create a sync-history row and enqueue a Trigger.dev job.

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

## OpenAPI

````yaml api-reference/openapi.json POST /stablecoin-payroll/employee-sync
openapi: 3.1.0
info:
  title: Toku API
  version: 1.0.0
servers:
  - url: https://api.toku.com
security:
  - bearerAuth: []
paths:
  /stablecoin-payroll/employee-sync:
    post:
      operationId: employeeSync
      summary: Employee Sync
      description: >-
        Syncs employees from the org HRIS integration; large sets or forceAsync
        create a sync-history row and enqueue a Trigger.dev job.


        Not available to API keys yet. It will need `integrations:write`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmployeeSyncRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmployeeSyncResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not found
        '409':
          description: Conflict
        '429':
          description: Response 429
components:
  schemas:
    EmployeeSyncRequest:
      type: object
      properties:
        orgID:
          type: string
        filters:
          oneOf:
            - $ref: '#/components/schemas/EmployeeSyncQueryBuilderFilters'
            - $ref: '#/components/schemas/EmployeeSyncLegacyFilters'
          description: >-
            NOTE(ck): a recursive z.lazy() schema has no contract form; TGA
            still checks it
        filterConfigId:
          type: string
        saveAsDefault:
          type: boolean
        forceAsync:
          type: boolean
    EmployeeSyncQueryBuilderFilters:
      type: object
      properties:
        version:
          const: '2.0'
        rootGroup: {}
      required:
        - version
        - rootGroup
    EmployeeSyncLegacyFilters:
      type: object
      properties:
        email:
          type: string
        givenName:
          type: string
        familyName:
          type: string
        externalEmployeeID:
          type: array
          items:
            type: string
        positionID:
          type: string
        country:
          type: array
          items:
            type: string
        employmentType:
          type: array
          items:
            type: string
        subEmploymentType:
          type: string
        remarks:
          type: string
        payrollEntity:
          type: string
        payrollGroup:
          type: string
        baseSalaryGreaterThan:
          type: number
        baseSalaryLessThan:
          type: number
        baseSalaryCurrency:
          type: array
          items:
            type: string
        department:
          type: string
        address:
          type: string
        excludeTerminated:
          type: boolean
        isActive:
          type: boolean
    EmployeeSyncResponse:
      type: object
      properties:
        pendingCredentialRequests:
          type: array
          items:
            type: object
            properties:
              requestID:
                type:
                  - string
                  - 'null'
              userID:
                type: string
              roleInOrgID:
                type: string
              destination:
                type: string
              status:
                type: string
                enum:
                  - REQUESTED
                  - ADMIN_REQUEST_REQUIRED
              notificationFailed:
                type: boolean
            required:
              - requestID
              - userID
              - roleInOrgID
              - destination
              - status
        pendingCredentialCount:
          type: number
        success:
          type: boolean
        recordsProcessed:
          type: number
        recordsCreated:
          type: number
        recordsUpdated:
          type: number
        errors:
          type: array
          items:
            type: string
        syncHistory:
          type: object
          properties:
            syncHistoryID:
              type: string
            orgID:
              type: string
          required:
            - syncHistoryID
            - orgID
        conflicts:
          type: array
          items:
            type: object
            properties:
              externalEmployeeID:
                type: string
              email:
                type: string
              givenName:
                type: string
              familyName:
                type: string
              department:
                type: string
              position:
                type: string
              integrationSource:
                type: string
            required:
              - externalEmployeeID
              - email
              - givenName
              - familyName
              - integrationSource
        requiresConflictResolution:
          type: boolean
        asyncJobQueued:
          type: boolean
        syncHistoryId:
          type: string
        message:
          type: string
      required:
        - success
        - recordsProcessed
        - recordsCreated
        - recordsUpdated
        - errors
        - syncHistory
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
````
