Search + K

Command Palette

Search for a command to run...

Sign In

Create a Cloudflare Tunnel

POST /accounts/{account_id}/cfd_tunnel
Copy endpoint
https://api.cloudflare.com/client/v4

Creates a new Cloudflare Tunnel in an account.

Parameters

path Path Parameters

Name Type
account_id required
type TunnelAccountId = string

Request Body

application/json required
{ config_src?: TunnelConfigSrc

Indicates if this is a locally or remotely configured tunnel. If local, manage the tunnel using a YAML file on the origin machine. If cloudflare, manage the tunnel on the Zero Trust dashboard.

type TunnelConfigSrc = "local" | "cloudflare"
;name: TunnelTunnelName

A user-friendly name for a tunnel.

type TunnelTunnelName = string
;tunnel_secret?: TunnelTunnelSecret

Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string.

type TunnelTunnelSecret = string
; }

Responses

200 application/json

Create a Cloudflare Tunnel response

type TunnelTunnelResponseSingle = interface TunnelApiResponseCommon {
errors: TunnelMessages
type TunnelMessages = { code: number;message: string; }[]
;
messages: TunnelMessages
type TunnelMessages = { code: number;message: string; }[]
;
result: {} | unknown[] | string;
success: true;
}
& { result?: TunnelCfdTunnel

A Cloudflare Tunnel that connects your origin to Cloudflare's edge.

interface TunnelCfdTunnel {
account_tag?: TunnelAccountId;
config_src?: TunnelConfigSrc;
connections?: TunnelConnectionsDeprecated;
conns_active_at?: TunnelConnsActiveAt;
conns_inactive_at?: TunnelConnsInactiveAt;
created_at?: TunnelCreatedAt;
deleted_at?: TunnelDeletedAt;
id?: TunnelTunnelId;
metadata?: TunnelMetadata;
name?: TunnelTunnelName;
remote_config?: TunnelRemoteConfig;
status?: TunnelStatus;
tun_type?: TunnelTunnelType;
}
| TunnelWarpConnectorTunnel

A Warp Connector Tunnel that connects your origin to Cloudflare's edge.

interface TunnelWarpConnectorTunnel {
account_tag?: TunnelAccountId;
connections?: TunnelConnectionsDeprecated;
conns_active_at?: TunnelConnsActiveAt;
conns_inactive_at?: TunnelConnsInactiveAt;
created_at?: TunnelCreatedAt;
deleted_at?: TunnelDeletedAt;
id?: TunnelTunnelId;
metadata?: TunnelMetadata;
name?: TunnelTunnelName;
status?: TunnelStatus;
tun_type?: TunnelTunnelType;
}
; }

Client Errors

4XX application/json

Create a Cloudflare Tunnel response failure

type TunnelTunnelResponseSingle = interface TunnelApiResponseCommon {
errors: TunnelMessages
type TunnelMessages = { code: number;message: string; }[]
;
messages: TunnelMessages
type TunnelMessages = { code: number;message: string; }[]
;
result: {} | unknown[] | string;
success: true;
}
& { result?: TunnelCfdTunnel

A Cloudflare Tunnel that connects your origin to Cloudflare's edge.

interface TunnelCfdTunnel {
account_tag?: TunnelAccountId;
config_src?: TunnelConfigSrc;
connections?: TunnelConnectionsDeprecated;
conns_active_at?: TunnelConnsActiveAt;
conns_inactive_at?: TunnelConnsInactiveAt;
created_at?: TunnelCreatedAt;
deleted_at?: TunnelDeletedAt;
id?: TunnelTunnelId;
metadata?: TunnelMetadata;
name?: TunnelTunnelName;
remote_config?: TunnelRemoteConfig;
status?: TunnelStatus;
tun_type?: TunnelTunnelType;
}
| TunnelWarpConnectorTunnel

A Warp Connector Tunnel that connects your origin to Cloudflare's edge.

interface TunnelWarpConnectorTunnel {
account_tag?: TunnelAccountId;
connections?: TunnelConnectionsDeprecated;
conns_active_at?: TunnelConnsActiveAt;
conns_inactive_at?: TunnelConnsInactiveAt;
created_at?: TunnelCreatedAt;
deleted_at?: TunnelDeletedAt;
id?: TunnelTunnelId;
metadata?: TunnelMetadata;
name?: TunnelTunnelName;
status?: TunnelStatus;
tun_type?: TunnelTunnelType;
}
; }
& interface TunnelApiResponseCommonFailure {
errors: TunnelMessages
type TunnelMessages = { code: number;message: string; }[]
;
messages: TunnelMessages
type TunnelMessages = { code: number;message: string; }[]
;
result: null;
success: false;
}