---
title: "Create a new service"
method: POST
path: "/api/v1/services"
tags: ["Services"]
---

# Create a new service

`POST /api/v1/services`

Creates a service with optional bindings to ip_addresses or ports.
The `id`, `created_at`, `updated_at`, and `source` fields are generated server-side.
Bindings are specified without `service_id` or `network_id` - these are assigned automatically.

### Binding Validation Rules

- **Cross-host validation**: All bindings must reference ports/interfaces that belong to the
  service's host. Bindings referencing entities from other hosts will be rejected.
- **Deduplication**: Duplicate bindings in the same request are automatically deduplicated.
- **All-interfaces precedence**: If a port binding with `ip_address_id: null` (all ip_addresses)
  is included, any specific-interface bindings for the same port are automatically removed.
- **Conflict detection**: Interface bindings conflict with port bindings on the same interface.
  A port binding on all ip_addresses conflicts with any interface binding.

## Request body

- CreateServiceRequest — Request type for creating a service. Server assigns `id`, `created_at`, `updated_at`, and `source`. Server also assigns `service_id` and `network_id` to all bindings.
  - `bindings` CreateBindingInput[] — Bindings to create with the service. `service_id` and `network_id` are assigned by the server.
    - union — Input for creating a binding with a service. `service_id` and `network_id` are assigned by the server after the service is created.
      - object — Bind to an interface (service listens on all ports on this ip_address)
        - `ip_address_id` string, uuid, required
        - `type` 'IPAddress', required
      - object — Bind to a port (optionally on a specific ip_address)
        - `ip_address_id` string, uuid, nullable
        - `port_id` string, uuid, required
        - `type` 'Port', required
  - `host_id` string, uuid, required
  - `name` string, required
  - `network_id` string, uuid, required
  - `service_definition` string, required
  - `tags` string[], required
  - `virtualization` ServiceVirtualization
    - `details` DockerVirtualization, required
      - `compose_project` string, nullable
      - `container_id` string, nullable
      - `container_name` string, nullable
      - `service_id` string, uuid, required
    - `type` 'Docker', required

## Response `200`

Service created successfully

- ApiResponseService
  - `data` object
    - `bindings` Binding[], required
      - union
        - object — Association between a service and a port / interface that the service is listening on
          - `ip_address_id` string, uuid, required
          - `type` 'IPAddress', required
          - `network_id` string, uuid, required
          - `service_id` string, uuid, required
          - `created_at` string, date-time, required
          - `id` string, uuid, required
          - `updated_at` string, date-time, required
        - object — Association between a service and a port / interface that the service is listening on
          - `ip_address_id` string, uuid, nullable, required — The IP address this port binding applies to. If `null`, the binding applies to all IP addresses on the host (and supersedes specific-IP-address bindings for this port).
          - `port_id` string, uuid, required
          - `type` 'Port', required
          - `network_id` string, uuid, required
          - `service_id` string, uuid, required
          - `created_at` string, date-time, required
          - `id` string, uuid, required
          - `updated_at` string, date-time, required
    - `host_id` string, uuid, required
    - `name` string, required
    - `network_id` string, uuid, required
    - `position` integer, required — Position of this service in the host's service list (for ordering)
    - `service_definition` string, required
    - `source` union, required
      - object
        - `type` 'Manual', required
      - object
        - `type` 'System', required
      - object
        - `metadata` DiscoveryMetadata[], required
          - union
            - object
              - …
            - object
              - …
            - object
              - …
            - 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
              - …
        - `metadata` DiscoveryMetadata[], required
          - union
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
        - `type` 'DiscoveryWithMatch', required
      - object
        - `type` 'Unknown', required
    - `tags` string[], required
    - `virtualization` ServiceVirtualization
      - `details` DockerVirtualization, required
        - `compose_project` string, nullable
        - `container_id` string, nullable
        - `container_name` string, nullable
        - `service_id` string, uuid, required
      - `type` 'Docker', required
    - `created_at` string, date-time, required
    - `id` string, uuid, required
    - `updated_at` string, date-time, required
  - `error` string, nullable
  - `meta` ApiMeta, required — API metadata included in all responses
    - `api_version` integer, required — API version (integer, increments on breaking changes)
    - `server_version` string, required — Server version (semver)
  - `success` boolean, required

## Other responses

- `400` — Validation error: host network mismatch, cross-host binding, or binding conflict

## Changes

- **2026-04-20** `f04499e2280f` — 1 breaking, 12 warning, 3 info
  - removed `subschema #2: Podman` from the `virtualization/oneOf[subschema #2: ServiceVirtualization]/` request property `oneOf` list
  - removed the optional property `data/allOf[#/components/schemas/ServiceBase]/bindings/items/allOf[subschema #2]/first_discovery_id` from the response with the `200` status
  - removed the optional property `data/allOf[#/components/schemas/ServiceBase]/bindings/items/allOf[subschema #2]/last_discovery_id` from the response with the `200` status
  - removed the optional property `data/allOf[#/components/schemas/ServiceBase]/bindings/items/allOf[subschema #2]/last_seen_at` from the response with the `200` status
  - …12 more

[Change history](https://skmtc.dev/scanopy/apis/scanopy-api/changes/api/v1/services/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/f04499e2280f/schema)
