Skip to content
Start here

Create Stream

client.Pipelines.Streams.New(ctx, params) (*StreamNewResponse, error)
POST/accounts/{account_id}/pipelines/v1/streams

Create a new Stream.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Pipelines Write
ParametersExpand Collapse
params StreamNewParams
AccountID param.Field[string]

Path param: Specifies the public ID of the account.

Name param.Field[string]

Body param: Specifies the name of the Stream.

maxLength128
minLength1
Format param.Field[StreamNewParamsFormat]optional

Body param

type StreamNewParamsFormatJson struct{…}
Type StreamNewParamsFormatJsonType
DecimalEncoding StreamNewParamsFormatJsonDecimalEncodingoptional
One of the following:
const StreamNewParamsFormatJsonDecimalEncodingNumber StreamNewParamsFormatJsonDecimalEncoding = "number"
const StreamNewParamsFormatJsonDecimalEncodingString StreamNewParamsFormatJsonDecimalEncoding = "string"
const StreamNewParamsFormatJsonDecimalEncodingBytes StreamNewParamsFormatJsonDecimalEncoding = "bytes"
TimestampFormat StreamNewParamsFormatJsonTimestampFormatoptional
One of the following:
const StreamNewParamsFormatJsonTimestampFormatRfc3339 StreamNewParamsFormatJsonTimestampFormat = "rfc3339"
const StreamNewParamsFormatJsonTimestampFormatUnixMillis StreamNewParamsFormatJsonTimestampFormat = "unix_millis"
Unstructured booloptional
type StreamNewParamsFormatParquet struct{…}
Type StreamNewParamsFormatParquetType
Compression StreamNewParamsFormatParquetCompressionoptional
One of the following:
const StreamNewParamsFormatParquetCompressionUncompressed StreamNewParamsFormatParquetCompression = "uncompressed"
const StreamNewParamsFormatParquetCompressionSnappy StreamNewParamsFormatParquetCompression = "snappy"
const StreamNewParamsFormatParquetCompressionGzip StreamNewParamsFormatParquetCompression = "gzip"
const StreamNewParamsFormatParquetCompressionZstd StreamNewParamsFormatParquetCompression = "zstd"
const StreamNewParamsFormatParquetCompressionLz4 StreamNewParamsFormatParquetCompression = "lz4"
RowGroupBytes int64optional
formatint64
minimum0
HTTP param.Field[StreamNewParamsHTTP]optional

Body param

Authentication bool

Indicates that authentication is required for the HTTP endpoint.

Enabled bool

Indicates that the HTTP endpoint is enabled.

CORS StreamNewParamsHTTPCORSoptional

Specifies the CORS options for the HTTP endpoint.

Origins []stringoptional
Schema param.Field[StreamNewParamsSchema]optional

Body param

Fields []StreamNewParamsSchemaFieldoptional
One of the following:
type StreamNewParamsSchemaFieldsInt32 struct{…}
Type StreamNewParamsSchemaFieldsInt32Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsInt64 struct{…}
Type StreamNewParamsSchemaFieldsInt64Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsFloat32 struct{…}
Type StreamNewParamsSchemaFieldsFloat32Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsFloat64 struct{…}
Type StreamNewParamsSchemaFieldsFloat64Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsBool struct{…}
Type StreamNewParamsSchemaFieldsBoolType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsString struct{…}
Type StreamNewParamsSchemaFieldsStringType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsBinary struct{…}
Type StreamNewParamsSchemaFieldsBinaryType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsTimestamp struct{…}
Type StreamNewParamsSchemaFieldsTimestampType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
Unit StreamNewParamsSchemaFieldsTimestampUnitoptional
One of the following:
const StreamNewParamsSchemaFieldsTimestampUnitSecond StreamNewParamsSchemaFieldsTimestampUnit = "second"
const StreamNewParamsSchemaFieldsTimestampUnitMillisecond StreamNewParamsSchemaFieldsTimestampUnit = "millisecond"
const StreamNewParamsSchemaFieldsTimestampUnitMicrosecond StreamNewParamsSchemaFieldsTimestampUnit = "microsecond"
const StreamNewParamsSchemaFieldsTimestampUnitNanosecond StreamNewParamsSchemaFieldsTimestampUnit = "nanosecond"
type StreamNewParamsSchemaFieldsJson struct{…}
Type StreamNewParamsSchemaFieldsJsonType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewParamsSchemaFieldsStruct struct{…}
type StreamNewParamsSchemaFieldsList struct{…}
Format StreamNewParamsSchemaFormatoptional
One of the following:
type StreamNewParamsSchemaFormatJson struct{…}
Type StreamNewParamsSchemaFormatJsonType
DecimalEncoding StreamNewParamsSchemaFormatJsonDecimalEncodingoptional
One of the following:
const StreamNewParamsSchemaFormatJsonDecimalEncodingNumber StreamNewParamsSchemaFormatJsonDecimalEncoding = "number"
const StreamNewParamsSchemaFormatJsonDecimalEncodingString StreamNewParamsSchemaFormatJsonDecimalEncoding = "string"
const StreamNewParamsSchemaFormatJsonDecimalEncodingBytes StreamNewParamsSchemaFormatJsonDecimalEncoding = "bytes"
TimestampFormat StreamNewParamsSchemaFormatJsonTimestampFormatoptional
One of the following:
const StreamNewParamsSchemaFormatJsonTimestampFormatRfc3339 StreamNewParamsSchemaFormatJsonTimestampFormat = "rfc3339"
const StreamNewParamsSchemaFormatJsonTimestampFormatUnixMillis StreamNewParamsSchemaFormatJsonTimestampFormat = "unix_millis"
Unstructured booloptional
type StreamNewParamsSchemaFormatParquet struct{…}
Type StreamNewParamsSchemaFormatParquetType
Compression StreamNewParamsSchemaFormatParquetCompressionoptional
One of the following:
const StreamNewParamsSchemaFormatParquetCompressionUncompressed StreamNewParamsSchemaFormatParquetCompression = "uncompressed"
const StreamNewParamsSchemaFormatParquetCompressionSnappy StreamNewParamsSchemaFormatParquetCompression = "snappy"
const StreamNewParamsSchemaFormatParquetCompressionGzip StreamNewParamsSchemaFormatParquetCompression = "gzip"
const StreamNewParamsSchemaFormatParquetCompressionZstd StreamNewParamsSchemaFormatParquetCompression = "zstd"
const StreamNewParamsSchemaFormatParquetCompressionLz4 StreamNewParamsSchemaFormatParquetCompression = "lz4"
RowGroupBytes int64optional
formatint64
minimum0
Inferred booloptional
WorkerBinding param.Field[StreamNewParamsWorkerBinding]optional

Body param

Enabled bool

Indicates that the worker binding is enabled.

ReturnsExpand Collapse
type StreamNewResponse struct{…}
ID string

Indicates a unique identifier for this stream.

CreatedAt Time
formatdate-time
HTTP StreamNewResponseHTTP
Authentication bool

Indicates that authentication is required for the HTTP endpoint.

Enabled bool

Indicates that the HTTP endpoint is enabled.

CORS StreamNewResponseHTTPCORSoptional

Specifies the CORS options for the HTTP endpoint.

Origins []stringoptional
ModifiedAt Time
formatdate-time
Name string

Indicates the name of the Stream.

maxLength128
minLength1
Version int64

Indicates the current version of this stream.

WorkerBinding StreamNewResponseWorkerBinding
Enabled bool

Indicates that the worker binding is enabled.

Endpoint stringoptional

Indicates the endpoint URL of this stream.

formaturi
Format StreamNewResponseFormatoptional
One of the following:
type StreamNewResponseFormatJson struct{…}
Type StreamNewResponseFormatJsonType
DecimalEncoding StreamNewResponseFormatJsonDecimalEncodingoptional
One of the following:
const StreamNewResponseFormatJsonDecimalEncodingNumber StreamNewResponseFormatJsonDecimalEncoding = "number"
const StreamNewResponseFormatJsonDecimalEncodingString StreamNewResponseFormatJsonDecimalEncoding = "string"
const StreamNewResponseFormatJsonDecimalEncodingBytes StreamNewResponseFormatJsonDecimalEncoding = "bytes"
TimestampFormat StreamNewResponseFormatJsonTimestampFormatoptional
One of the following:
const StreamNewResponseFormatJsonTimestampFormatRfc3339 StreamNewResponseFormatJsonTimestampFormat = "rfc3339"
const StreamNewResponseFormatJsonTimestampFormatUnixMillis StreamNewResponseFormatJsonTimestampFormat = "unix_millis"
Unstructured booloptional
type StreamNewResponseFormatParquet struct{…}
Type StreamNewResponseFormatParquetType
Compression StreamNewResponseFormatParquetCompressionoptional
One of the following:
const StreamNewResponseFormatParquetCompressionUncompressed StreamNewResponseFormatParquetCompression = "uncompressed"
const StreamNewResponseFormatParquetCompressionSnappy StreamNewResponseFormatParquetCompression = "snappy"
const StreamNewResponseFormatParquetCompressionGzip StreamNewResponseFormatParquetCompression = "gzip"
const StreamNewResponseFormatParquetCompressionZstd StreamNewResponseFormatParquetCompression = "zstd"
const StreamNewResponseFormatParquetCompressionLz4 StreamNewResponseFormatParquetCompression = "lz4"
RowGroupBytes int64optional
formatint64
minimum0
Schema StreamNewResponseSchemaoptional
Fields []StreamNewResponseSchemaFieldoptional
One of the following:
type StreamNewResponseSchemaFieldsInt32 struct{…}
Type StreamNewResponseSchemaFieldsInt32Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsInt64 struct{…}
Type StreamNewResponseSchemaFieldsInt64Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsFloat32 struct{…}
Type StreamNewResponseSchemaFieldsFloat32Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsFloat64 struct{…}
Type StreamNewResponseSchemaFieldsFloat64Type
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsBool struct{…}
Type StreamNewResponseSchemaFieldsBoolType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsString struct{…}
Type StreamNewResponseSchemaFieldsStringType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsBinary struct{…}
Type StreamNewResponseSchemaFieldsBinaryType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsTimestamp struct{…}
Type StreamNewResponseSchemaFieldsTimestampType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
Unit StreamNewResponseSchemaFieldsTimestampUnitoptional
One of the following:
const StreamNewResponseSchemaFieldsTimestampUnitSecond StreamNewResponseSchemaFieldsTimestampUnit = "second"
const StreamNewResponseSchemaFieldsTimestampUnitMillisecond StreamNewResponseSchemaFieldsTimestampUnit = "millisecond"
const StreamNewResponseSchemaFieldsTimestampUnitMicrosecond StreamNewResponseSchemaFieldsTimestampUnit = "microsecond"
const StreamNewResponseSchemaFieldsTimestampUnitNanosecond StreamNewResponseSchemaFieldsTimestampUnit = "nanosecond"
type StreamNewResponseSchemaFieldsJson struct{…}
Type StreamNewResponseSchemaFieldsJsonType
MetadataKey stringoptional
Name stringoptional
Required booloptional
SqlName stringoptional
type StreamNewResponseSchemaFieldsStruct struct{…}
type StreamNewResponseSchemaFieldsList struct{…}
Format StreamNewResponseSchemaFormatoptional
One of the following:
type StreamNewResponseSchemaFormatJson struct{…}
Type StreamNewResponseSchemaFormatJsonType
DecimalEncoding StreamNewResponseSchemaFormatJsonDecimalEncodingoptional
One of the following:
const StreamNewResponseSchemaFormatJsonDecimalEncodingNumber StreamNewResponseSchemaFormatJsonDecimalEncoding = "number"
const StreamNewResponseSchemaFormatJsonDecimalEncodingString StreamNewResponseSchemaFormatJsonDecimalEncoding = "string"
const StreamNewResponseSchemaFormatJsonDecimalEncodingBytes StreamNewResponseSchemaFormatJsonDecimalEncoding = "bytes"
TimestampFormat StreamNewResponseSchemaFormatJsonTimestampFormatoptional
One of the following:
const StreamNewResponseSchemaFormatJsonTimestampFormatRfc3339 StreamNewResponseSchemaFormatJsonTimestampFormat = "rfc3339"
const StreamNewResponseSchemaFormatJsonTimestampFormatUnixMillis StreamNewResponseSchemaFormatJsonTimestampFormat = "unix_millis"
Unstructured booloptional
type StreamNewResponseSchemaFormatParquet struct{…}
Type StreamNewResponseSchemaFormatParquetType
Compression StreamNewResponseSchemaFormatParquetCompressionoptional
One of the following:
const StreamNewResponseSchemaFormatParquetCompressionUncompressed StreamNewResponseSchemaFormatParquetCompression = "uncompressed"
const StreamNewResponseSchemaFormatParquetCompressionSnappy StreamNewResponseSchemaFormatParquetCompression = "snappy"
const StreamNewResponseSchemaFormatParquetCompressionGzip StreamNewResponseSchemaFormatParquetCompression = "gzip"
const StreamNewResponseSchemaFormatParquetCompressionZstd StreamNewResponseSchemaFormatParquetCompression = "zstd"
const StreamNewResponseSchemaFormatParquetCompressionLz4 StreamNewResponseSchemaFormatParquetCompression = "lz4"
RowGroupBytes int64optional
formatint64
minimum0
Inferred booloptional

Create Stream

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/pipelines"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  stream, err := client.Pipelines.Streams.New(context.TODO(), pipelines.StreamNewParams{
    AccountID: cloudflare.F("0123105f4ecef8ad9ca31a8372d0c353"),
    Name: cloudflare.F("my_stream"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", stream.ID)
}
{
  "result": {
    "id": "01234567890123457689012345678901",
    "created_at": "2019-12-27T18:11:19.117Z",
    "http": {
      "authentication": false,
      "enabled": true,
      "cors": {
        "origins": [
          "string"
        ]
      }
    },
    "modified_at": "2019-12-27T18:11:19.117Z",
    "name": "my_stream",
    "version": 3,
    "worker_binding": {
      "enabled": true
    },
    "endpoint": "https://01234567890123457689012345678901.ingest.cloudflare.com/v1",
    "format": {
      "type": "json",
      "decimal_encoding": "number",
      "timestamp_format": "rfc3339",
      "unstructured": true
    },
    "schema": {
      "fields": [
        {
          "type": "int32",
          "metadata_key": "metadata_key",
          "name": "name",
          "required": true,
          "sql_name": "sql_name"
        }
      ],
      "format": {
        "type": "json",
        "decimal_encoding": "number",
        "timestamp_format": "rfc3339",
        "unstructured": true
      },
      "inferred": true
    }
  },
  "success": true
}
Returns Examples
{
  "result": {
    "id": "01234567890123457689012345678901",
    "created_at": "2019-12-27T18:11:19.117Z",
    "http": {
      "authentication": false,
      "enabled": true,
      "cors": {
        "origins": [
          "string"
        ]
      }
    },
    "modified_at": "2019-12-27T18:11:19.117Z",
    "name": "my_stream",
    "version": 3,
    "worker_binding": {
      "enabled": true
    },
    "endpoint": "https://01234567890123457689012345678901.ingest.cloudflare.com/v1",
    "format": {
      "type": "json",
      "decimal_encoding": "number",
      "timestamp_format": "rfc3339",
      "unstructured": true
    },
    "schema": {
      "fields": [
        {
          "type": "int32",
          "metadata_key": "metadata_key",
          "name": "name",
          "required": true,
          "sql_name": "sql_name"
        }
      ],
      "format": {
        "type": "json",
        "decimal_encoding": "number",
        "timestamp_format": "rfc3339",
        "unstructured": true
      },
      "inferred": true
    }
  },
  "success": true
}