---
title: "Auto-fill shifts (Asynchronous)"
method: POST
path: "/management/v2/shifts:autofill"
tags: ["Shifts"]
---

# Auto-fill shifts (Asynchronous)

`POST /management/v2/shifts:autofill`

## Request

- Base URL: `https://your-subdomain.deputy.deputy.com/api`
- URL: `https://your-subdomain.deputy.deputy.com/api/management/v2/shifts:autofill`
- Auth: API key in header `OAuth`

Automatically assigns employees to open shifts using genetic algorithm optimization. Optimizes for cost, workload equality, coverage, and full-time hours. Returns immediately with operation ID for tracking. Use /operations/v2/operations/{id} to poll for completion.

## Request body

- ScheduleShiftAutofillRequestData
  - `shiftIds` integer[]
  - `employeeIds` integer[]

## Response `200`

A successful response.

- ScheduleShiftAutofillResponse
  - `success` boolean
  - `metadata` ScheduleShiftAutofillResponseMetadata
    - `operation` ScheduleShiftOperation: Operation tracking information for asynchronous APIs.
      - `operationId` string: Unique identifier for the operation. Use this to poll /operations/v2/operations/{id} for status updates.
      - `locks` OperationLock[]: Virtual Locks held by this operation that prevent conflicting operations.
        - `kind` string
        - `ids` object

---

[API](https://skmtc.dev/deputy/apis/deputy-v2-api.md) - [All operations](https://skmtc.dev/deputy/apis/deputy-v2-api/llms.txt) - [OpenAPI document](https://skmtc.dev/deputy/apis/deputy-v2-api/revisions/78f0278f4608?raw)
