---
title: "Create new stream"
method: POST
path: "/api/{org_id}/streams/{stream_name}"
tags: ["Streams"]
---

# Create new stream

`POST /api/{org_id}/streams/{stream_name}`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/streams/{stream_name}`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/streams/:stream_name/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new stream with specified settings and schema definition. The stream will be used to store and organize data of the specified type

## Path parameters

- `org_id` string, required
- `stream_name` string, required

## Query parameters

- `type` string

## Request body

- object
  - `fields` StreamField[], required
    - `name` string, required
    - `type` string, required
  - `settings` StreamSettings, required
    - `approx_partition` boolean
    - `bloom_filter_fields` string[]
    - `cross_links` CrossLink[]
      - `fields` CrossLinkField[]: Show link only when at least one field matches the record. If empty, the link is always shown.
        - `alias` string, nullable: Populated by result_schema: the alias used in the query for this field.
        - `name` string, required
      - `name` string, required: Display name for the link
      - `url` string, required: URL template with {field_name} placeholders
    - `data_retention` integer
    - `defined_schema_fields` string[]
    - `distinct_value_fields` DistinctField[]
      - `added_ts` integer, required
      - `name` string, required
    - `enable_distinct_fields` boolean
    - `enable_log_patterns_extraction` boolean
    - `extended_retention_days` TimeRange[]
      - `end` integer, required: End timestamp in microseconds
      - `start` integer, required: Start timestamp in microseconds
    - `flatten_level` integer, nullable
    - `full_text_search_keys` string[]
    - `index_all_values` boolean
    - `index_fields` string[]
    - `index_fields_updated_at` object
    - `index_original_data` boolean
    - `index_updated_at` integer
    - `is_llm_stream` boolean
    - `max_query_range` integer
    - `partition_keys` StreamPartition[]
      - `disabled` boolean
      - `field` string, required
      - `types` union
        - 'value'
        - object
          - `hash` integer, required
        - 'prefix'
    - `partition_time_level` StreamPartitionTimeLevel: A stream's partition level per day; a day's level never changes once the day has begun.
      - `changes` PartitionTimeLevelChange[]
        - `level` 'unset' | 'hourly' | 'daily', required
        - `since` integer, required
      - `dynamic` boolean, nullable: The stream's own classifier switch; unset follows `ZO_DYNAMIC_PARTITION_STREAM_TYPES`.
    - `storage_type` 'normal' | 'compliance'
    - `store_original_data` boolean

## Response `200`

Success

- HttpResponse: HTTP response code 200 is success code 400 is error code 404 is not found code 500 is internal server error code 503 is service unavailable code >= 1000 is custom error code message is the message or error message
  - `code` integer, required
  - `error_detail` string, nullable
  - `hint` string, nullable: One-line guidance on how to fix the error (agent self-correction, D4).
  - `id` string, nullable
  - `message` string, required
  - `name` string, nullable
  - `suggestions` string[], nullable: Closest valid alternatives for a mistyped field/function name.
  - `trace_id` string, nullable
  - `warnings` string[], nullable: Problems with a request that succeeded anyway. Distinct from `hint`, which explains a failure: these accompany a 200, and the caller is entitled to have meant it.

## Other responses

- `400`: Failure
- `500`: Failure

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
