---
title: "创建主机"
method: POST
path: "/api/v1/cmdb/hostcreate"
tags: ["CMDB资产管理"]
---

# 创建主机

`POST /api/v1/cmdb/hostcreate`

创建主机

## Request body

- ModelCreateCmdbHostDto
  - `groupId` integer, required — 主机分组ID
  - `hostName` string, required — 主机名称(唯一标识)
  - `remark` string — 备注信息(可选)
  - `sshIp` string, required — SSH连接IP(公网或私网IP)
  - `sshKeyId` integer, required — SSH凭据ID(从ecsAuth表获取)
  - `sshName` string, required — SSH登录用户名
  - `sshPort` integer — SSH端口(默认22)

## Response `200`

OK

- ResultResult
  - `code` integer — 状态码
  - `data` unknown
  - `message` string — 提示信息

---

[API](https://skmtc.net/opsre/apis/devops.md) · [All operations](https://skmtc.net/opsre/apis/devops/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/opsre/devops/revisions/25cac8835c4c/schema)
