Skip to content
Railgun
Visit Railgun on GitHub
Set theme to dark (⇧+D)

Enable and disable connections

After a Railgun has been activated, it can be exposed to a particular domain with the suggestion_set API call. suggestion_set also accepts the auto_enabled parameter to assign and enable Railgun for the domain globally in a single API call. If auto_enabled is not set to 1, then the connection needed to enable Railgun for the domain must be made manually using the conn_set method. conn_setmode_enabled and conn_setmode_disabled can be used to toggle Railgun on or off for the domain globally. zone_conn_get_active can be used to view active Railgun connections.

POST suggestion_set

POST /api/v2/railgun/suggestion_set

Expose a verified Railgun to a domain via the Cloudflare Settings user-interface. This method allows an end-user to select and enable the specified Railgun within the Cloudflare Settings user-interface. If auto_enabled is set to 0, it is also necessary to perform a conn_set for the Railgun in order to setup a connection with the domain.

Form parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
  • auto_enabled – Railgun operation mode, 1 for active 0 for inactive
Example request
POST /api/v2/railgun/suggestion_set HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example form parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
auto_enabled=0
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_suggest",
"railgun_id": "1",
},
"result": "success"
}

GET suggestion_set

GET /api/v2/railgun/suggestion_set

Expose a verified Railgun to a domain via the Cloudflare Settings user-interface. This method allows an end-user to select and enable the specified Railgun within the Cloudflare Settings user-interface. If auto_enabled is set to 0, it is also necessary to perform a conn_set for the Railgun in order to setup a connection with the domain.

Query parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
  • auto_enabled – Railgun operation mode, 1 for active 0 for inactive
Example request
GET /api/v2/railgun/suggestion_set?host_key=&rtkn=&z=&mode= HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example query string parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
auto_enabled=0
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_suggest",
"railgun_id": "1",
},
"result": "success"
}

POST conn_set

POST /api/v2/railgun/conn_set

Establish a connection between a domain and a Railgun without requiring the domain’s user to utilize the Cloudflare Settings user-interface to change or deactivate it. The mode parameter can be set to 1 in order to enable the Railgun globally if conn_set succeeds.

Form parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
  • mode – Railgun operation mode, 1 for active 0 for inactive
Example request
POST /api/v2/railgun/conn_set HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example form parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
mode=0
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_set",
"railgun_conn_id": "1",
"railgun_rec_name": "rg-d65dfffff666a77fd3dea2a7cfeede90.port2408.net"
},
"result": "success"
}

GET conn_set

GET /api/v2/railgun/conn_set

Establish a connection between a domain and a Railgun without requiring the domain’s user to utilize the Cloudflare Settings user-interface to change or deactivate it. The mode parameter can be set to 1 in order to enable the Railgun globally if conn_set succeeds.

Query parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
  • mode – Railgun operation mode, 1 for active 0 for inactive
Example request
GET /api/v2/railgun/conn_set?host_key=&rtkn=&z=&mode= HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example query string parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
mode=0
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_set",
"railgun_conn_id": "1",
"railgun_rec_name": "rg-d65dfffff666a77fd3dea2a7cfeede90.port2408.net"
},
"result": "success"
}

POST conn_setmode_enabled

POST /api/v2/railgun/conn_setmode_enabled

Enable a Railgun. If request is successful, the specified Railgun will be enabled and traffic for the specified domain will be proxied through Railgun.

Form parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
Example request
POST /api/v2/railgun/conn_setmode_enabled HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example form parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_setmode_enabled",
"railgun_id": "1"
},
"result": "success"
}

GET conn_setmode_enabled

GET /api/v2/railgun/conn_setmode_enabled

Enable a Railgun. If request is successful, the specified Railgun will be enabled and traffic for the specified domain will be proxied through Railgun.

Query parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
Example request
GET /api/v2/railgun/conn_setmode_enabled?host_key=&rtkn=&z= HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example query string parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_setmode_enabled",
"railgun_id": "1"
},
"result": "success"
}

POST conn_setmode_disabled

POST /api/v2/railgun/conn_setmode_disabled

Disable a Railgun. If request is successful, the specified Railgun will be disabled and traffic for the specified domain will no longer use Railgun.

Form parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
Example request
POST /api/v2/railgun/conn_setmode_disabled HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example form parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_setmode_disabled",
"railgun_id": "1"
},
"result": "success"
}

GET conn_setmode_disabled

GET /api/v2/railgun/conn_setmode_disabled

Disable a Railgun. If request is successful, the specified Railgun will be disabled and traffic for the specified domain will no longer use Railgun.

Query parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
Example request
GET /api/v2/railgun/conn_setmode_disabled?host_key=&rtkn=&z= HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example query string parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_setmode_disabled",
"railgun_id": "1"
},
"result": "success"
}

POST conn_delete

POST /api/v2/railgun/conn_delete

Remove a connection between a domain and a Railgun. This API call will allow a connected Railgun to be assigned to a different domain. Removing the connection of an enabled Railgun and domain will disable Railgun for the domain until a new connection is made with conn_set.

Form parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
Example request
POST /api/v2/railgun/conn_delete HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example form parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_delete",
"railgun_id": "1"
},
"result": "success"
}

GET conn_delete

GET /api/v2/railgun/conn_delete

Remove a connection between a domain and a Railgun. This API call will allow a connected Railgun to be assigned to a different domain. Removing the connection of an enabled Railgun and domain will disable Railgun for the domain until a new connection is made with conn_set.

Query parameters

  • host_key – Host API key
  • z – Domain name
  • rtkn – Railgun token
Example request
GET /api/v2/railgun/conn_delete?host_key=&rtkn=&z= HTTP/1.1
Host: www.cloudflare.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Example query string parameters:
host_key=e111dff66d1fddfda6a888c9992d4366
rtkn=7h8i9j0k1l2m3n4o5p6q7r8id9h0j1l
z=example.com
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"msg": null,
"response": {
"act": "railgun_conn_delete",
"railgun_id": "1"
},
"result": "success"
}