Skip to content
Start here

[DEPRECATED] Create Pipeline

Deprecated
client.Pipelines.New(ctx, params) (*PipelineNewResponse, error)
POST/accounts/{account_id}/pipelines

[DEPRECATED] Create a new pipeline. Use the new /pipelines/v1/pipelines endpoint instead.

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 PipelineNewParams
AccountID param.Field[string]

Path param: Specifies the public ID of the account.

Destination param.Field[PipelineNewParamsDestination]

Body param

Batch PipelineNewParamsDestinationBatch
MaxBytes int64optional

Specifies rough maximum size of files.

maximum100000000
minimum1000
MaxDurationS float64optional

Specifies duration to wait to aggregate batches files.

maximum300
minimum0.25
MaxRows int64optional

Specifies rough maximum number of rows per file.

maximum10000000
minimum100
Compression PipelineNewParamsDestinationCompression
Type PipelineNewParamsDestinationCompressionTypeoptional

Specifies the desired compression algorithm and format.

One of the following:
const PipelineNewParamsDestinationCompressionTypeNone PipelineNewParamsDestinationCompressionType = "none"
const PipelineNewParamsDestinationCompressionTypeGzip PipelineNewParamsDestinationCompressionType = "gzip"
const PipelineNewParamsDestinationCompressionTypeDeflate PipelineNewParamsDestinationCompressionType = "deflate"
Credentials PipelineNewParamsDestinationCredentials
AccessKeyID string

Specifies the R2 Bucket Access Key Id.

Endpoint string

Specifies the R2 Endpoint.

SecretAccessKey string

Specifies the R2 Bucket Secret Access Key.

Format PipelineNewParamsDestinationFormat

Specifies the format of data to deliver.

Path PipelineNewParamsDestinationPath
Bucket string

Specifies the R2 Bucket to store files.

Filename stringoptional

Specifies the name pattern to for individual data files.

Filepath stringoptional

Specifies the name pattern for directory.

Prefix stringoptional

Specifies the base directory within the bucket.

Type PipelineNewParamsDestinationType

Specifies the type of destination.

Name param.Field[string]

Body param: Defines the name of the pipeline.

maxLength128
minLength1
Source param.Field[[]PipelineNewParamsSource]

Body param

type PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesHTTPSource struct{…}

[DEPRECATED] HTTP source configuration. Use the new streams API instead.

Format PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesHTTPSourceFormat

Specifies the format of source data.

Type string
Authentication booloptional

Specifies whether authentication is required to send to this pipeline via HTTP.

CORS PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesHTTPSourceCORSoptional
Origins []stringoptional

Specifies allowed origins to allow Cross Origin HTTP Requests.

type PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesBindingSource struct{…}

[DEPRECATED] Worker binding source configuration. Use the new streams API instead.

Format PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesBindingSourceFormat

Specifies the format of source data.

Type string
ReturnsExpand Collapse
type PipelineNewResponse struct{…}

[DEPRECATED] Describes the configuration of a pipeline. Use the new streams/sinks/pipelines API instead.

ID string

Specifies the pipeline identifier.

Destination PipelineNewResponseDestination
Batch PipelineNewResponseDestinationBatch
MaxBytes int64

Specifies rough maximum size of files.

maximum100000000
minimum1000
MaxDurationS float64

Specifies duration to wait to aggregate batches files.

maximum300
minimum0.25
MaxRows int64

Specifies rough maximum number of rows per file.

maximum10000000
minimum100
Compression PipelineNewResponseDestinationCompression
Type PipelineNewResponseDestinationCompressionType

Specifies the desired compression algorithm and format.

One of the following:
const PipelineNewResponseDestinationCompressionTypeNone PipelineNewResponseDestinationCompressionType = "none"
const PipelineNewResponseDestinationCompressionTypeGzip PipelineNewResponseDestinationCompressionType = "gzip"
const PipelineNewResponseDestinationCompressionTypeDeflate PipelineNewResponseDestinationCompressionType = "deflate"
Format PipelineNewResponseDestinationFormat

Specifies the format of data to deliver.

Path PipelineNewResponseDestinationPath
Bucket string

Specifies the R2 Bucket to store files.

Filename stringoptional

Specifies the name pattern to for individual data files.

Filepath stringoptional

Specifies the name pattern for directory.

Prefix stringoptional

Specifies the base directory within the bucket.

Type PipelineNewResponseDestinationType

Specifies the type of destination.

Endpoint string

Indicates the endpoint URL to send traffic.

Name string

Defines the name of the pipeline.

maxLength128
minLength1
Source []PipelineNewResponseSource
One of the following:
type PipelineNewResponseSourceCloudflarePipelinesWorkersPipelinesHTTPSource struct{…}

[DEPRECATED] HTTP source configuration. Use the new streams API instead.

Format PipelineNewResponseSourceCloudflarePipelinesWorkersPipelinesHTTPSourceFormat

Specifies the format of source data.

Type string
Authentication booloptional

Specifies whether authentication is required to send to this pipeline via HTTP.

CORS PipelineNewResponseSourceCloudflarePipelinesWorkersPipelinesHTTPSourceCORSoptional
Origins []stringoptional

Specifies allowed origins to allow Cross Origin HTTP Requests.

type PipelineNewResponseSourceCloudflarePipelinesWorkersPipelinesBindingSource struct{…}

[DEPRECATED] Worker binding source configuration. Use the new streams API instead.

Format PipelineNewResponseSourceCloudflarePipelinesWorkersPipelinesBindingSourceFormat

Specifies the format of source data.

Type string
Version float64

Indicates the version number of last saved configuration.

[DEPRECATED] Create Pipeline

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"),
  )
  pipeline, err := client.Pipelines.New(context.TODO(), pipelines.PipelineNewParams{
    AccountID: cloudflare.F("0123105f4ecef8ad9ca31a8372d0c353"),
    Destination: cloudflare.F(pipelines.PipelineNewParamsDestination{
      Batch: cloudflare.F(pipelines.PipelineNewParamsDestinationBatch{

      }),
      Compression: cloudflare.F(pipelines.PipelineNewParamsDestinationCompression{

      }),
      Credentials: cloudflare.F(pipelines.PipelineNewParamsDestinationCredentials{
        AccessKeyID: cloudflare.F("<access key id>"),
        Endpoint: cloudflare.F("https://123f8a8258064ed892a347f173372359.r2.cloudflarestorage.com"),
        SecretAccessKey: cloudflare.F("<secret key>"),
      }),
      Format: cloudflare.F(pipelines.PipelineNewParamsDestinationFormatJson),
      Path: cloudflare.F(pipelines.PipelineNewParamsDestinationPath{
        Bucket: cloudflare.F("bucket"),
      }),
      Type: cloudflare.F(pipelines.PipelineNewParamsDestinationTypeR2),
    }),
    Name: cloudflare.F("sample_pipeline"),
    Source: cloudflare.F([]pipelines.PipelineNewParamsSourceUnion{pipelines.PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesHTTPSource{
      Format: cloudflare.F(pipelines.PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesHTTPSourceFormatJson),
      Type: cloudflare.F("type"),
    }}),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", pipeline.ID)
}
{
  "result": {
    "id": "123f8a8258064ed892a347f173372359",
    "destination": {
      "batch": {
        "max_bytes": 1000,
        "max_duration_s": 0.25,
        "max_rows": 100
      },
      "compression": {
        "type": "gzip"
      },
      "format": "json",
      "path": {
        "bucket": "bucket",
        "filename": "${slug}${extension}",
        "filepath": "${date}/${hour}",
        "prefix": "base"
      },
      "type": "r2"
    },
    "endpoint": "https://123f8a8258064ed892a347f173372359.pipelines.cloudflare.com",
    "name": "sample_pipeline",
    "source": [
      {
        "format": "json",
        "type": "type",
        "authentication": true,
        "cors": {
          "origins": [
            "*"
          ]
        }
      }
    ],
    "version": 2
  },
  "success": true
}
Returns Examples
{
  "result": {
    "id": "123f8a8258064ed892a347f173372359",
    "destination": {
      "batch": {
        "max_bytes": 1000,
        "max_duration_s": 0.25,
        "max_rows": 100
      },
      "compression": {
        "type": "gzip"
      },
      "format": "json",
      "path": {
        "bucket": "bucket",
        "filename": "${slug}${extension}",
        "filepath": "${date}/${hour}",
        "prefix": "base"
      },
      "type": "r2"
    },
    "endpoint": "https://123f8a8258064ed892a347f173372359.pipelines.cloudflare.com",
    "name": "sample_pipeline",
    "source": [
      {
        "format": "json",
        "type": "type",
        "authentication": true,
        "cors": {
          "origins": [
            "*"
          ]
        }
      }
    ],
    "version": 2
  },
  "success": true
}