Loading

How to Check Cloudhub 2.0 VPN Status via API

Veröffentlichungsdatum: Sep 3, 2026
Voraussetzung(en)
Before you begin, make sure you have the following: - A CloudHub 2.0 Private Space that has an Anypoint VPN connection configured. This method does not apply to CloudHub 1.0 (VPC-based) VPNs. - An Anypoint Platform user in the organization or business group that owns the Private Space, with permission to read the Private Space network configuration. See the note in Step 1 on the required permission. - The Organization ID and the Private Space ID (how to find them is in Step 3). - A way to make an authenticated HTTPS GET request, such as curl. The examples also use jq to parse the JSON response, which is optional.
Aufgabe

This article explains how to check the Anypoint VPN tunnel status in a CloudHub 2.0 Private Space using the Anypoint Platform API. You can use this to monitor the VPN and, by incorporating it with other tools, get alerted when a tunnel is down.

Schritte

STEPS

1. Create or identify a user in the Anypoint Platform in the organization or business group that owns the Private Space and its VPN. Grant that user permission to read the Private Space network configuration.

2. Retrieve a bearer token from the Anypoint Platform. See "How to generate your Authorization Bearer token for Anypoint Platform." The token expires per the "Default session timeout" setting in the root organization, usually 1 hour and a maximum of 3 hours, so refresh it regularly. For example:

curl -X POST \
  https://anypoint.mulesoft.com/accounts/login \
  -H 'Accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
    "username": "myusername",
    "password": "mypassword"
}'

{
  "access_token": "5c3c8c97-5afd-4c78-ab1a-xxxxxxxxxxxx",
  "token_type": "bearer",
  "redirectUrl": "/home/"
}

3. Get the Organization ID and the Private Space ID.

  • The Organization ID is in Access Management > Organization > (organization name).
  • The Private Space ID is in Runtime Manager > Private Spaces. Open the private space and read the ID from the address bar, or from the private space details.

Unlike CloudHub 1.0, there is no VPC ID and no separate VPN ID to collect. One request returns every VPN connection in the private space.

4. Query the API for the VPN status.

curl -X GET \
  https://anypoint.mulesoft.com/runtimefabric/api/organizations/<org id>/privatespaces/<private space id>/connections \
  -H 'Authorization: Bearer 5c3c8c97-5afd-4c78-ab1a-xxxxxxxxxxxx'

The output is JSON. Each element in the array is a connection, each connection has a vpns list, and each VPN has a vpnTunnels list. The status fields to watch per tunnel are:

  • status — UP or DOWN
  • statusMessage — a human-readable message, for example "IPSEC IS DOWN"
  • acceptedRouteCount — routes the tunnel has learned; a drop to 0 is also a down signal
  • lastStatusChange — timestamp of the last status change, useful for detecting a flap

The connection also reports vpnConnectionStatus (for example, "available" or "modifying").

To parse only the tunnel statuses, pipe to jq:

curl -X GET -s \
  https://anypoint.mulesoft.com/runtimefabric/api/organizations/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/privatespaces/11111111-2222-3333-4444-555555555555/connections \
  -H 'Authorization: Bearer 5c3c8c97-5afd-4c78-ab1a-xxxxxxxxxxxx' | jq --raw-output '.[].vpns[].vpnTunnels[].status'



Tunnel name, status, and message together:

... | jq --raw-output '.[].vpns[] | .connectionName + ": " + (.vpnTunnels[] | .status + " " + .statusMessage)'

Only connections with a tunnel currently DOWN:

... | jq --raw-output '.[].vpns[] | select(.vpnTunnels[].status == "DOWN") | .connectionName'
Zusätzliche Ressourcen

USING THIS FOR MONITORING AND ALERTING

Run the query on a schedule (a scheduled job or an external monitor) and raise a notification when any tunnel reports DOWN.
Please keep in mind:

  • The reported status can lag the real state by a few minutes, because it depends on the underlying infrastructure provider. Use it for detection and notification, but keep any automatic failover decision on your customer gateway, where the tunnel state is authoritative and immediate.
  • Depending on your routing, a tunnel can report DOWN during normal operation. Account for that in your alert logic.
  • Run the monitor from a location that does not depend on the VPN itself, so the alert path stays up even when the tunnel is down.

CAUTION: SENSITIVE DATA IN THE RESPONSE

The connections response includes tunnel configuration details, including the pre-shared keys (the psk field) for each tunnel. Treat the full response as sensitive: do not paste it into shared channels, tickets, or logs without redacting the pre-shared keys and any tunnel IP addresses.

Nummer des Knowledge-Artikels

005421205

 
Laden
Salesforce Help | Article