> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建流

> 预先声明一个流。

```http theme={null}
POST /api/v1/streams
```

流也会在首次接入时隐式创建；用此端点可预先声明并指定 schema 或保留策略。

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST http://localhost:5080/api/v1/streams \
    -H "authorization: Bearer $MS_JWT" \
    -H 'content-type: application/json' \
    -d '{
      "name": "app",
      "stream_type": "logs",
      "fields": [
        {
          "name": "trace_id",
          "data_type": "utf8",
          "nullable": true,
          "indexed": true,
          "index_type": "exact",
          "encrypted": false
        }
      ],
      "retention_days": 30
    }'
  ```
</RequestExample>

<Note>
  `profiles` 和 `extend` 数据流不能作为流水线目标。扩展表数据通过 `/api/v1/extend_tables` API 管理。
</Note>

名称可包含字母、数字、`_`、`-` 和 `.`。字段类型包括 `bool`、`int64`、`float64`、`utf8`、
`timestamp` 和 `json`。创建数据流需要 `streams.create`。
