---
title: "Request work from server"
method: POST
path: "/api/daemons/{id}/request-work"
tags: ["Daemons", "internal"]
---

# Request work from server

`POST /api/daemons/{id}/request-work`

Internal endpoint for daemons to poll for pending discovery sessions.
Also updates heartbeat and returns any pending cancellation requests.
Returns tuple of (next_session, should_cancel).

## Path parameters

- `id` string, uuid, required

## Request body

- DaemonStatus — Lightweight daemon status for polling responses.
  - `capabilities` DaemonCapabilities — Daemon capabilities
    - `has_docker_socket` boolean
    - `interfaced_subnet_ids` string[], required
  - `has_docker_socket` boolean — Whether the daemon has access to a Docker socket.
  - `interfaced_subnets` Subnet[] — Subnets detected from daemon's network ip_addresses. Server resolves these via SubnetService::create (create-or-match by CIDR) to get real IDs. v0.15.0+ daemons populate this; pre-v0.15.0 daemons leave it empty.
    - `cidr` string, required
    - `description` string, nullable
    - `name` string, required
    - `network_id` string, uuid, required
    - `source` union, required
      - object
        - `type` 'Manual', required
      - object
        - `type` 'System', required
      - object
        - `type` 'Discovery', required
      - object
        - `details` MatchDetails, required
          - `confidence` 'NotApplicable' | 'Low' | 'Medium' | 'High' | 'Certain', required
          - `reason` union, required — Match reason - either a simple reason string or a container with nested reasons
            - object
              - …
            - object
              - …
        - `type` 'DiscoveryWithMatch', required
      - object
        - `type` 'Unknown', required
    - `subnet_type` 'Internet' | 'Remote' | 'Gateway' | 'VpnTunnel' | 'Dmz' | 'Lan' | 'WiFi' | 'IoT' | 'Guest' | 'DockerBridge' | 'MacVlan' | 'IpVlan' | 'Management' | 'Storage' | 'Loopback' | 'Unknown', required
    - `tags` string[], required
    - `virtualization` SubnetVirtualization — Docker bridge network — host-scoped, same CIDR on different hosts are distinct subnets.
      - `service_id` string, uuid, required — The Docker daemon service that owns this bridge network. Different Docker daemons on different hosts = distinct bridge subnets.
      - `type` 'Docker', required
    - `created_at` string, date-time, required
    - `first_discovery_id` string, uuid, nullable
    - `id` string, uuid, required
    - `last_discovery_id` string, uuid, nullable
    - `last_seen_at` string, date-time
    - `lineage_id` string, uuid, nullable
    - `updated_at` string, date-time, required
    - `valid_from` string, date-time
    - `valid_to` string, date-time, nullable
  - `mode` 'server_poll' | 'daemon_poll', required — Daemon operating mode that determines the communication pattern. - **DaemonPoll** (formerly "Pull"): Daemon makes outbound connections to the server. The daemon registers itself and polls for work. Best for daemons behind NAT/firewall. - **ServerPoll** (formerly "Push"): Server makes connections to the daemon. Server polls daemon for status and discovery results. Best for DMZ deployments where daemon cannot make outbound connections.
  - `name` string, required
  - `ready_for_work` boolean — Whether the daemon can accept a new discovery session. Both DaemonPoll and ServerPoll use this to avoid dispatching work to a busy daemon.
  - `url` string, nullable — URL is not used by server - kept for backwards compat. Server never updates daemon URL from status (URL is set during provisioning).
  - `version` string, nullable — Daemon software version (semver format)

## Response `200`

Work request processed - returns (Option<Value>, bool)

## Other responses

- `404` — Daemon not found

## Changes

- **2026-05-03** `d38c20597ec1` — 2 warning
  - removed the request property `interfaced_subnets/items/allOf[#/components/schemas/SubnetBase]/source/oneOf[subschema #3: Discovery]/metadata`
  - removed the request property `interfaced_subnets/items/allOf[#/components/schemas/SubnetBase]/source/oneOf[subschema #4: DiscoveryWithMatch]/metadata`
- **2026-04-20** `f04499e2280f` — 4 breaking, 2 info
  - added the new required request property `interfaced_subnets/items/allOf[#/components/schemas/SubnetBase]/source/oneOf[subschema #3: Discovery]/metadata`
  - added the new required request property `interfaced_subnets/items/allOf[#/components/schemas/SubnetBase]/source/oneOf[subschema #4: DiscoveryWithMatch]/metadata`
  - removed the enum value `PodmanBridge` of the request property `interfaced_subnets/items/allOf[#/components/schemas/SubnetBase]/subnet_type`
  - removed `subschema #2: Podman` from the `interfaced_subnets/items/allOf[#/components/schemas/SubnetBase]/virtualization/oneOf[#/components/schemas/SubnetVirtualization]/` request property `oneOf` list
  - …2 more

[Change history](https://skmtc.dev/scanopy/apis/scanopy-api/changes/api/daemons/:id/request-work/post.md)

---

[API](https://skmtc.dev/scanopy/apis/scanopy-api.md) · [All operations](https://skmtc.dev/scanopy/apis/scanopy-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/scanopy/scanopy-api/revisions/87fbc9fdb32c/schema)
