---
title: "Create a new port"
method: POST
path: "/api/v1/ports"
tags: ["Ports"]
---

# Create a new port

`POST /api/v1/ports`

## Request body

- Port — Port entity with custom serialization that flattens PortType fields.
  - `number` integer, required
  - `protocol` 'Udp' | 'Tcp', required
  - `type` string — Auto-derived from number+protocol; optional on create
  - `host_id` string, uuid, required
  - `network_id` string, uuid, required
  - `created_at` string, date-time, required
  - `id` string, uuid, required
  - `updated_at` string, date-time, required

## Response `200`

Port created successfully

- ApiResponsePort
  - `data` object — Port entity with custom serialization that flattens PortType fields.
    - `number` integer, required
    - `protocol` 'Udp' | 'Tcp', required
    - `type` string — Auto-derived from number+protocol; optional on create
    - `host_id` string, uuid, required
    - `network_id` string, uuid, 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` — Network mismatch or duplicate port

## Changes

- **2026-04-20** `f04499e2280f` — 6 warning
  - removed the optional property `data/allOf[subschema #2]/first_discovery_id` from the response with the `200` status
  - removed the optional property `data/allOf[subschema #2]/last_discovery_id` from the response with the `200` status
  - removed the optional property `data/allOf[subschema #2]/last_seen_at` from the response with the `200` status
  - removed the optional property `data/allOf[subschema #2]/lineage_id` from the response with the `200` status
  - …2 more

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