Skip to main content

Overview

Magic Transit provides network-level DDoS protection and traffic acceleration for your entire network. Use the Magic Transit API to manage routes, tunnels, sites, and network monitoring.

Initialize the client

Resources

The Magic Transit API provides the following sub-resources:

Routes

Manage Magic static routes for traffic routing.

Create a route

Creates a new Magic static route.
string
required
Account identifier
string
required
The next hop IP address for this route
string
required
IP prefix in CIDR notation
number
required
Route priority (lower values have higher priority)

Update a route

Update a specific Magic static route.

List routes

List all Magic static routes.

Delete a route

Disable and remove a specific Magic static route.

GRE tunnels

Manage Generic Routing Encapsulation (GRE) tunnels for Magic Transit.
Available methods:
  • create() - Create a new GRE tunnel
  • update() - Update an existing GRE tunnel
  • list() - List all GRE tunnels
  • delete() - Delete a GRE tunnel
  • get() - Get details of a specific GRE tunnel
  • bulkUpdate() - Update multiple GRE tunnels at once

IPsec tunnels

Manage IPsec tunnels for Magic Transit.
Available methods:
  • create() - Create a new IPsec tunnel
  • update() - Update an existing IPsec tunnel
  • list() - List all IPsec tunnels
  • delete() - Delete an IPsec tunnel
  • get() - Get details of a specific IPsec tunnel
  • pskGenerate() - Generate a pre-shared key for IPsec tunnel

Sites

Manage Magic Transit sites with LAN/WAN configuration.
Available methods:
  • create() - Create a new site
  • update() - Update an existing site
  • list() - List all sites
  • delete() - Delete a site
  • get() - Get details of a specific site

Connectors

Manage Magic Connector instances for site connectivity.

PCAPs

Capture and analyze network packet data.
Available methods:
  • create() - Start a new packet capture
  • list() - List all packet captures
  • get() - Get details of a specific capture
  • stop() - Stop an ongoing packet capture

CF Interconnects

Manage Cloudflare Interconnects for Magic Transit.

Apps

Manage Magic Transit application configurations.

Types

HealthCheck

Configuration for tunnel health checks.
boolean
Determines whether to run health checks for a tunnel
'low' | 'mid' | 'high'
How frequently the health check runs (default: ‘mid’)
'reply' | 'request'
The type of health check to run (default: ‘reply’)
string | object
The destination address for request-type health checks