POST /api/v1/streams
streams.create.
Body
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | Letters, numbers, _, -, and .. The name _molesignal is reserved. |
stream_type | string | Yes | logs, metrics, traces, profiles, or extend. |
fields | array | No | Field definitions. See below. |
retention_days | integer | No | 1 through 3650. Omit it to use the platform default from Settings → Data retention. |
settings | object | No | Stream settings such as description and queryable. See Edit retention and settings. |
| Property | Type | Notes |
|---|---|---|
name | string | Field name. |
data_type | string | bool, int64, float64, utf8, timestamp, or json. |
nullable | boolean | Default true. |
indexed | boolean | Enables an index. |
index_type | string | none, exact, full_text, bloom, or skip. When indexed is true and index_type is omitted, text fields get full_text and other fields get skip. |
encrypted | boolean | Encrypts the field at rest. It cannot be changed later. See Streams. |
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
}'
{
"id": "3KE0ot1NtfCTJ3V3XxBNbqx9Y62",
"org_id": "<organization-id>",
"name": "app",
"stream_type": "logs",
"schema": {
"fields": [
{ "name": "trace_id", "data_type": "utf8", "nullable": true, "index_type": "exact",
"indexed": true, "encrypted": false, "exact": true }
]
},
"retention": { "days": 30 },
"effective_retention": { "days": 30 },
"settings": {
"description": null,
"index_rules": [],
"queryable": true,
"field_masking": []
},
"created_at_micros": 1790000000000000,
"updated_at_micros": 1790000000000000
}
| Status | Cause |
|---|---|
403 | The name is _molesignal, or the token lacks streams.create. |
409 | A stream with the same name and type already exists. |
422 | A body field is missing or invalid, for example an unknown data_type. The response is plain text. |