Skip to content
Engine API

VPN Tunnels

VPN Tunnels endpoints of the MedHook engine API: 66 operations with parameters, schemas and a curl example for each.

On this page

Site-to-site IPsec tunnels (GKE / GCP Classic VPN). Workspace-scoped.

List VPN tunnels

get/api/vpn-tunnels

Site-to-site tunnels in the current workspace, with live GCP status. Filtering and paging happen after the workspace query. When the engine is not on GKE the response is { enabled: false, reason, tunnels: [], nextCursor: null }.

Auth: Bearer token (how to get one) · Operation: listVpnTunnels

Parameters

NameInTypeDescription
qquerystring

Case-insensitive match on name, peer IP or any remote subnet.

statequerystring

Comma-separated stored states: provisioning, ready, failed, deleting, updating.

healthquerystring

Comma-separated live health: established, degraded, connecting, down, unknown.

limitqueryinteger
cursorquerystring

Tunnel id from a previous page's nextCursor.

viewquerystring

health returns { enabled, statusError, total, tunnels: [{ id, name, health }], nextCursor } without the gateway or the per-tunnel usage (no workflow scan, no credential decrypts). The workflow builder reads a tunnel's live status this way.

Responses

  • 200Tunnel page. With `view=health`, each tunnel is `{ id, name, health }` and there is no `gateway`.
    Response fields

    application/json · object

    • enabledboolean
    • reasonstring
    • gatewayobject
      3 fields
      • ipstring
      • regionstring
      • localSubnetsarray of string
    • statusErrorstring | null

      Set when live GCP status could not be read; the list is still returned.

    • totalinteger

      Matches across all pages.

    • tunnelsarray of VpnTunnel
    • nextCursorstring | null
  • 400Invalid q / state / health / limit / view.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels" \
  -H "Authorization: Bearer $TOKEN"

Create VPN tunnel

post/api/vpn-tunnels

Creates the record and provisions the GCP tunnel in the background. The pre-shared key is returned once here. When the handoff names the network engineer's email (not Interconnect), also makes the tunnel's shared link (audited vpn_tunnel.share_link_created) and emails it through the engine's email channel (audited vpn_tunnel.share_emailed with the recipient's domain only), answered as share. The remote subnets are checked against the VPN tunnels created outside MedHook in the engine's GCP project (GET /api/vpn-tunnels/external): an overlap is answered in warnings and doesn't stop the create; a subnet identical to a range such a tunnel already routes at the same or a better priority than the new tunnel's routes (1000) is a 400, since GCP would split or keep its traffic. When the tunnels can't be listed, warnings says the check couldn't run. A remote subnet overlapping another MedHook tunnel's or the cluster's ranges is a 409 SUBNET_OVERLAP whose nat offers per-tunnel NAT: sent again with nat: true, the remote subnets are the organization's real ranges, MedHook assigns each a unique translated range of the same size (VPN_NAT_POOL, default 100.64.0.0/10) that GCP routes and the organization's firewall maps 1:1 onto, and the overlap is answered in warnings; the tunnel's natMappings lists the pairs and destinations use the translated addresses. Before anything is created the project's VPN quotas are read (GET /api/vpn-tunnels/quota): a tunnel that would pass one is a 409 QUOTA_EXCEEDED naming it with the Cloud console link; the answer's quota carries what was read. Rate limited: 10 req / 60 s.

Auth: Bearer token (how to get one) · Operation: createVpnTunnel

Request body (required)

application/json · object

  • namestringrequired
  • peerIpstringrequired

    Public IPv4 address of the healthcare organization's VPN gateway.

  • remoteSubnetsarray of stringrequired

    Healthcare organization side IPv4 network CIDRs, /8 to /32.

  • localSubnetsarray of string

    The MedHook side's protected networks for this tunnel (Classic and HA; ignored for Interconnect). Omitted or []: the deployment's default, the node subnet plus Terraform's vpn_extra_local_ranges. Use it to carry your other applications' networks: Classic puts them in the local traffic selector, HA advertises exactly them on the tunnel's BGP sessions, and the partner's firewall configs and connection packet list them. Changing it re-creates the tunnel. A range that overlaps the tunnel's own remote subnets is a 400; overlaps with other tunnels, the cluster's pod or service ranges or VPN tunnels created outside MedHook are answered in warnings.

  • ikeVersioninteger

    One of: 1, 2

  • sharedSecretstring

    Pre-shared key. Generated when omitted.

  • peerAsninteger

    HA VPN only: the healthcare organization's BGP ASN. New tunnel sends 64512.

  • bgpRangesarray of string

    HA VPN only: one link-local /30 per interface. Omitted: the server allocates the first pair no HA tunnel on the shared Cloud Router holds.

  • descriptionstring
  • natboolean

    Per-tunnel NAT (Classic and HA): remoteSubnets are the organization's real ranges, which may overlap another organization's. MedHook assigns each a unique translated range of the same size; GCP routes those, the organization's firewall maps its real range 1:1 onto them, and destinations use the translated addresses. See the tunnel's natMappings.

    One of: true

  • handoffobject

    Optional handoff packet details stored with the tunnel. Unknown fields are refused. The created audit row records only whether one was sent.

    7 fields
    • hospitalstring

      The healthcare organization's name.

    • cutoverWindowstring

      When senders move over, e.g. Sat 02:00-04:00.

    • legacyHoststring

      The interface engine senders use today.

    • legacyEnginestring

      That engine's kind; unset or "other" keeps the packet neutral.

      One of: "rhapsody", "mirth", "other"

    • deviceConfigstring

      Their firewall, e.g. pfSense.

    • sendersarray of object

      Defaults to [].

      3 fields
      • namestringrequired
      • fromstringrequired

        Where the sender sends today.

      • tostringrequired

        Where it sends after cutover.

    • contactsarray of object

      Defaults to [].

      2 fields
      • rolestringrequired
      • valuestringrequired

        An email or phone. The network engineer's email gets the shared link.

Responses

  • 202Provisioning started.
    Response fields

    application/json · object

    • tunnelVpnTunnelrequired
    • peerConfigVpnPeerConfig

      What the healthcare organization's network engineer enters on their firewall. sharedSecret appears only when it was just generated or reveal=1 was passed.

    • shareobject | null

      The new tunnel's shared link, made when the handoff names the network engineer's email (not for Interconnect); null otherwise, or when making it failed (New link on the Config tab makes one).

      4 fields
      • urlstringrequired

        The shared link's short URL, https://{connect host}/t/{code}, for the network engineer.

      • expiresAtstring (date-time)required
      • recipientstringrequired

        The handoff packet's first email contact.

      • emailedbooleanrequired

        Emailed to the recipient through the engine's email channel. False when the engine has none or the send failed: copy the link and send it yourself.

    • warningsarray of object

      Overlaps with VPN tunnels created outside MedHook in the engine's GCP project, which don't stop the change, or why they couldn't be checked. Empty when there is nothing to say. A subnet identical to a range such a tunnel already routes at the same or a better priority is a 400 instead (Classic tunnels only).

      2 fields
      • patharray of string | integerrequired

        ["remoteSubnets", i] for one subnet, ["remoteSubnets"] for the whole list.

      • messagestringrequired

        Names the external tunnel, its region and the overlapping CIDRs; or that the check couldn't run (HA tunnels learn their ranges over BGP; a refused listing names roles/compute.networkViewer).

    • quotaobject | null

      The project's VPN quotas as read before provisioning (the GET /api/vpn-tunnels/quota shape); null for Interconnect.

  • 400Invalid tunnel.

    application/json · ApiError

  • 409A tunnel with that name already exists (CONFLICT), a remote subnet overlaps another tunnel or the cluster (SUBNET_OVERLAP, offers `nat`), a GCP quota has no room (QUOTA_EXCEEDED), or the NAT pool has no free range (NAT_POOL_EXHAUSTED).

    application/json · ApiError

  • 501`NOT_CONFIGURED` — the engine is not running on the GKE deployment (GCP_VPN_* env vars unset).

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "peerIp": "203.0.113.10",
  "remoteSubnets": [
    "10.20.0.0/24"
  ],
  "localSubnets": [
    "10.250.0.0/24"
  ],
  "ikeVersion": 2,
  "sharedSecret": "string",
  "peerAsn": 64512,
  "bgpRanges": [
    "169.254.0.1/30"
  ],
  "description": "string",
  "nat": true,
  "handoff": {
    "hospital": "string",
    "cutoverWindow": "string",
    "legacyHost": "string",
    "legacyEngine": "rhapsody",
    "deviceConfig": "string",
    "senders": [
      {
        "name": "string",
        "from": "10.20.0.40:6661",
        "to": "10.20.0.40:6661"
      }
    ],
    "contacts": [
      {
        "role": "Network engineer",
        "value": "string"
      }
    ]
  }
}'

Get VPN tunnel, peer config or vendor config file

get/api/vpn-tunnels/{id}

Returns the tunnel and its peer config. With format, returns a healthcare-organization-side config file as text/plain attachment instead. Without reveal=1 the key is written as <from the one-time link>. The PSK is included only with reveal=1, which is audited (vpn_tunnel.secret_revealed); while a PSK rollback is set (pskRollbackUntil) it is the held newer key, as one-time links hand out. Rate limited: 30 req / 60 s.

Auth: Bearer token (how to get one) · Operation: getVpnTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

revealquerystring

Include the pre-shared key.

formatquerystring

Download a vendor config file.

Responses

  • 200Tunnel + peer config, or the config file when `format` is set.

    application/json · VpnTunnelWithConfig

    text/plain · string

  • 400Unknown format.

    application/json · ApiError

  • 404Tunnel not found in this workspace.

    application/json · ApiError

  • 501`NOT_CONFIGURED` — the engine is not running on the GKE deployment (GCP_VPN_* env vars unset).

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>" \
  -H "Authorization: Bearer $TOKEN"

Update VPN tunnel

patch/api/vpn-tunnels/{id}

A rename returns 200. Changing peerIp, remoteSubnets, ikeVersion or sharedSecret, an HA tunnel's peerAsn or bgpRanges (400 on other types, or for a /30 another HA tunnel holds), rotateSecret: true, or retry: true re-creates the GCP tunnel in the background and returns 202 (409 if the tunnel is provisioning, updating or deleting). With rotateSecret, the new secret is returned once in peerConfig; during a PSK rollback rotateSecret puts back the held key instead (no secret returned, audited as vpn_tunnel.psk_rollback_ended) and sharedSecret is a 409. New remoteSubnets are checked against the VPN tunnels created outside MedHook as on create (warnings, or a 400 for a range already routed at the tunnel's route priority or better). Rate limited: 10 req / 60 s.

Auth: Bearer token (how to get one) · Operation: updateVpnTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body (required)

application/json · object

  • namestring
  • peerIpstring

    Public IPv4 address of the healthcare organization's VPN gateway.

  • remoteSubnetsarray of string

    Healthcare organization side IPv4 network CIDRs, /8 to /32.

  • localSubnetsarray of string

    The MedHook side's protected networks for this tunnel (Classic and HA; ignored for Interconnect). Omitted or []: the deployment's default, the node subnet plus Terraform's vpn_extra_local_ranges. Use it to carry your other applications' networks: Classic puts them in the local traffic selector, HA advertises exactly them on the tunnel's BGP sessions, and the partner's firewall configs and connection packet list them. Changing it re-creates the tunnel. A range that overlaps the tunnel's own remote subnets is a 400; overlaps with other tunnels, the cluster's pod or service ranges or VPN tunnels created outside MedHook are answered in warnings.

  • ikeVersioninteger

    One of: 1, 2

  • sharedSecretstring

    Pre-shared key. Generated when omitted.

  • rotateSecretboolean

    One of: true

  • retryboolean

    Re-create as-is (e.g. after a failed provision).

    One of: true

  • proposalstring

    With rotateSecret: the signed proposal of the Agent card the rotation was opened from, audited ai.proposal.resolved with the key version the rotation goes to; the card reads it in progress until the tunnel is on that version, and failed if the background job fails. Not a tunnel field; alone it is nothing to update (400).

  • peerAsninteger

    HA VPN only: the healthcare organization's BGP ASN. New tunnel sends 64512. Changing it changes their side of the config: send the config again.

  • bgpRangesarray of string

    HA VPN only: new link-local /30s, one per interface (each its own /30). The shared link shows the new values; a config or connection packet already downloaded keeps the old ones, so send the config again.

  • descriptionstring
  • natboolean

    Turn per-tunnel NAT on. On a NAT tunnel, remoteSubnets sent are the organization's real ranges; each keeps its translated range unless another tunnel now holds it.

    One of: true

  • handoffobject

    Optional handoff packet details stored with the tunnel. Unknown fields are refused. The created audit row records only whether one was sent.

    7 fields
    • hospitalstring

      The healthcare organization's name.

    • cutoverWindowstring

      When senders move over, e.g. Sat 02:00-04:00.

    • legacyHoststring

      The interface engine senders use today.

    • legacyEnginestring

      That engine's kind; unset or "other" keeps the packet neutral.

      One of: "rhapsody", "mirth", "other"

    • deviceConfigstring

      Their firewall, e.g. pfSense.

    • sendersarray of object

      Defaults to [].

      3 fields
      • namestringrequired
      • fromstringrequired

        Where the sender sends today.

      • tostringrequired

        Where it sends after cutover.

    • contactsarray of object

      Defaults to [].

      2 fields
      • rolestringrequired
      • valuestringrequired

        An email or phone. The network engineer's email gets the shared link.

Responses

  • 200Renamed.

    application/json · VpnTunnelWithConfig

  • 202Re-creating in the background. With new `remoteSubnets`, `warnings` lists overlaps with VPN tunnels created outside MedHook.
    Response fields

    application/json · object

    • tunnelVpnTunnelrequired
    • peerConfigVpnPeerConfig

      What the healthcare organization's network engineer enters on their firewall. sharedSecret appears only when it was just generated or reveal=1 was passed.

    • warningsarray of object

      Overlaps with VPN tunnels created outside MedHook in the engine's GCP project, which don't stop the change, or why they couldn't be checked. Empty when there is nothing to say. A subnet identical to a range such a tunnel already routes at the same or a better priority is a 400 instead (Classic tunnels only).

      2 fields
      • patharray of string | integerrequired

        ["remoteSubnets", i] for one subnet, ["remoteSubnets"] for the whole list.

      • messagestringrequired

        Names the external tunnel, its region and the overlapping CIDRs; or that the check couldn't run (HA tunnels learn their ranges over BGP; a refused listing names roles/compute.networkViewer).

  • 400Invalid update.

    application/json · ApiError

  • 404Tunnel not found in this workspace.

    application/json · ApiError

  • 409Name taken, or a re-create was requested while the tunnel is busy.

    application/json · ApiError

  • 501`NOT_CONFIGURED` — the engine is not running on the GKE deployment (GCP_VPN_* env vars unset).

    application/json · ApiError

Example request

curl
curl -X PATCH "$ENGINE_URL/api/vpn-tunnels/<id>" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "peerIp": "203.0.113.10",
  "remoteSubnets": [
    "10.20.0.0/24"
  ],
  "localSubnets": [
    "10.250.0.0/24"
  ],
  "ikeVersion": 1,
  "sharedSecret": "string",
  "rotateSecret": true,
  "retry": true,
  "proposal": "string",
  "peerAsn": 64512,
  "bgpRanges": [
    "169.254.0.1/30"
  ],
  "description": "string",
  "nat": true,
  "handoff": {
    "hospital": "string",
    "cutoverWindow": "string",
    "legacyHost": "string",
    "legacyEngine": "rhapsody",
    "deviceConfig": "string",
    "senders": [
      {
        "name": "string",
        "from": "10.20.0.40:6661",
        "to": "10.20.0.40:6661"
      }
    ],
    "contacts": [
      {
        "role": "Network engineer",
        "value": "string"
      }
    ]
  }
}'

Delete VPN tunnel

delete/api/vpn-tunnels/{id}

Sets state deleting and tears down the tunnel and routes in the background. While workflows listen through the tunnel the delete still goes ahead (the UI's Settings tab blocks it; the API is not tightened): the answer carries warning with code TUNNEL_IN_USE, a message and the workflows { id, name }, and the audit event records them as inUseBy. Rate limited: 10 req / 60 s.

Auth: Bearer token (how to get one) · Operation: deleteVpnTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 202Teardown started.
    Response fields

    application/json · object

    • tunnelVpnTunnelrequired
    • warningobject

      Present when workflows listened through the tunnel.

      3 fields
      • codestringrequired

        One of: "TUNNEL_IN_USE"

      • messagestringrequired
      • workflowsarray of objectrequired
        2 fields
        • idstringrequired
        • namestringrequired
  • 404Tunnel not found in this workspace.

    application/json · ApiError

  • 501`NOT_CONFIGURED` — the engine is not running on the GKE deployment (GCP_VPN_* env vars unset).

    application/json · ApiError

Example request

curl
curl -X DELETE "$ENGINE_URL/api/vpn-tunnels/<id>" \
  -H "Authorization: Bearer $TOKEN"

Add a backup tunnel (failover pair)

post/api/vpn-tunnels/{id}/backup

Adds a backup Classic tunnel to a ready Classic tunnel. The backup attaches to the second Classic gateway (Terraform vpn_secondary_gateway_enabled) and routes the primary's subnets at priority 200; the primary moves to 100 first. Subnets and IKE version follow the primary. The PSK is returned once. Admin only; audited (vpn_tunnel.created with pairedWith). Rate limited: 10 req / 60 s.

Auth: Bearer token (how to get one) · Operation: addVpnTunnelBackup

Parameters

NameInTypeDescription
idrequiredpathstring

Primary tunnel id.

Request body

application/json · object

  • peerIpstring

    Healthcare organization peer for the backup; defaults to the primary's.

  • sharedSecretstring

Responses

  • 202Backup row created; provisioning runs in the background.

    application/json · VpnTunnelWithConfig

  • 400Invalid body.

    application/json · ApiError

  • 404Tunnel not found in this workspace.

    application/json · ApiError

  • 409Not a ready Classic primary, already paired, name taken, or no second gateway.

    application/json · ApiError

  • 501`NOT_CONFIGURED` — the engine is not running on the GKE deployment (GCP_VPN_* env vars unset).

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/backup" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "peerIp": "198.51.100.20",
  "sharedSecret": "string"
}'

Make a paired tunnel carry traffic

post/api/vpn-tunnels/{id}/promote

Moves a failover pair's routes to this tunnel (priority 100) and its partner to standby (200), the same idempotent swap the tunnel watcher uses. Admin only; audited once (vpn_tunnel.failover) on this tunnel, shown in both tunnels' events. Rate limited: 10 req / 60 s.

Auth: Bearer token (how to get one) · Operation: promoteVpnTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

  • reasonstring

    Why, for the audit trail.

Responses

  • 200Traffic is on this tunnel.
    Response fields

    application/json · object

    • changedboolean

      False when it already carried traffic.

    • preferredTunnelIdstring
  • 400Invalid body.

    application/json · ApiError

  • 404Tunnel not found in this workspace.

    application/json · ApiError

  • 409Unpaired, busy, or not ready.

    application/json · ApiError

  • 501`NOT_CONFIGURED` — the engine is not running on the GKE deployment (GCP_VPN_* env vars unset).

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/promote" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "string"
}'

Resume the tunnel watcher

post/api/vpn-tunnels/{id}/watch

Clears the watcher's pause on this tunnel (flapping, or more actions in an hour than allowed) so it acts on its next read. Body: { "action": "resume" }. Admin only; audited (vpn_tunnel.watch_resumed). Rate limited: 20 req / 60 s.

Auth: Bearer token (how to get one) · Operation: resumeVpnTunnelWatch

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body (required)

application/json · object

  • actionstringrequired

    One of: "resume"

Responses

  • 200Watching again.
    Response fields

    application/json · object

    • watchobject
      1 field
      • phasestring
  • 400Invalid body.

    application/json · ApiError

  • 404Tunnel not found in this workspace, or not read by the watcher yet.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/watch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "action": "resume"
}'

Test connectivity through a tunnel

post/api/vpn-tunnels/{id}/test

Opens a TCP connection from the engine to host:port (5 s timeout). host must be an IPv4 address inside the tunnel's remote subnets. Audited (vpn_tunnel.connectivity_tested). Rate limited: 20 req / 60 s.

Auth: Bearer token (how to get one) · Operation: testVpnTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body (required)

application/json · object

  • hoststringrequired
  • portintegerrequired

Responses

  • 200Probe result (a failed connection is still 200).
    Response fields

    application/json · object

    • hoststring
    • portinteger
    • reachableboolean
    • latencyMsinteger
    • errorstring
  • 400Invalid body, or host outside the tunnel's remote subnets.

    application/json · ApiError

  • 404Tunnel not found in this workspace.

    application/json · ApiError

  • 409Tunnel is not `ready`.

    application/json · ApiError

  • 501`NOT_CONFIGURED` — the engine is not running on the GKE deployment (GCP_VPN_* env vars unset).

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "10.20.0.15",
  "port": 6661
}'

List tunnel requests on a FortiGate

get/api/fortigate/connections/{id}/provision

The connection's tunnel requests, newest first (50), each with its plan preview and what the caller may do. The pre-shared key is sealed at rest until the request is applied, rejected, cancelled or expires, then discarded (audited as fortigate.provision_psk_discarded); it is never returned or audited.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: listFortigateProvisionRequests

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Responses

  • 200The requests.
    Response fields

    application/json · object

    • allowWritesboolean
    • defaultTcpPortsarray of string

      The engine's MLLP listener ports (the services default).

    • requestsarray of object
      19 fields
      • idstring
      • connectionIdstring
      • orgNamestring
      • phase1Namestring
      • specobject
        17 fields
        • orgNamestring

          The healthcare organization's name.

        • phase1Namestring

          The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

        • peerIpstring

          The healthcare organization's firewall (IPv4).

        • localSubnetsarray of string

          Your side (CIDR), up to 16.

        • remoteSubnetsarray of string

          The healthcare organization's side (CIDR), up to 16.

        • ikeVersioninteger

          1 or 2 (default 2).

        • phase1Proposalsarray of string

          Default ["aes256-sha256"].

        • phase2Proposalsarray of string

          Default ["aes256-sha256"].

        • dhGroupsarray of string

          Default ["14"].

        • keylifeinteger

          Phase 1 key life, seconds (default 28800).

        • keylifeSecondsinteger

          Phase 2 key life, seconds (default 3600).

        • wanInterfacestring

          The internet-facing interface (default "wan1").

        • lanInterfacestring

          The interface your local subnets are on, for the policies (default "internal").

        • blackholeRouteboolean

          Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

        • servicesobject

          What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

          2 fields
          • inboundobject

            From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

            3 fields
            • allboolean

              Allow every service (ALL) instead (default false).

            • tcparray of string

              TCP ports or ranges, e.g. "2575" or "6661-6670".

            • udparray of string

              UDP ports or ranges (default none).

          • outboundobject

            From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

            3 fields
            • allboolean

              Allow every service (ALL) instead (default false).

            • tcparray of string

              TCP ports or ranges, e.g. "2575" or "6661-6670".

            • udparray of string

              UDP ports or ranges (default none).

        • theirMllpPortstring

          The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

        • acknowledgedRoutesarray of string

          The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

      • specHashstring

        The hash of the spec; an approval sends the one the approver reviewed.

      • statusstring

        One of: "requested", "approved", "applying", "applied", "failed", "rejected", "expired", "cancelled"

      • hasKeyboolean

        A sealed key is held (only while requested or approved).

      • keyDiscardedAtstring | null
      • requestedBystring
      • approvedBystring | null
      • rejectedBystring | null
      • appliedBystring | null
      • expiresAtstring
      • resultobject | null
        6 fields
        • okboolean
        • failedAtstring
        • rolledBackboolean

          True only when every object the apply created was removed again.

        • interruptedboolean

          The engine stopped mid-apply; the watcher ended the request.

        • claimLostboolean

          The apply lost its hold on the request mid-way (the watcher ended it as too slow, or its progress couldn't be recorded in time): it sent no further changes and removed what it had created.

        • stepsarray of object
          10 fields
          • idstring
          • labelstring
          • phasestring

            One of: "apply", "rollback"

          • okboolean
          • skippedboolean
          • mkeystring
          • errorstring
          • errorCodestring
          • mayExistboolean

            The write got no answer (a timeout, or the connection broke after sending): the FortiGate may hold the object.

          • notestring

            A remark on a step that worked, e.g. it was never created.

      • leftOnFortigatearray of object

        Objects an apply created and couldn't remove (saved after every write): remove them on the FortiGate.

        5 fields
        • idstring
        • labelstring
        • mkeystring | null
        • undoPathstring | null

          The DELETE path; null when the entry's id is unknown.

        • mayExistboolean

          The write got no answer and the entry has no name to look up: check the FortiGate for it.

      • tunnelIdstring | null

        The tracked tunnel created by a successful apply.

      • planobject
        2 fields
        • stepsarray of object
          8 fields
          • idstring
          • kindstring

            One of: "address", "addrgrp", "phase1", "phase2", "service", "policy", "route", "blackhole"

          • labelstring
          • methodstring
          • pathstring

            The FortiOS REST path.

          • bodyobject

            The JSON body; psksecret masked.

          • clistring

            The equivalent FortiOS CLI.

          • undoobject
            2 fields
            • methodstring
            • pathstring
        • clistring

          Every step's CLI, as one paste.

      • canobject
        4 fields
        • canEditboolean
        • canApproveboolean
        • approveBlockedstring
        • canApplyboolean
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/fortigate/connections/<id>/provision" \
  -H "Authorization: Bearer $TOKEN"

Ask to create a tunnel on a FortiGate

post/api/fortigate/connections/{id}/provision

Stores a request to create one healthcare organization's tunnel (address objects, phase 1 with explicit DPD and NAT-T, phase 2, policies both ways, static and blackhole routes). Nothing is written to the FortiGate: a second admin approves it, then an admin applies it. 403 WRITES_OFF unless the connection allows writes. Needs a signed-in person (403 for API tokens and unidentified callers). FortiGate reads are limited per connection (429 RATE_LIMITED). 409 ACK_REQUIRED (with unacknowledged) when a route overlap or subnet wider than /16 isn't in acknowledgedRoutes. The pre-shared key is sealed at rest until the request is applied, rejected, cancelled or expires, then discarded (audited as fortigate.provision_psk_discarded); it is never returned or audited. Audited as fortigate.provision_requested.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: createFortigateProvisionRequest

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • orgNamestringrequired

    The healthcare organization's name.

  • phase1Namestring

    The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

  • peerIpstringrequired

    The healthcare organization's firewall (IPv4).

  • localSubnetsarray of stringrequired

    Your side (CIDR), up to 16.

  • remoteSubnetsarray of stringrequired

    The healthcare organization's side (CIDR), up to 16.

  • ikeVersioninteger

    1 or 2 (default 2).

  • phase1Proposalsarray of string

    Default ["aes256-sha256"].

  • phase2Proposalsarray of string

    Default ["aes256-sha256"].

  • dhGroupsarray of string

    Default ["14"].

  • keylifeinteger

    Phase 1 key life, seconds (default 28800).

  • keylifeSecondsinteger

    Phase 2 key life, seconds (default 3600).

  • wanInterfacestring

    The internet-facing interface (default "wan1").

  • lanInterfacestring

    The interface your local subnets are on, for the policies (default "internal").

  • blackholeRouteboolean

    Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

  • servicesobject

    What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

    2 fields
    • inboundobject

      From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

      3 fields
      • allboolean

        Allow every service (ALL) instead (default false).

      • tcparray of string

        TCP ports or ranges, e.g. "2575" or "6661-6670".

      • udparray of string

        UDP ports or ranges (default none).

    • outboundobject

      From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

      3 fields
      • allboolean

        Allow every service (ALL) instead (default false).

      • tcparray of string

        TCP ports or ranges, e.g. "2575" or "6661-6670".

      • udparray of string

        UDP ports or ranges (default none).

  • theirMllpPortstring

    The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

  • acknowledgedRoutesarray of string

    The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

  • pskstringrequired

    The pre-shared key (20-128 printable characters, no quotes, backslash or spaces).

Responses

  • 201The request.
    Response fields

    application/json · object

    • idstring
    • connectionIdstring
    • orgNamestring
    • phase1Namestring
    • specobject
      17 fields
      • orgNamestring

        The healthcare organization's name.

      • phase1Namestring

        The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

      • peerIpstring

        The healthcare organization's firewall (IPv4).

      • localSubnetsarray of string

        Your side (CIDR), up to 16.

      • remoteSubnetsarray of string

        The healthcare organization's side (CIDR), up to 16.

      • ikeVersioninteger

        1 or 2 (default 2).

      • phase1Proposalsarray of string

        Default ["aes256-sha256"].

      • phase2Proposalsarray of string

        Default ["aes256-sha256"].

      • dhGroupsarray of string

        Default ["14"].

      • keylifeinteger

        Phase 1 key life, seconds (default 28800).

      • keylifeSecondsinteger

        Phase 2 key life, seconds (default 3600).

      • wanInterfacestring

        The internet-facing interface (default "wan1").

      • lanInterfacestring

        The interface your local subnets are on, for the policies (default "internal").

      • blackholeRouteboolean

        Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

      • servicesobject

        What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

        2 fields
        • inboundobject

          From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

        • outboundobject

          From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

      • theirMllpPortstring

        The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

      • acknowledgedRoutesarray of string

        The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

    • specHashstring

      The hash of the spec; an approval sends the one the approver reviewed.

    • statusstring

      One of: "requested", "approved", "applying", "applied", "failed", "rejected", "expired", "cancelled"

    • hasKeyboolean

      A sealed key is held (only while requested or approved).

    • keyDiscardedAtstring | null
    • requestedBystring
    • approvedBystring | null
    • rejectedBystring | null
    • appliedBystring | null
    • expiresAtstring
    • resultobject | null
      6 fields
      • okboolean
      • failedAtstring
      • rolledBackboolean

        True only when every object the apply created was removed again.

      • interruptedboolean

        The engine stopped mid-apply; the watcher ended the request.

      • claimLostboolean

        The apply lost its hold on the request mid-way (the watcher ended it as too slow, or its progress couldn't be recorded in time): it sent no further changes and removed what it had created.

      • stepsarray of object
        10 fields
        • idstring
        • labelstring
        • phasestring

          One of: "apply", "rollback"

        • okboolean
        • skippedboolean
        • mkeystring
        • errorstring
        • errorCodestring
        • mayExistboolean

          The write got no answer (a timeout, or the connection broke after sending): the FortiGate may hold the object.

        • notestring

          A remark on a step that worked, e.g. it was never created.

    • leftOnFortigatearray of object

      Objects an apply created and couldn't remove (saved after every write): remove them on the FortiGate.

      5 fields
      • idstring
      • labelstring
      • mkeystring | null
      • undoPathstring | null

        The DELETE path; null when the entry's id is unknown.

      • mayExistboolean

        The write got no answer and the entry has no name to look up: check the FortiGate for it.

    • tunnelIdstring | null

      The tracked tunnel created by a successful apply.

    • planobject
      2 fields
      • stepsarray of object
        8 fields
        • idstring
        • kindstring

          One of: "address", "addrgrp", "phase1", "phase2", "service", "policy", "route", "blackhole"

        • labelstring
        • methodstring
        • pathstring

          The FortiOS REST path.

        • bodyobject

          The JSON body; psksecret masked.

        • clistring

          The equivalent FortiOS CLI.

        • undoobject
          2 fields
          • methodstring
          • pathstring
      • clistring

        Every step's CLI, as one paste.

    • canobject
      4 fields
      • canEditboolean
      • canApproveboolean
      • approveBlockedstring
      • canApplyboolean
    • warningsarray of string
    • conflictsarray of string

      Names the FortiGate already has (null when it couldn't be read).

    • readErrorstring | null
    • routeWarningsarray of string

      Active routes (GET monitor/router/ipv4) their subnets overlap: "… overlaps existing route … via …".

    • ackRequiredboolean

      A route overlap or a subnet wider than /16: each needs its key in acknowledgedRoutes.

    • routeKeysarray of string

      The key of each warning that needs acknowledging (overlaps and subnets wider than /16), to put in acknowledgedRoutes.

    • unacknowledgedarray of string

      The keys the request's acknowledgedRoutes doesn't list.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/connections/<id>/provision" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "orgName": "string",
  "phase1Name": "string",
  "peerIp": "string",
  "localSubnets": [
    "string"
  ],
  "remoteSubnets": [
    "string"
  ],
  "ikeVersion": 0,
  "phase1Proposals": [
    "string"
  ],
  "phase2Proposals": [
    "string"
  ],
  "dhGroups": [
    "string"
  ],
  "keylife": 0,
  "keylifeSeconds": 0,
  "wanInterface": "string",
  "lanInterface": "string",
  "blackholeRoute": true,
  "services": {
    "inbound": {
      "all": true,
      "tcp": [
        "string"
      ],
      "udp": [
        "string"
      ]
    },
    "outbound": {
      "all": true,
      "tcp": [
        "string"
      ],
      "udp": [
        "string"
      ]
    }
  },
  "theirMllpPort": "string",
  "acknowledgedRoutes": [
    "string"
  ],
  "psk": "string"
}'

Preview a FortiGate tunnel request

post/api/fortigate/connections/{id}/provision/preview

The ordered FortiOS REST calls (method, path, JSON body with the key masked) and the equivalent CLI, warnings, names the FortiGate already has, active routes their subnets overlap and whether the acknowledgement is needed. Stores nothing, writes nothing. FortiGate reads are limited per connection (429).

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: previewFortigateProvisionRequest

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • orgNamestringrequired

    The healthcare organization's name.

  • phase1Namestring

    The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

  • peerIpstringrequired

    The healthcare organization's firewall (IPv4).

  • localSubnetsarray of stringrequired

    Your side (CIDR), up to 16.

  • remoteSubnetsarray of stringrequired

    The healthcare organization's side (CIDR), up to 16.

  • ikeVersioninteger

    1 or 2 (default 2).

  • phase1Proposalsarray of string

    Default ["aes256-sha256"].

  • phase2Proposalsarray of string

    Default ["aes256-sha256"].

  • dhGroupsarray of string

    Default ["14"].

  • keylifeinteger

    Phase 1 key life, seconds (default 28800).

  • keylifeSecondsinteger

    Phase 2 key life, seconds (default 3600).

  • wanInterfacestring

    The internet-facing interface (default "wan1").

  • lanInterfacestring

    The interface your local subnets are on, for the policies (default "internal").

  • blackholeRouteboolean

    Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

  • servicesobject

    What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

    2 fields
    • inboundobject

      From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

      3 fields
      • allboolean

        Allow every service (ALL) instead (default false).

      • tcparray of string

        TCP ports or ranges, e.g. "2575" or "6661-6670".

      • udparray of string

        UDP ports or ranges (default none).

    • outboundobject

      From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

      3 fields
      • allboolean

        Allow every service (ALL) instead (default false).

      • tcparray of string

        TCP ports or ranges, e.g. "2575" or "6661-6670".

      • udparray of string

        UDP ports or ranges (default none).

  • theirMllpPortstring

    The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

  • acknowledgedRoutesarray of string

    The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

  • pskstring

    The pre-shared key (20-128 printable characters, no quotes, backslash or spaces).

Responses

  • 200The preview.
    Response fields

    application/json · object

    • specobject
      17 fields
      • orgNamestring

        The healthcare organization's name.

      • phase1Namestring

        The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

      • peerIpstring

        The healthcare organization's firewall (IPv4).

      • localSubnetsarray of string

        Your side (CIDR), up to 16.

      • remoteSubnetsarray of string

        The healthcare organization's side (CIDR), up to 16.

      • ikeVersioninteger

        1 or 2 (default 2).

      • phase1Proposalsarray of string

        Default ["aes256-sha256"].

      • phase2Proposalsarray of string

        Default ["aes256-sha256"].

      • dhGroupsarray of string

        Default ["14"].

      • keylifeinteger

        Phase 1 key life, seconds (default 28800).

      • keylifeSecondsinteger

        Phase 2 key life, seconds (default 3600).

      • wanInterfacestring

        The internet-facing interface (default "wan1").

      • lanInterfacestring

        The interface your local subnets are on, for the policies (default "internal").

      • blackholeRouteboolean

        Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

      • servicesobject

        What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

        2 fields
        • inboundobject

          From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

        • outboundobject

          From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

      • theirMllpPortstring

        The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

      • acknowledgedRoutesarray of string

        The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

    • allowWritesboolean
    • planobject
      2 fields
      • stepsarray of object
        8 fields
        • idstring
        • kindstring

          One of: "address", "addrgrp", "phase1", "phase2", "service", "policy", "route", "blackhole"

        • labelstring
        • methodstring
        • pathstring

          The FortiOS REST path.

        • bodyobject

          The JSON body; psksecret masked.

        • clistring

          The equivalent FortiOS CLI.

        • undoobject
          2 fields
          • methodstring
          • pathstring
      • clistring

        Every step's CLI, as one paste.

    • warningsarray of string
    • conflictsarray of string

      Names the FortiGate already has (null when it couldn't be read).

    • readErrorstring | null
    • routeWarningsarray of string

      Active routes (GET monitor/router/ipv4) their subnets overlap: "… overlaps existing route … via …".

    • ackRequiredboolean

      A route overlap or a subnet wider than /16: each needs its key in acknowledgedRoutes.

    • routeKeysarray of string

      The key of each warning that needs acknowledging (overlaps and subnets wider than /16), to put in acknowledgedRoutes.

    • unacknowledgedarray of string

      The keys the request's acknowledgedRoutes doesn't list.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/connections/<id>/provision/preview" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "orgName": "string",
  "phase1Name": "string",
  "peerIp": "string",
  "localSubnets": [
    "string"
  ],
  "remoteSubnets": [
    "string"
  ],
  "ikeVersion": 0,
  "phase1Proposals": [
    "string"
  ],
  "phase2Proposals": [
    "string"
  ],
  "dhGroups": [
    "string"
  ],
  "keylife": 0,
  "keylifeSeconds": 0,
  "wanInterface": "string",
  "lanInterface": "string",
  "blackholeRoute": true,
  "services": {
    "inbound": {
      "all": true,
      "tcp": [
        "string"
      ],
      "udp": [
        "string"
      ]
    },
    "outbound": {
      "all": true,
      "tcp": [
        "string"
      ],
      "udp": [
        "string"
      ]
    }
  },
  "theirMllpPort": "string",
  "acknowledgedRoutes": [
    "string"
  ],
  "psk": "string"
}'

Get a FortiGate tunnel request

get/api/fortigate/provision/{id}

The request, its plan, each applied and rolled-back step's outcome, and what the caller may do; for a waiting or approved request, routeCheck re-reads the FortiGate's routes. The pre-shared key is sealed at rest until the request is applied, rejected, cancelled or expires, then discarded (audited as fortigate.provision_psk_discarded); it is never returned or audited.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: getFortigateProvisionRequest

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Responses

  • 200The request.
    Response fields

    application/json · object

    • idstring
    • connectionIdstring
    • orgNamestring
    • phase1Namestring
    • specobject
      17 fields
      • orgNamestring

        The healthcare organization's name.

      • phase1Namestring

        The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

      • peerIpstring

        The healthcare organization's firewall (IPv4).

      • localSubnetsarray of string

        Your side (CIDR), up to 16.

      • remoteSubnetsarray of string

        The healthcare organization's side (CIDR), up to 16.

      • ikeVersioninteger

        1 or 2 (default 2).

      • phase1Proposalsarray of string

        Default ["aes256-sha256"].

      • phase2Proposalsarray of string

        Default ["aes256-sha256"].

      • dhGroupsarray of string

        Default ["14"].

      • keylifeinteger

        Phase 1 key life, seconds (default 28800).

      • keylifeSecondsinteger

        Phase 2 key life, seconds (default 3600).

      • wanInterfacestring

        The internet-facing interface (default "wan1").

      • lanInterfacestring

        The interface your local subnets are on, for the policies (default "internal").

      • blackholeRouteboolean

        Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

      • servicesobject

        What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

        2 fields
        • inboundobject

          From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

        • outboundobject

          From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

      • theirMllpPortstring

        The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

      • acknowledgedRoutesarray of string

        The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

    • specHashstring

      The hash of the spec; an approval sends the one the approver reviewed.

    • statusstring

      One of: "requested", "approved", "applying", "applied", "failed", "rejected", "expired", "cancelled"

    • hasKeyboolean

      A sealed key is held (only while requested or approved).

    • keyDiscardedAtstring | null
    • requestedBystring
    • approvedBystring | null
    • rejectedBystring | null
    • appliedBystring | null
    • expiresAtstring
    • resultobject | null
      6 fields
      • okboolean
      • failedAtstring
      • rolledBackboolean

        True only when every object the apply created was removed again.

      • interruptedboolean

        The engine stopped mid-apply; the watcher ended the request.

      • claimLostboolean

        The apply lost its hold on the request mid-way (the watcher ended it as too slow, or its progress couldn't be recorded in time): it sent no further changes and removed what it had created.

      • stepsarray of object
        10 fields
        • idstring
        • labelstring
        • phasestring

          One of: "apply", "rollback"

        • okboolean
        • skippedboolean
        • mkeystring
        • errorstring
        • errorCodestring
        • mayExistboolean

          The write got no answer (a timeout, or the connection broke after sending): the FortiGate may hold the object.

        • notestring

          A remark on a step that worked, e.g. it was never created.

    • leftOnFortigatearray of object

      Objects an apply created and couldn't remove (saved after every write): remove them on the FortiGate.

      5 fields
      • idstring
      • labelstring
      • mkeystring | null
      • undoPathstring | null

        The DELETE path; null when the entry's id is unknown.

      • mayExistboolean

        The write got no answer and the entry has no name to look up: check the FortiGate for it.

    • tunnelIdstring | null

      The tracked tunnel created by a successful apply.

    • planobject
      2 fields
      • stepsarray of object
        8 fields
        • idstring
        • kindstring

          One of: "address", "addrgrp", "phase1", "phase2", "service", "policy", "route", "blackhole"

        • labelstring
        • methodstring
        • pathstring

          The FortiOS REST path.

        • bodyobject

          The JSON body; psksecret masked.

        • clistring

          The equivalent FortiOS CLI.

        • undoobject
          2 fields
          • methodstring
          • pathstring
      • clistring

        Every step's CLI, as one paste.

    • canobject
      4 fields
      • canEditboolean
      • canApproveboolean
      • approveBlockedstring
      • canApplyboolean
    • routeCheckobject

      For an open request: the routes their subnets overlap now, from a fresh read (best effort; counts toward the per-connection read limit).

      6 fields
      • checkedboolean

        False when the routes couldn't be read (see error).

      • atstring
      • errorstring
      • routeWarningsarray of string
      • routeKeysarray of string
      • unacknowledgedarray of string

        Warnings the request doesn't acknowledge: the apply would refuse them.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/fortigate/provision/<id>" \
  -H "Authorization: Bearer $TOKEN"

Change a FortiGate tunnel request

patch/api/fortigate/provision/{id}

The whole request again (psk omitted keeps the sealed key). Goes back to requested: a new approval is needed, and the one who changed it can't give it. 409 REQUEST_CLOSED once it has ended. Needs a signed-in person (403 for API tokens and unidentified callers). FortiGate reads are limited per connection (429 RATE_LIMITED). 409 ACK_REQUIRED (with unacknowledged) when a route overlap or subnet wider than /16 isn't in acknowledgedRoutes. Audited as fortigate.provision_changed.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: updateFortigateProvisionRequest

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • orgNamestringrequired

    The healthcare organization's name.

  • phase1Namestring

    The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

  • peerIpstringrequired

    The healthcare organization's firewall (IPv4).

  • localSubnetsarray of stringrequired

    Your side (CIDR), up to 16.

  • remoteSubnetsarray of stringrequired

    The healthcare organization's side (CIDR), up to 16.

  • ikeVersioninteger

    1 or 2 (default 2).

  • phase1Proposalsarray of string

    Default ["aes256-sha256"].

  • phase2Proposalsarray of string

    Default ["aes256-sha256"].

  • dhGroupsarray of string

    Default ["14"].

  • keylifeinteger

    Phase 1 key life, seconds (default 28800).

  • keylifeSecondsinteger

    Phase 2 key life, seconds (default 3600).

  • wanInterfacestring

    The internet-facing interface (default "wan1").

  • lanInterfacestring

    The interface your local subnets are on, for the policies (default "internal").

  • blackholeRouteboolean

    Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

  • servicesobject

    What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

    2 fields
    • inboundobject

      From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

      3 fields
      • allboolean

        Allow every service (ALL) instead (default false).

      • tcparray of string

        TCP ports or ranges, e.g. "2575" or "6661-6670".

      • udparray of string

        UDP ports or ranges (default none).

    • outboundobject

      From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

      3 fields
      • allboolean

        Allow every service (ALL) instead (default false).

      • tcparray of string

        TCP ports or ranges, e.g. "2575" or "6661-6670".

      • udparray of string

        UDP ports or ranges (default none).

  • theirMllpPortstring

    The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

  • acknowledgedRoutesarray of string

    The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

  • pskstring

    The pre-shared key (20-128 printable characters, no quotes, backslash or spaces).

Responses

  • 200The request.
    Response fields

    application/json · object

    • idstring
    • connectionIdstring
    • orgNamestring
    • phase1Namestring
    • specobject
      17 fields
      • orgNamestring

        The healthcare organization's name.

      • phase1Namestring

        The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

      • peerIpstring

        The healthcare organization's firewall (IPv4).

      • localSubnetsarray of string

        Your side (CIDR), up to 16.

      • remoteSubnetsarray of string

        The healthcare organization's side (CIDR), up to 16.

      • ikeVersioninteger

        1 or 2 (default 2).

      • phase1Proposalsarray of string

        Default ["aes256-sha256"].

      • phase2Proposalsarray of string

        Default ["aes256-sha256"].

      • dhGroupsarray of string

        Default ["14"].

      • keylifeinteger

        Phase 1 key life, seconds (default 28800).

      • keylifeSecondsinteger

        Phase 2 key life, seconds (default 3600).

      • wanInterfacestring

        The internet-facing interface (default "wan1").

      • lanInterfacestring

        The interface your local subnets are on, for the policies (default "internal").

      • blackholeRouteboolean

        Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

      • servicesobject

        What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

        2 fields
        • inboundobject

          From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

        • outboundobject

          From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

      • theirMllpPortstring

        The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

      • acknowledgedRoutesarray of string

        The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

    • specHashstring

      The hash of the spec; an approval sends the one the approver reviewed.

    • statusstring

      One of: "requested", "approved", "applying", "applied", "failed", "rejected", "expired", "cancelled"

    • hasKeyboolean

      A sealed key is held (only while requested or approved).

    • keyDiscardedAtstring | null
    • requestedBystring
    • approvedBystring | null
    • rejectedBystring | null
    • appliedBystring | null
    • expiresAtstring
    • resultobject | null
      6 fields
      • okboolean
      • failedAtstring
      • rolledBackboolean

        True only when every object the apply created was removed again.

      • interruptedboolean

        The engine stopped mid-apply; the watcher ended the request.

      • claimLostboolean

        The apply lost its hold on the request mid-way (the watcher ended it as too slow, or its progress couldn't be recorded in time): it sent no further changes and removed what it had created.

      • stepsarray of object
        10 fields
        • idstring
        • labelstring
        • phasestring

          One of: "apply", "rollback"

        • okboolean
        • skippedboolean
        • mkeystring
        • errorstring
        • errorCodestring
        • mayExistboolean

          The write got no answer (a timeout, or the connection broke after sending): the FortiGate may hold the object.

        • notestring

          A remark on a step that worked, e.g. it was never created.

    • leftOnFortigatearray of object

      Objects an apply created and couldn't remove (saved after every write): remove them on the FortiGate.

      5 fields
      • idstring
      • labelstring
      • mkeystring | null
      • undoPathstring | null

        The DELETE path; null when the entry's id is unknown.

      • mayExistboolean

        The write got no answer and the entry has no name to look up: check the FortiGate for it.

    • tunnelIdstring | null

      The tracked tunnel created by a successful apply.

    • planobject
      2 fields
      • stepsarray of object
        8 fields
        • idstring
        • kindstring

          One of: "address", "addrgrp", "phase1", "phase2", "service", "policy", "route", "blackhole"

        • labelstring
        • methodstring
        • pathstring

          The FortiOS REST path.

        • bodyobject

          The JSON body; psksecret masked.

        • clistring

          The equivalent FortiOS CLI.

        • undoobject
          2 fields
          • methodstring
          • pathstring
      • clistring

        Every step's CLI, as one paste.

    • canobject
      4 fields
      • canEditboolean
      • canApproveboolean
      • approveBlockedstring
      • canApplyboolean
    • warningsarray of string
    • conflictsarray of string

      Names the FortiGate already has (null when it couldn't be read).

    • readErrorstring | null
    • routeWarningsarray of string

      Active routes (GET monitor/router/ipv4) their subnets overlap: "… overlaps existing route … via …".

    • ackRequiredboolean

      A route overlap or a subnet wider than /16: each needs its key in acknowledgedRoutes.

    • routeKeysarray of string

      The key of each warning that needs acknowledging (overlaps and subnets wider than /16), to put in acknowledgedRoutes.

    • unacknowledgedarray of string

      The keys the request's acknowledgedRoutes doesn't list.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl -X PATCH "$ENGINE_URL/api/fortigate/provision/<id>" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "orgName": "string",
  "phase1Name": "string",
  "peerIp": "string",
  "localSubnets": [
    "string"
  ],
  "remoteSubnets": [
    "string"
  ],
  "ikeVersion": 0,
  "phase1Proposals": [
    "string"
  ],
  "phase2Proposals": [
    "string"
  ],
  "dhGroups": [
    "string"
  ],
  "keylife": 0,
  "keylifeSeconds": 0,
  "wanInterface": "string",
  "lanInterface": "string",
  "blackholeRoute": true,
  "services": {
    "inbound": {
      "all": true,
      "tcp": [
        "string"
      ],
      "udp": [
        "string"
      ]
    },
    "outbound": {
      "all": true,
      "tcp": [
        "string"
      ],
      "udp": [
        "string"
      ]
    }
  },
  "theirMllpPort": "string",
  "acknowledgedRoutes": [
    "string"
  ],
  "psk": "string"
}'

Cancel a FortiGate tunnel request

delete/api/fortigate/provision/{id}

Ends a waiting or approved request and discards its key. Audited as fortigate.provision_cancelled.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: cancelFortigateProvisionRequest

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Responses

  • 200Cancelled.
    Response fields

    application/json · object

    • cancelledboolean
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

Example request

curl
curl -X DELETE "$ENGINE_URL/api/fortigate/provision/<id>" \
  -H "Authorization: Bearer $TOKEN"

Approve or reject a FortiGate tunnel request

post/api/fortigate/provision/{id}/decision

{ action: approve | reject, specHash, reason? }. Approve: a signed-in admin other than the requester (API tokens can't), on a waiting, unexpired request, sending the specHash of the request as reviewed (409 SPEC_CHANGED when it changed meanwhile); the approval holds 24 h, only for the request as it reads now and only for the FortiGate the connection points at now (a later change to the connection sends it back for a new approval, audited as fortigate.provision_approval_cleared). Reject ends it and discards the key. Audited as fortigate.provision_approved / fortigate.provision_rejected.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: decideFortigateProvisionRequest

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • actionstringrequired

    One of: "approve", "reject"

  • specHashstring

    Required to approve: the request's specHash.

  • reasonstring

Responses

  • 200The request.
    Response fields

    application/json · object

    • idstring
    • connectionIdstring
    • orgNamestring
    • phase1Namestring
    • specobject
      17 fields
      • orgNamestring

        The healthcare organization's name.

      • phase1Namestring

        The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

      • peerIpstring

        The healthcare organization's firewall (IPv4).

      • localSubnetsarray of string

        Your side (CIDR), up to 16.

      • remoteSubnetsarray of string

        The healthcare organization's side (CIDR), up to 16.

      • ikeVersioninteger

        1 or 2 (default 2).

      • phase1Proposalsarray of string

        Default ["aes256-sha256"].

      • phase2Proposalsarray of string

        Default ["aes256-sha256"].

      • dhGroupsarray of string

        Default ["14"].

      • keylifeinteger

        Phase 1 key life, seconds (default 28800).

      • keylifeSecondsinteger

        Phase 2 key life, seconds (default 3600).

      • wanInterfacestring

        The internet-facing interface (default "wan1").

      • lanInterfacestring

        The interface your local subnets are on, for the policies (default "internal").

      • blackholeRouteboolean

        Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

      • servicesobject

        What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

        2 fields
        • inboundobject

          From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

        • outboundobject

          From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

      • theirMllpPortstring

        The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

      • acknowledgedRoutesarray of string

        The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

    • specHashstring

      The hash of the spec; an approval sends the one the approver reviewed.

    • statusstring

      One of: "requested", "approved", "applying", "applied", "failed", "rejected", "expired", "cancelled"

    • hasKeyboolean

      A sealed key is held (only while requested or approved).

    • keyDiscardedAtstring | null
    • requestedBystring
    • approvedBystring | null
    • rejectedBystring | null
    • appliedBystring | null
    • expiresAtstring
    • resultobject | null
      6 fields
      • okboolean
      • failedAtstring
      • rolledBackboolean

        True only when every object the apply created was removed again.

      • interruptedboolean

        The engine stopped mid-apply; the watcher ended the request.

      • claimLostboolean

        The apply lost its hold on the request mid-way (the watcher ended it as too slow, or its progress couldn't be recorded in time): it sent no further changes and removed what it had created.

      • stepsarray of object
        10 fields
        • idstring
        • labelstring
        • phasestring

          One of: "apply", "rollback"

        • okboolean
        • skippedboolean
        • mkeystring
        • errorstring
        • errorCodestring
        • mayExistboolean

          The write got no answer (a timeout, or the connection broke after sending): the FortiGate may hold the object.

        • notestring

          A remark on a step that worked, e.g. it was never created.

    • leftOnFortigatearray of object

      Objects an apply created and couldn't remove (saved after every write): remove them on the FortiGate.

      5 fields
      • idstring
      • labelstring
      • mkeystring | null
      • undoPathstring | null

        The DELETE path; null when the entry's id is unknown.

      • mayExistboolean

        The write got no answer and the entry has no name to look up: check the FortiGate for it.

    • tunnelIdstring | null

      The tracked tunnel created by a successful apply.

    • planobject
      2 fields
      • stepsarray of object
        8 fields
        • idstring
        • kindstring

          One of: "address", "addrgrp", "phase1", "phase2", "service", "policy", "route", "blackhole"

        • labelstring
        • methodstring
        • pathstring

          The FortiOS REST path.

        • bodyobject

          The JSON body; psksecret masked.

        • clistring

          The equivalent FortiOS CLI.

        • undoobject
          2 fields
          • methodstring
          • pathstring
      • clistring

        Every step's CLI, as one paste.

    • canobject
      4 fields
      • canEditboolean
      • canApproveboolean
      • approveBlockedstring
      • canApplyboolean
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/provision/<id>/decision" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "action": "approve",
  "specHash": "string",
  "reason": "string"
}'

Apply an approved FortiGate tunnel request

post/api/fortigate/provision/{id}/apply

Reads the FortiGate's names and active routes first (409 NAME_EXISTS when any the plan creates exists, 409 ACK_REQUIRED naming each current route warning not in acknowledgedRoutes, audited with them; 409 REQUEST_OUTDATED for a request made before the ports were split by direction; nothing written), then creates each object in order; on a failed step deletes what it created, in reverse; anything it couldn't remove is listed in leftOnFortigate (saved after every write, so it survives a restart; an apply that never finished is ended by the watcher, and an apply still running then stops writing and removes what it created: result.claimLost). A POST that gets no answer may have been applied: a named object is deleted by name in the rollback (a 404 means it was never created); a numbered one is listed with mayExist. 200 applied (the tunnel is tracked under "On your FortiGate"), 502 when a step failed (code FORTIGATE_WRITE_FORBIDDEN: the API profile needs read-write permission). Either way the key is discarded. 403 WRITES_OFF, 409 APPROVAL_REQUIRED. Every step and rollback step is audited (fortigate.provision_step, fortigate.provision_rollback_step).

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: applyFortigateProvisionRequest

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Responses

  • 200The request with each step's outcome.
    Response fields

    application/json · object

    • idstring
    • connectionIdstring
    • orgNamestring
    • phase1Namestring
    • specobject
      17 fields
      • orgNamestring

        The healthcare organization's name.

      • phase1Namestring

        The phase 1 (tunnel interface) name, 15 characters at most; mh-<organization> by default.

      • peerIpstring

        The healthcare organization's firewall (IPv4).

      • localSubnetsarray of string

        Your side (CIDR), up to 16.

      • remoteSubnetsarray of string

        The healthcare organization's side (CIDR), up to 16.

      • ikeVersioninteger

        1 or 2 (default 2).

      • phase1Proposalsarray of string

        Default ["aes256-sha256"].

      • phase2Proposalsarray of string

        Default ["aes256-sha256"].

      • dhGroupsarray of string

        Default ["14"].

      • keylifeinteger

        Phase 1 key life, seconds (default 28800).

      • keylifeSecondsinteger

        Phase 2 key life, seconds (default 3600).

      • wanInterfacestring

        The internet-facing interface (default "wan1").

      • lanInterfacestring

        The interface your local subnets are on, for the policies (default "internal").

      • blackholeRouteboolean

        Add a blackhole route (distance 254) per remote subnet, so their traffic is dropped while the tunnel is down (default true).

      • servicesobject

        What each policy allows, per direction: a custom service of these ports, or ALL (an explicit opt-in per direction; the preview says so). Both policies log all traffic.

        2 fields
        • inboundobject

          From the healthcare organization to your network (the <phase1>-in policy, service <phase1>-svc-in). Default: the engine's MLLP listener ports.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

        • outboundobject

          From your network to theirs (the <phase1>-out policy, service <phase1>-svc-out). Default: theirMllpPort.

          3 fields
          • allboolean

            Allow every service (ALL) instead (default false).

          • tcparray of string

            TCP ports or ranges, e.g. "2575" or "6661-6670".

          • udparray of string

            UDP ports or ranges (default none).

      • theirMllpPortstring

        The healthcare organization's MLLP port (or range), e.g. "6661": the outbound default. Required unless services.outbound is given (e.g. { all: true }).

      • acknowledgedRoutesarray of string

        The route warnings the requester checked and wants the tunnel anyway, by key (the preview's routeKeys): "<their subnet> via <route> <gateway/interface>" for an overlap with an active route, "<their subnet> wider than /16". Stored sorted and deduped; part of what the approval covers. Each current warning must be listed, at request time and again at apply.

    • specHashstring

      The hash of the spec; an approval sends the one the approver reviewed.

    • statusstring

      One of: "requested", "approved", "applying", "applied", "failed", "rejected", "expired", "cancelled"

    • hasKeyboolean

      A sealed key is held (only while requested or approved).

    • keyDiscardedAtstring | null
    • requestedBystring
    • approvedBystring | null
    • rejectedBystring | null
    • appliedBystring | null
    • expiresAtstring
    • resultobject | null
      6 fields
      • okboolean
      • failedAtstring
      • rolledBackboolean

        True only when every object the apply created was removed again.

      • interruptedboolean

        The engine stopped mid-apply; the watcher ended the request.

      • claimLostboolean

        The apply lost its hold on the request mid-way (the watcher ended it as too slow, or its progress couldn't be recorded in time): it sent no further changes and removed what it had created.

      • stepsarray of object
        10 fields
        • idstring
        • labelstring
        • phasestring

          One of: "apply", "rollback"

        • okboolean
        • skippedboolean
        • mkeystring
        • errorstring
        • errorCodestring
        • mayExistboolean

          The write got no answer (a timeout, or the connection broke after sending): the FortiGate may hold the object.

        • notestring

          A remark on a step that worked, e.g. it was never created.

    • leftOnFortigatearray of object

      Objects an apply created and couldn't remove (saved after every write): remove them on the FortiGate.

      5 fields
      • idstring
      • labelstring
      • mkeystring | null
      • undoPathstring | null

        The DELETE path; null when the entry's id is unknown.

      • mayExistboolean

        The write got no answer and the entry has no name to look up: check the FortiGate for it.

    • tunnelIdstring | null

      The tracked tunnel created by a successful apply.

    • planobject
      2 fields
      • stepsarray of object
        8 fields
        • idstring
        • kindstring

          One of: "address", "addrgrp", "phase1", "phase2", "service", "policy", "route", "blackhole"

        • labelstring
        • methodstring
        • pathstring

          The FortiOS REST path.

        • bodyobject

          The JSON body; psksecret masked.

        • clistring

          The equivalent FortiOS CLI.

        • undoobject
          2 fields
          • methodstring
          • pathstring
      • clistring

        Every step's CLI, as one paste.

    • canobject
      4 fields
      • canEditboolean
      • canApproveboolean
      • approveBlockedstring
      • canApplyboolean
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 502Error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/provision/<id>/apply" \
  -H "Authorization: Bearer $TOKEN"

List FortiGate connections

get/api/fortigate/connections

The workspace's read-only connections to the customer's own FortiGates (several are allowed: one per box or VDOM). Never the API token.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: listFortigateConnections

Responses

  • 200The connections.
    Response fields

    application/json · object

    • connectionsarray of object
      15 fields
      • idstring
      • namestring
      • kindstring

        fortigate (default: the FortiGate's own REST API) or fortimanager (FortiManager's JSON-RPC API: one connection for every FortiGate it manages, each read through its device proxy).

        One of: "fortigate", "fortimanager"

      • baseUrlstring

        https://host[:port]

      • hoststring
      • vdomstring | null
      • adomstring | null

        FortiManager only.

      • authMethodstring

        FortiManager only: an API key or a login.

        One of: "token", "password"

      • hasTokenboolean

        A token is stored. It is never returned.

      • allowActionsboolean

        Opt-in actions on the FortiGate: operators may bring a tracked tunnel up (POST /api/fortigate/tunnels/{id}/bring-up). Off by default; the REST API admin's profile must allow VPN writes too. Changing it is audited as fortigate.connection_actions_changed.

      • allowWritesboolean

        Admins may provision tunnels on this FortiGate (off by default), each previewed and approved by a second admin.

      • pinnedFingerprint256string

        The pinned certificate, when one is.

      • customCaboolean

        A CA was uploaded.

      • lastTestobject | null
        3 fields
        • atstring
        • okboolean
        • messagestring | null
      • systemobject | null
        4 fields
        • versionstring
        • hostnamestring
        • serialstring
        • modelstring
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/fortigate/connections" \
  -H "Authorization: Bearer $TOKEN"

Add a FortiGate connection

post/api/fortigate/connections

A connection to a FortiGate's REST API (FortiOS 7.0-7.4) with a read-only API token, or (kind fortimanager) to FortiManager's JSON-RPC API with an API key (7.2.2 and later) or a read-only admin's user name and password, and an optional ADOM. Credentials are sealed like adapter credentials and never returned. A private management address must be on SSRF_ALLOWLIST. Creating one sends nothing. Read only toward the FortiGate unless an admin allows it on the connection: allowActions (then only Bring tunnel up) or allowWrites (opt-in provisioning, each change approved by a second admin). Both are off by default and FortiGate only. MedHook never returns a PSK. Audited as fortigate.connection_created.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: createFortigateConnection

Request body (required)

application/json · object

  • namestringrequired
  • baseUrlstringrequired

    https://host[:port]

  • apiTokenstring

    The FortiGate's REST API token, or FortiManager's API key.

  • vdomstring
  • kindstring

    fortigate (default: the FortiGate's own REST API) or fortimanager (FortiManager's JSON-RPC API: one connection for every FortiGate it manages, each read through its device proxy).

    One of: "fortigate", "fortimanager"

  • usernamestring

    FortiManager only: a read-only admin to log in as, with password. Not with apiToken.

  • passwordstring

    FortiManager only: that admin's password. Never returned.

  • adomstring

    FortiManager only: the one ADOM to read; empty reads every FortiGate ADOM.

  • trustFingerprintstring

    The management certificate's SHA-256 fingerprint ("AA:BB:…") to pin: the FortiGate's self-signed default. Check it on the FortiGate first.

  • caPemstring

    A CA certificate (PEM) to verify the management certificate against (host name included). Not with trustFingerprint.

  • allowActionsboolean

    Opt-in actions on the FortiGate: operators may bring a tracked tunnel up (POST /api/fortigate/tunnels/{id}/bring-up). Off by default; the REST API admin's profile must allow VPN writes too. Changing it is audited as fortigate.connection_actions_changed.

Responses

  • 201The connection.
    Response fields

    application/json · object

    • idstring
    • namestring
    • kindstring

      fortigate (default: the FortiGate's own REST API) or fortimanager (FortiManager's JSON-RPC API: one connection for every FortiGate it manages, each read through its device proxy).

      One of: "fortigate", "fortimanager"

    • baseUrlstring

      https://host[:port]

    • hoststring
    • vdomstring | null
    • adomstring | null

      FortiManager only.

    • authMethodstring

      FortiManager only: an API key or a login.

      One of: "token", "password"

    • hasTokenboolean

      A token is stored. It is never returned.

    • allowActionsboolean

      Opt-in actions on the FortiGate: operators may bring a tracked tunnel up (POST /api/fortigate/tunnels/{id}/bring-up). Off by default; the REST API admin's profile must allow VPN writes too. Changing it is audited as fortigate.connection_actions_changed.

    • allowWritesboolean

      Admins may provision tunnels on this FortiGate (off by default), each previewed and approved by a second admin.

    • pinnedFingerprint256string

      The pinned certificate, when one is.

    • customCaboolean

      A CA was uploaded.

    • lastTestobject | null
      3 fields
      • atstring
      • okboolean
      • messagestring | null
    • systemobject | null
      4 fields
      • versionstring
      • hostnamestring
      • serialstring
      • modelstring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/connections" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "baseUrl": "string",
  "apiToken": "string",
  "vdom": "string",
  "kind": "fortigate",
  "username": "string",
  "password": "string",
  "adom": "string",
  "trustFingerprint": "string",
  "caPem": "string",
  "allowActions": true
}'

Test a FortiGate connection

post/api/fortigate/connections/test

Reads GET /api/v2/monitor/system/status and the IPsec tunnels with an unsaved connection ({ baseUrl, apiToken, vdom?, trust }) or a saved one ({ connectionId }, optionally with changes). Always 200: ok with the FortiOS version, host name, serial and tunnel counts, or error { code, message, certificate? } (code CERT_UNTRUSTED carries the presented certificate to check and pin). A FortiManager ({ kind: "fortimanager", ... } or a saved one) answers its own version and host name, devices (each managed FortiGate, its tunnel count and whether it could be read) and unreadDevices. A saved connection tested as stored records the result. Read only toward the FortiGate unless an admin allows it on the connection: allowActions (then only Bring tunnel up) or allowWrites (opt-in provisioning, each change approved by a second admin). Both are off by default and FortiGate only. MedHook never returns a PSK. Audited as fortigate.connection_tested. Rate limited: 10 req / 60 s.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: testFortigateConnection

Request body (required)

application/json · object

  • connectionIdstring
  • baseUrlstring
  • apiTokenstring
  • vdomstring
  • kindstring

    fortigate (default: the FortiGate's own REST API) or fortimanager (FortiManager's JSON-RPC API: one connection for every FortiGate it manages, each read through its device proxy).

    One of: "fortigate", "fortimanager"

  • usernamestring

    FortiManager only: a read-only admin to log in as, with password. Not with apiToken.

  • passwordstring

    FortiManager only: that admin's password. Never returned.

  • adomstring

    FortiManager only: the one ADOM to read; empty reads every FortiGate ADOM.

  • trustFingerprintstring

    The management certificate's SHA-256 fingerprint ("AA:BB:…") to pin: the FortiGate's self-signed default. Check it on the FortiGate first.

  • caPemstring

    A CA certificate (PEM) to verify the management certificate against (host name included). Not with trustFingerprint.

Responses

  • 200The outcome.
    Response fields

    application/json · object

    • okboolean
    • kindstring
    • systemobject
      3 fields
      • versionstring
      • hostnamestring
      • serialstring
    • devicesarray of object
      7 fields
      • namestring
      • adomstring
      • hostnamestring
      • versionstring
      • connectedboolean
      • tunnelsinteger
      • readboolean
    • unreadDevicesarray of string
    • tunnelsinteger
    • upinteger
    • errorobject
      3 fields
      • codestring
      • messagestring
      • certificateobject
        6 fields
        • fingerprint256string
        • subjectstring
        • issuerstring
        • validFromstring
        • validTostring
        • selfSignedboolean
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/connections/test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "connectionId": "string",
  "baseUrl": "string",
  "apiToken": "string",
  "vdom": "string",
  "kind": "fortigate",
  "username": "string",
  "password": "string",
  "adom": "string",
  "trustFingerprint": "string",
  "caPem": "string"
}'

Get a FortiGate connection

get/api/fortigate/connections/{id}

One connection, never the token.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: getFortigateConnection

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Responses

  • 200The connection.
    Response fields

    application/json · object

    • idstring
    • namestring
    • kindstring

      fortigate (default: the FortiGate's own REST API) or fortimanager (FortiManager's JSON-RPC API: one connection for every FortiGate it manages, each read through its device proxy).

      One of: "fortigate", "fortimanager"

    • baseUrlstring

      https://host[:port]

    • hoststring
    • vdomstring | null
    • adomstring | null

      FortiManager only.

    • authMethodstring

      FortiManager only: an API key or a login.

      One of: "token", "password"

    • hasTokenboolean

      A token is stored. It is never returned.

    • allowActionsboolean

      Opt-in actions on the FortiGate: operators may bring a tracked tunnel up (POST /api/fortigate/tunnels/{id}/bring-up). Off by default; the REST API admin's profile must allow VPN writes too. Changing it is audited as fortigate.connection_actions_changed.

    • allowWritesboolean

      Admins may provision tunnels on this FortiGate (off by default), each previewed and approved by a second admin.

    • pinnedFingerprint256string

      The pinned certificate, when one is.

    • customCaboolean

      A CA was uploaded.

    • lastTestobject | null
      3 fields
      • atstring
      • okboolean
      • messagestring | null
    • systemobject | null
      4 fields
      • versionstring
      • hostnamestring
      • serialstring
      • modelstring
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/fortigate/connections/<id>" \
  -H "Authorization: Bearer $TOKEN"

Change a FortiGate connection

patch/api/fortigate/connections/{id}

Any of name, baseUrl, apiToken (omitted keeps the stored one), vdom, allowActions and allowWrites (FortiGate only; opt-in Bring tunnel up and opt-in tunnel provisioning, which need a read-write API profile), and trustFingerprint, caPem or clearTrust: true. A FortiManager connection also takes adom, and username / password (a login instead of a key); its kind can't change. Audited as fortigate.connection_updated with the changed field names (never a credential) and allowWrites' new value; a change of allowActions also as fortigate.connection_actions_changed (the new and previous value).

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: updateFortigateConnection

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • namestring
  • baseUrlstring
  • apiTokenstring
  • vdomstring
  • adomstring

    FortiManager only: the one ADOM to read; empty reads every FortiGate ADOM.

  • usernamestring

    FortiManager only: a read-only admin to log in as, with password. Not with apiToken.

  • passwordstring

    FortiManager only: that admin's password. Never returned.

  • trustFingerprintstring

    The management certificate's SHA-256 fingerprint ("AA:BB:…") to pin: the FortiGate's self-signed default. Check it on the FortiGate first.

  • caPemstring

    A CA certificate (PEM) to verify the management certificate against (host name included). Not with trustFingerprint.

  • clearTrustboolean
  • allowActionsboolean

    Opt-in actions on the FortiGate: operators may bring a tracked tunnel up (POST /api/fortigate/tunnels/{id}/bring-up). Off by default; the REST API admin's profile must allow VPN writes too. Changing it is audited as fortigate.connection_actions_changed.

  • allowWritesboolean

Responses

  • 200The connection.
    Response fields

    application/json · object

    • idstring
    • namestring
    • kindstring

      fortigate (default: the FortiGate's own REST API) or fortimanager (FortiManager's JSON-RPC API: one connection for every FortiGate it manages, each read through its device proxy).

      One of: "fortigate", "fortimanager"

    • baseUrlstring

      https://host[:port]

    • hoststring
    • vdomstring | null
    • adomstring | null

      FortiManager only.

    • authMethodstring

      FortiManager only: an API key or a login.

      One of: "token", "password"

    • hasTokenboolean

      A token is stored. It is never returned.

    • allowActionsboolean

      Opt-in actions on the FortiGate: operators may bring a tracked tunnel up (POST /api/fortigate/tunnels/{id}/bring-up). Off by default; the REST API admin's profile must allow VPN writes too. Changing it is audited as fortigate.connection_actions_changed.

    • allowWritesboolean

      Admins may provision tunnels on this FortiGate (off by default), each previewed and approved by a second admin.

    • pinnedFingerprint256string

      The pinned certificate, when one is.

    • customCaboolean

      A CA was uploaded.

    • lastTestobject | null
      3 fields
      • atstring
      • okboolean
      • messagestring | null
    • systemobject | null
      4 fields
      • versionstring
      • hostnamestring
      • serialstring
      • modelstring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

Example request

curl
curl -X PATCH "$ENGINE_URL/api/fortigate/connections/<id>" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "baseUrl": "string",
  "apiToken": "string",
  "vdom": "string",
  "adom": "string",
  "username": "string",
  "password": "string",
  "trustFingerprint": "string",
  "caPem": "string",
  "clearTrust": true,
  "allowActions": true,
  "allowWrites": true
}'

Delete a FortiGate connection

delete/api/fortigate/connections/{id}

Forgets the connection and its tracked tunnels. Nothing changes on the FortiGate. Audited as fortigate.connection_deleted.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: deleteFortigateConnection

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Responses

  • 200Deleted.
    Response fields

    application/json · object

    • deletedboolean
    • trackedinteger
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

Example request

curl
curl -X DELETE "$ENGINE_URL/api/fortigate/connections/<id>" \
  -H "Authorization: Bearer $TOKEN"

List the FortiGate's IPsec tunnels

get/api/fortigate/connections/{id}/tunnels

Every phase 1 the FortiGate reports (status, peer, phase 2 subnets and traffic), each with tracked (the tracked tunnel's id, or null). Cached 30 s; refresh=1 reads again (at most every 5 s). A failed read answers 502 FORTIGATE_<code> (FORTIGATE_CERT_UNTRUSTED with details.certificate).

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: listFortigateDeviceTunnels

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

refreshquerystring

1 to read the FortiGate again now.

Responses

  • 200The tunnels.
    Response fields

    application/json · object

    • readAtstring
    • tunnelsarray of object
      6 fields
      • namestring
      • statusstring
      • remoteGatewaystring
      • remoteSubnetsarray of string
      • phase2array of object
        8 fields
        • namestring
        • statusstring

          One of: "up", "down"

        • localSubnetsarray of string
        • remoteSubnetsarray of string
        • incomingBytesinteger
        • outgoingBytesinteger
        • remoteSourceobject
          5 fields
          • kindstring

            address-object: resolved from the named address or group; live-selectors: it couldn't be read or resolved, so the IPsec monitor's subnets are used.

            One of: "address-object", "live-selectors"

          • namestring

            The address object (address-object).

          • objectstring

            The address object (live-selectors).

          • reasonstring

            Why the live selectors are used.

          • skippedarray of object
            2 fields
            • namestring
            • reasonstring
        • localSourceobject
          5 fields
          • kindstring

            address-object: resolved from the named address or group; live-selectors: it couldn't be read or resolved, so the IPsec monitor's subnets are used.

            One of: "address-object", "live-selectors"

          • namestring

            The address object (address-object).

          • objectstring

            The address object (live-selectors).

          • reasonstring

            Why the live selectors are used.

          • skippedarray of object
            2 fields
            • namestring
            • reasonstring
      • trackedstring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/fortigate/connections/<id>/tunnels" \
  -H "Authorization: Bearer $TOKEN"

Track FortiGate tunnels

post/api/fortigate/connections/{id}/tunnels

{ tunnels: [{ phase1Name, orgName? }] } (up to 200): each is tracked under its healthcare organization's name (the phase 1 name by default); already tracked ones are skipped. Audited as fortigate.tunnels_imported.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: importFortigateTunnels

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • tunnelsarray of object
    2 fields
    • phase1Namestring

      The phase 1 name as listed (through FortiManager "<device>/<phase 1>").

    • orgNamestring

Responses

  • 201How many were added.
    Response fields

    application/json · object

    • importedinteger
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/connections/<id>/tunnels" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "tunnels": [
    {
      "phase1Name": "string",
      "orgName": "string"
    }
  ]
}'

List tracked FortiGate tunnels

get/api/fortigate/tunnels

The Tunnels page's "On your FortiGate": every connection with its last read's outcome, and every tracked tunnel with status, peer, subnets, phase 2s, traffic, last change, overlapping subnets and its latest tunnel alert. Status changes raise tunnel_events alerts (down after 2 min, degraded, recovered) through the same rules as MedHook tunnels; alert only, no failover. refresh=1 reads again (at most every 5 s per connection).

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: listFortigateTunnels

Parameters

NameInTypeDescription
refreshquerystring

1 to read the FortiGates again now.

Responses

  • 200The tunnels.
    Response fields

    application/json · object

    • connectionsarray of object
      6 fields
      • idstring
      • namestring
      • hoststring
      • kindstring
      • trackedinteger
      • readobject
        3 fields
        • okboolean
        • readAtstring
        • errorobject
          3 fields
          • codestring
          • messagestring
          • certificateobject
            6 fields
            • fingerprint256string
            • subjectstring
            • issuerstring
            • validFromstring
            • validTostring
            • selfSignedboolean
    • tunnelsarray of object
      19 fields
      • idstring
      • orgNamestring

        The healthcare organization's name (the phase 1 name by default).

      • phase1Namestring

        The phase 1 name; through FortiManager "<device>/<phase 1>".

      • devicestring | null

        The managed FortiGate the tunnel lives on (FortiManager connections).

      • connectionobject
        2 fields
        • idstring
        • namestring
      • statusstring

        One of: "up", "partial", "down", "missing", "unknown"

      • statusChangedAtstring | null
      • downSincestring | null
      • lastReadAtstring | null
      • remoteSubnetsarray of string

        The phase 2 remote subnets the FortiGate reports.

      • seenSubnetsarray of string

        The subnets as the engine sees them (NAT); empty: remoteSubnets.

      • subnetsarray of string

        What labels peers and bounds the reachability test.

      • peerstring | null

        The remote gateway.

      • phase2array of object
        8 fields
        • namestring
        • statusstring

          One of: "up", "down"

        • localSubnetsarray of string
        • remoteSubnetsarray of string
        • incomingBytesinteger
        • outgoingBytesinteger
        • remoteSourceobject
          5 fields
          • kindstring

            address-object: resolved from the named address or group; live-selectors: it couldn't be read or resolved, so the IPsec monitor's subnets are used.

            One of: "address-object", "live-selectors"

          • namestring

            The address object (address-object).

          • objectstring

            The address object (live-selectors).

          • reasonstring

            Why the live selectors are used.

          • skippedarray of object
            2 fields
            • namestring
            • reasonstring
        • localSourceobject
          5 fields
          • kindstring

            address-object: resolved from the named address or group; live-selectors: it couldn't be read or resolved, so the IPsec monitor's subnets are used.

            One of: "address-object", "live-selectors"

          • namestring

            The address object (address-object).

          • objectstring

            The address object (live-selectors).

          • reasonstring

            Why the live selectors are used.

          • skippedarray of object
            2 fields
            • namestring
            • reasonstring
      • incomingBytesinteger | null
      • outgoingBytesinteger | null
      • uptimeSecondsinteger | null
      • overlapsarray of object

        Subnets another tunnel (FortiGate or MedHook-managed) also covers: peers there are labeled only when one subnet is more specific.

        2 fields
        • subnetstring
        • witharray of object
          3 fields
          • idstring
          • namestring
          • sourcestring

            fortigate for a tracked FortiGate tunnel.

      • alertobject | null
        6 fields
        • eventstring
        • rulestring
        • dueAtstring
        • sentAtstring
        • mutedReasonstring
        • lastErrorstring
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/fortigate/tunnels" \
  -H "Authorization: Bearer $TOKEN"

Rename a tracked tunnel or set its NATed subnets

patch/api/fortigate/tunnels/{id}

{ orgName?, seenSubnets? }: seenSubnets are the remote subnets as the engine sees them when the FortiGate NATs the organization's (IPv4 CIDRs, up to 32; [] goes back to the FortiGate's). Audited as fortigate.tunnel_updated.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: updateFortigateTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • orgNamestring
  • seenSubnetsarray of string

Responses

  • 200The tunnel.
    Response fields

    application/json · object

    • idstring
    • orgNamestring
    • seenSubnetsarray of string
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

Example request

curl
curl -X PATCH "$ENGINE_URL/api/fortigate/tunnels/<id>" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "orgName": "string",
  "seenSubnets": [
    "string"
  ]
}'

Stop tracking a FortiGate tunnel

delete/api/fortigate/tunnels/{id}

Nothing changes on the FortiGate. Audited as fortigate.tunnel_untracked.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: untrackFortigateTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Responses

  • 200Untracked.
    Response fields

    application/json · object

    • deletedboolean
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

Example request

curl
curl -X DELETE "$ENGINE_URL/api/fortigate/tunnels/<id>" \
  -H "Authorization: Bearer $TOKEN"

Test reachability through a FortiGate tunnel

post/api/fortigate/tunnels/{id}/test

{ host, port }: a TCP connection from the engine to an IPv4 host inside the subnets the engine sees for the tunnel (anything else is a 400). Works when the engine's network routes the subnet to the FortiGate. Audited as fortigate.tunnel_connectivity_tested. Rate limited: 20 req / 60 s.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: testFortigateTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body (required)

application/json · object

  • hoststringrequired
  • portintegerrequired

Responses

  • 200The outcome.
    Response fields

    application/json · object

    • hoststring
    • portinteger
    • reachableboolean
    • latencyMsinteger
    • errorstring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/tunnels/<id>/test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "string",
  "port": 0
}'

Diagnose a FortiGate tunnel

post/api/fortigate/tunnels/{id}/diagnose

Ordered checks, stopping at the first failure: FortiGate answers, FortiGate reports phase 2 up, a route from the engine's network covers each remote subnet (when GCP_PROJECT_ID is set), TCP reachability to { host, port } when given. Audited as fortigate.tunnel_diagnosed. Rate limited: 10 req / 60 s.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: diagnoseFortigateTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body

application/json · object

  • hoststring
  • portinteger

Responses

  • 200The checks.
    Response fields

    application/json · object

    • checksarray of object
      4 fields
      • keystring
      • labelstring
      • statusstring

        One of: "passed", "failed", "skipped"

      • detailstring
    • likelyCausestring | null
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/tunnels/<id>/diagnose" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "string",
  "port": 0
}'

Bring a FortiGate tunnel up

post/api/fortigate/tunnels/{id}/bring-up

Asks the FortiGate to bring up the phase 2 named in phase2, else every phase 2 the last read saw down (all of them when none is), with FortiOS POST /api/v2/monitor/vpn/ipsec/tunnel_up { p1name, p2name }. Only when an admin allowed actions on the tunnel's connection: otherwise 403 FORTIGATE_ACTIONS_OFF. 409 FORTIGATE_PHASE2_UNKNOWN for a phase 2 the tunnel doesn't have (or one never read). The FortiGate refusing is 502: FORTIGATE_ACTION_REFUSED when the API admin's profile is read only for VPN (the message says what to change), FORTIGATE_ACTION_NOT_FOUND on its 404, FORTIGATE_AUTH on a rejected token. Audited as fortigate.tunnel_brought_up with the outcome (success or failure), the phase 2 names and the failure's code. Rate limited: 3 req / 60 s per tunnel and 6 req / 60 s per person (429 RATE_LIMITED).

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: bringUpFortigateTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

The id, in the caller's workspace.

Request body

application/json · object

  • phase2string

Responses

  • 200Asked.
    Response fields

    application/json · object

    • okboolean
    • phase2array of string
    • messagestring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 502Error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/fortigate/tunnels/<id>/bring-up" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "phase2": "string"
}'

IPsec sidecar configuration

get/api/ipsec

The tunnels set in VPN_TUNNELS for the Docker Compose IPsec container, without their pre-shared keys. For GKE tunnels use /api/vpn-tunnels.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getIpsecConfig

Responses

  • 200The configuration.
    Response fields

    application/json · object

    • enabledboolean
    • tunnelsarray of object
      6 fields
      • namestring
      • remoteGatewaystring
      • remoteSubnetsarray of string
      • authTypestring
      • ikeVersioninteger
      • enabledboolean
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/ipsec" \
  -H "Authorization: Bearer $TOKEN"

IPsec sidecar status

get/api/ipsec/status

Whether the IPsec container is set up, from configuration. It does not report live tunnel state.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getIpsecStatus

Responses

  • 200The status.
    Response fields

    application/json · object

    • enabledboolean
    • statusstring
    • tunnelCountinteger
    • tunnelsarray of object
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/ipsec/status" \
  -H "Authorization: Bearer $TOKEN"

Handoff packet

get/api/vpn-tunnels/{id}/packet

The packet you send to the healthcare organization's network engineer, as a PDF, or as JSON with format=json. It never contains the pre-shared key: it says the key arrives by a one-time link. PDF downloads are audited.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getVpnTunnelPacket

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

formatquerystring

json for the same content as JSON.

Responses

  • 200A PDF, or JSON.

    application/pdf · string (binary)

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/packet" \
  -H "Authorization: Bearer $TOKEN"

Send a test HL7 message through a tunnel

post/api/vpn-tunnels/{id}/test-mllp

Sends one synthetic ADT^A01 (MSH-11 is T, with a made-up patient) over MLLP to host:port and reports the ACK and round-trip time. Only IPv4 hosts inside the tunnel's subnets are allowed. Audited.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: testVpnTunnelMllp

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body (required)

application/json · object

  • hoststringrequired
  • portintegerrequired

Responses

  • 200The result, as console lines.

    application/json · object

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/test-mllp" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "string",
  "port": 0
}'

Check a tunnel's subnets before changing them

post/api/vpn-tunnels/{id}/subnet-check

The overlap check a PATCH /api/vpn-tunnels/{id} with these remoteSubnets or localSubnets would get, without changing anything. blocking holds what PATCH would refuse: an overlap with another MedHook tunnel or the cluster's own ranges, a local range on both sides of the tunnel, or a range a VPN tunnel created outside MedHook already routes at this tunnel's priority or better. warnings holds what PATCH would warn about: overlaps with other tunnels' or external tunnels' ranges, the cluster's pod or service ranges, a local range list without the node subnet, or that the external tunnels couldn't be checked (naming roles/compute.networkViewer). Settings › Local ranges calls it while ranges are typed. Not audited. Rate limited: 60 requests per minute.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: checkVpnTunnelSubnets

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body (required)

application/json · object

  • remoteSubnetsarray of string
  • localSubnetsarray of string

    []: the deployment's default local ranges.

Responses

  • 200The check's findings.
    Response fields

    application/json · object

    • blockingarray of objectrequired
      2 fields
      • patharray of string | integerrequired

        ["remoteSubnets", i] or ["localSubnets", i] for one subnet; the field alone for the whole list.

      • messagestringrequired

        What overlaps what, worded for people.

    • warningsarray of objectrequired
      2 fields
      • patharray of string | integerrequired

        ["remoteSubnets", i] or ["localSubnets", i] for one subnet; the field alone for the whole list.

      • messagestringrequired

        What overlaps what, worded for people.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/subnet-check" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "remoteSubnets": [
    "10.20.0.0/24"
  ],
  "localSubnets": [
    "10.250.0.0/24"
  ]
}'

VPN tunnels created outside MedHook

get/api/vpn-tunnels/external

Read only. The Cloud VPN tunnels, Classic and HA, in every region of the engine's GCP project (GCP_PROJECT_ID) that MedHook didn't create, with their gateway, peer IP, remote ranges (Classic) or BGP session (HA): the Tunnels page's "Other VPN tunnels in this project". Tunnels MedHook created are left out: those its database knows (every workspace), those named with this engine's GCP_VPN_NAME_PREFIX, and those labelled managed-by=medhook or medhook-tunnel-id. Nothing here changes GCP. The engine's service account needs compute.vpnTunnels.list, compute.targetVpnGateways.list, compute.vpnGateways.list (all in roles/compute.networkViewer); compute.forwardingRules.list, compute.externalVpnGateways.list, compute.routes.list, compute.routers.list fill in gateway IPs, peer IPs, routes and BGP when granted. A 403 answers permission with the role to grant; any other failure answers error; both with status 200, so the page never fails on it. Cached 60 s per project.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: listExternalVpnTunnels

Responses

  • 200The tunnels.
    Response fields

    application/json · object

    • enabledbooleanrequired

      False when GCP_PROJECT_ID is not set; reason says so.

    • reasonstring
    • tunnelsarray of objectrequired
      13 fields
      • namestringrequired

        The GCP tunnel name.

      • regionstringrequired

        The GCP region, e.g. us-east1.

      • statusstringrequired

        GCP's raw status, e.g. ESTABLISHED, NO_INCOMING_PACKETS.

      • healthstringrequired

        One of: "established", "degraded", "connecting", "down", "unknown"

      • detailedStatusstring

        GCP's detailed status text.

      • peerIpstring | nullrequired

        The peer's public IP.

      • typestringrequired

        Classic VPN or HA VPN.

        One of: "classic", "ha"

      • gatewayobjectrequired
        2 fields
        • namestringrequired

          The Classic target VPN gateway or the HA VPN gateway.

        • ipstring | nullrequired

          The gateway's public IP (Classic: its forwarding rule; HA: the tunnel's interface); null when it couldn't be read.

      • remoteRangesarray of stringrequired

        Classic: the remote traffic selector and the static routes whose next hop is the tunnel. Empty for HA.

      • routesarray of objectrequired

        Classic: the static routes whose next hop is the tunnel, with their priority (lower wins). Empty for HA.

        2 fields
        • destRangestringrequired
        • priorityintegerrequired
      • bgpobject | nullrequired

        HA: the BGP session that carries the routes. Null for Classic.

        3 fields
        • routerstringrequired

          The Cloud Router.

        • peerAsninteger | nullrequired

          The BGP peer's ASN on this tunnel.

        • routerAsninteger | nullrequired

          The Cloud Router's ASN.

      • ikeVersioninteger
      • descriptionstring

        The tunnel's GCP description.

    • permissionobject

      Present when a required list answered 403.

      3 fields
      • rolestringrequired

        The read-only role to grant: roles/compute.networkViewer.

      • missingarray of stringrequired

        The permissions the service account was refused.

      • hintstringrequired

        What to grant, worded for people.

    • errorstring

      Any other failure reading the project; the list is empty.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/external" \
  -H "Authorization: Bearer $TOKEN"

VPN quota preflight

get/api/vpn-tunnels/quota

The engine's GCP project's VPN-related quotas (VPN tunnels, Classic and HA VPN gateways, static external IP addresses and Cloud Routers in the region; routes and peer VPN gateways in the project) against what one more Classic tunnel needs, read through the Compute API (regions.get, projects.get). POST /api/vpn-tunnels runs the same check for the tunnel it creates and answers 409 QUOTA_EXCEEDED when one would be passed. A quota that can't be read answers checked: false. Cloud Router BGP sessions are a per-router limit the API doesn't report, so they aren't listed.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getVpnQuotaPreflight

Responses

  • 200The quotas.
    Response fields

    application/json · object

    • enabledbooleanrequired

      False when VPN management isn't configured.

    • quotaobject
      7 fields
      • checkedbooleanrequired

        False when the quotas couldn't be read; error says why.

      • regionstringrequired
      • consoleUrlstringrequired

        The Cloud console's quota page for the project.

      • linesarray of objectrequired
        7 fields
        • metricstringrequired

          GCP quota metric, e.g. VPN_TUNNELS or ROUTES.

        • labelstring
        • scopestring

          region or project.

        • usageintegerrequired
        • limitintegerrequired
        • needintegerrequired

          What one more tunnel adds.

        • messagestringrequired

          e.g. You have used 7 of 10 VPN tunnels in us-central1; request more in the Cloud console: <link>

      • blockingarray of objectrequired

        Quotas the tunnel would pass: the create is refused (409).

        7 fields
        • metricstringrequired

          GCP quota metric, e.g. VPN_TUNNELS or ROUTES.

        • labelstring
        • scopestring

          region or project.

        • usageintegerrequired
        • limitintegerrequired
        • needintegerrequired

          What one more tunnel adds.

        • messagestringrequired

          e.g. You have used 7 of 10 VPN tunnels in us-central1; request more in the Cloud console: <link>

      • warningsarray of objectrequired

        Quotas the tunnel leaves at 80% or more.

        7 fields
        • metricstringrequired

          GCP quota metric, e.g. VPN_TUNNELS or ROUTES.

        • labelstring
        • scopestring

          region or project.

        • usageintegerrequired
        • limitintegerrequired
        • needintegerrequired

          What one more tunnel adds.

        • messagestringrequired

          e.g. You have used 7 of 10 VPN tunnels in us-central1; request more in the Cloud console: <link>

      • errorstring
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/quota" \
  -H "Authorization: Bearer $TOKEN"

Workflows using a tunnel

get/api/vpn-tunnels/{id}/used-by

Each workflow that sends through the tunnel (a host inside its subnets, directly or through an adapter profile) with its status and its runs in the last 24 h, for the Overview's Used by card. Counts are a bounded 24 h count per workflow; the answer is cached for 60 s per tunnel.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: listVpnTunnelUsedBy

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200The workflows.
    Response fields

    application/json · object

    • workflowsarray of objectrequired
      4 fields
      • workflowIdstringrequired
      • namestringrequired
      • statusstringrequired

        The workflow's status (active, failing, waiting, unapproved, draft, paused).

      • count24hintegerrequired

        Runs in the last 24 h.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/used-by" \
  -H "Authorization: Bearer $TOKEN"

Tunnel audit trail

get/api/vpn-tunnels/{id}/events

What happened to the tunnel (created, key rotated, tested, edited, the watcher's down and recovered), newest first, each with its kind: PSK, MLLP, CONFIG, TUNNEL, IKE or ROUTE. Only the newest diagnosis is listed, so repeated runs don't push out the rest.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: listVpnTunnelEvents

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

limitqueryinteger

Events to return.

Responses

  • 200The events.
    Response fields

    application/json · object

    • eventsarray of object
      6 fields
      • idstringrequired
      • atstring (date-time)required

        When it happened.

      • textstringrequired

        What happened, worded for people. Never a secret.

      • tonestringrequired

        One of: "tx", "mu", "ok", "err", "warn"

      • kindstringrequired

        The Events list's kind column. IKE is a tunnel diagnosis (POST /diagnose), and IKE log lines if the engine ever reads them. ROUTE is a failover, failback, failover test or a static route installed.

        One of: "PSK", "MLLP", "CONFIG", "TUNNEL", "IKE", "ROUTE"

      • diagnosisobject

        Diagnosis rows only: what that run found, so Explain words the event and not today's status.

        2 fields
        • failedAtstring | nullrequired

          The check the run stopped at (peer, init, auth, selectors, mllp); null when it passed.

        • gcpStatusstring | nullrequired

          GCP's status at that run.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/events" \
  -H "Authorization: Bearer $TOKEN"

Tunnel traffic

get/api/vpn-tunnels/{id}/traffic

The last 24 hours of tunnel traffic (24 hourly bars, kbit/s) and uptime from Cloud Monitoring, the MLLP messages per hour through the tunnel (msgsHourly, peakMsgsPerHour, messages24h; only with messages=1, which the Traffic tab sends, otherwise absent; one bounded 24 h count cached 60 s per workflow set), the average MLLP test round trip and how long the current drop has lasted. When Monitoring is not reachable it answers { available: false, reason } with the same stats.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getVpnTunnelTraffic

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

messagesquerystring

1 adds the MLLP message counts (msgsHourly, peakMsgsPerHour, messages24h). Without it the route reads no workflow runs and the three are absent.

Responses

  • 200The traffic.
    Response fields

    application/json · object

    • availablebooleanrequired

      False when Cloud Monitoring has nothing to show; reason says why.

    • reasonstring
    • barsKbpsarray of number

      24 hourly bars.

    • peakKbpsnumber
    • totalBytesnumber
    • uptimeSecondsinteger | null
    • messages24hinteger | null

      Workflow runs that used the tunnel in 24 h (the sum of msgsHourly); null when the counts couldn't be read.

    • msgsHourlyarray of integer | null

      MLLP messages per hour through the tunnel, oldest first (24; the last is the current hour): the runs of the workflows that listen through it. The Traffic bars. Null when the counts couldn't be read.

    • peakMsgsPerHourinteger | null

      The largest hour of msgsHourly.

    • avgRoundTripMsinteger | nullrequired

      Mean round trip of the ok MLLP tests (POST /test-mllp) in the last 24 h; null without one.

    • dropSecondsinteger | nullrequired

      How long the current outage has lasted, from the tunnel watcher; 0 while healthy, null while the tunnel isn't ready.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/traffic" \
  -H "Authorization: Bearer $TOKEN"

Diagnose a tunnel

post/api/vpn-tunnels/{id}/diagnose

Runs the ordered checks on the tunnel's live GCP status (Peer reachable, IKE SA_INIT, IKE AUTH, Traffic selectors or BGP sessions, MLLP round trip) and stops at the first failure; the rest are skipped. The MLLP round trip sends one synthetic ADT^A01 (MSH-11 = T) to target only when every IPsec check passed; the target must be inside the tunnel's subnets. Answers the plain-language explanation too. Never the pre-shared key. Audited as vpn_tunnel.diagnosed.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: diagnoseVpnTunnel

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

  • targetobject
    2 fields
    • hoststringrequired

      IPv4 host inside the tunnel's subnets.

    • portintegerrequired

Responses

  • 200The checks and the explanation.
    Response fields

    application/json · object

    • checksarray of objectrequired
      4 fields
      • idstringrequired

        The check.

        One of: "peer", "init", "auth", "selectors", "mllp"

      • labelstringrequired

        Peer reachable, IKE SA_INIT, IKE AUTH, Traffic selectors (BGP sessions on HA) or MLLP round trip.

      • resultstringrequired

        skip: not run, because an earlier check failed.

        One of: "ok", "err", "skip"

      • detailstringrequired

        What it saw, for example the GCP status and why.

    • failedAtstring | nullrequired

      The check that failed; null when none did.

      One of: "peer", "init", "auth", "selectors", "mllp"

    • explanationobjectrequired
      5 fields
      • statestringrequired

        One of: "established", "degraded", "connecting", "down", "not_ready", "unknown"

      • phasestring

        One of: "ike-phase1", "ike-phase2", "bgp", "traffic"

      • likelyCausestring
      • partnerSideFixstring
      • nextStepstringrequired
    • statusobjectrequired
      2 fields
      • gcpStatusstring | null
      • detailedStatusstring | null
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/diagnose" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "target": {
    "host": "string",
    "port": 1
  }
}'

Read a tunnel's IKE log excerpt

get/api/vpn-tunnels/{id}/ike-log

At most 20 lines of the tunnel's IKE log from Cloud Logging (the Cloud VPN gateway's IKE exchanges), oldest first, between the watcher's downSince minus 30 minutes and now (the last 24 h while the tunnel is not down), filtered to this tunnel by the log entries' tunnel_id label (its GCP names and peer IPs, as whole tokens, in unlabeled entries' text as a fallback). An HA tunnel's lines say their interface and its peer. GCP as initiator and as responder. Each line is rebuilt from known IKE wording, so it never carries the pre-shared key or any other log text; GCP's AUTHENTICATION_FAILED reads AUTHORIZATION_ERROR. Cached 60 s per tunnel. 501 when the install has no Cloud Logging read: the engine's service account needs roles/logging.viewer. Audited as vpn_tunnel.ike_log_read (line count only).

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: getVpnTunnelIkeLog

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200The excerpt and its window.
    Response fields

    application/json · object

    • linesarray of objectrequired
      6 fields
      • tsstringrequired

        When the gateway logged it (ISO 8601).

      • directionstringrequired

        out: MedHook sent it; in: the answer.

        One of: "out", "in"

      • exchangestringrequired

        One of: "IKE_SA_INIT", "IKE_AUTH", "CREATE_CHILD_SA", "INFORMATIONAL"

      • textstringrequired

        For example AUTHORIZATION_ERROR (24), accepted, PSK v3 (the version, never the key) or proposal AES256/SHA256/MODP2048.

      • ifacestring

        HA tunnels only: the interface the line belongs to (by its tunnel_id label, else the name or peer IP it carries).

        One of: "if0", "if1"

      • peerstring

        The peer IP of the line's interface (peerIp2 for an HA tunnel's if1), when the line could be placed.

    • sincestringrequired

      Start of the window (ISO 8601).

    • untilstringrequired

      End of the window (ISO 8601).

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/ike-log" \
  -H "Authorization: Bearer $TOKEN"

Read the tunnel's shared link

get/api/vpn-tunnels/{id}/share

The newest shared link for the healthcare organization's network engineer: its status, recipient, expiry and open count, and the tunnel's access log (an open and a config download within 10 minutes read as one row). Never the token or the URL. To an admin it also answers copyable: whether Copy link can hand out the live link's white-label short URL /t/{code} again. Reading it is not audited; the URL comes only from Copy link's POST /share/copy, which is.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getVpnTunnelShareLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200The link and its access log.
    Response fields

    application/json · object

    • statusstringrequired

      none: no link was ever made for this tunnel.

      One of: "none", "active", "expired", "revoked"

    • recipientstring | nullrequired

      The engineer's email; null when the packet names none.

    • expiresAtstring (date-time) | nullrequired
    • createdAtstring (date-time) | nullrequired
    • openCountintegerrequired

      How often the newest link was opened.

    • accessarray of objectrequired

      The tunnel's access log across its links, newest first (50 rows).

      3 fields
      • atstring (date-time)required

        When, ISO 8601.

      • actionstringrequired

        One of: "created", "opened", "config_downloaded", "psk_revealed", "mllp_tested"

      • textstringrequired

        The access in words, for example "Downloaded Cisco ASA config" or "Pre-shared key revealed (once)".

    • emailedboolean

      The newest link was emailed to its recipient (G-tunnels-13). False with no email channel, no recipient or a failed send.

    • keyLinkboolean

      The newest link is a key link (One-time PSK link, Rotate PSK, Resend link), which is never emailed; the Overview's share notice skips it.

    • urlHoststringrequired

      The host the link is on: the workspace's connect host, else the engine's. Not a credential, so every role gets it, for the masked link.

    • copyableboolean

      Admins (tunnel.manage) only: whether Copy link can hand out the live link's short URL (POST /share/copy). False when it can't be copied again (none live, or made before its token was kept). Absent for viewers and operators. The URL itself is never in this response.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/share" \
  -H "Authorization: Bearer $TOKEN"

Make a new shared link

post/api/vpn-tunnels/{id}/share

Makes a link for the healthcare organization's network engineer (config, the key once, live status and an MLLP test) and revokes the tunnel's old link and its short code. The token is stored AES-256-GCM encrypted beside its SHA-256; the short code only as its SHA-256. The link expires after 7 days. Audited as vpn_tunnel.share_link_created with the recipient's domain only. With a recipient, the link is emailed through the engine's email channel: a PHI-free template, subject "{Brand} · Secure network setup", carrying only the URL and the expiry; audited as vpn_tunnel.share_emailed (or vpn_tunnel.share_email_failed) with the recipient's domain only. Never the pre-shared key.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: createVpnTunnelShareLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

  • recipientstring (email)

    The engineer's email. Defaults to the handoff packet's first email contact.

Responses

  • 201The new link, shown once.
    Response fields

    application/json · object

    • urlstringrequired

      The short URL, https://{connect host}/t/{code}: the workspace's branding connectHost, else the engine's origin. /t/{code} redirects to the engineer page.

    • expiresAtstring (date-time)required
    • recipientstring | nullrequired
    • revokedintegerrequired

      How many live links this one revoked (0 or 1).

    • emailedbooleanrequired

      Emailed to the recipient. False with no email channel, no recipient or a failed send: copy it and send it yourself.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/share" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "recipient": "user@example.test"
}'

Copy the shared link

post/api/vpn-tunnels/{id}/share/copy

Copy link on the Config tab: hands an admin the live link's short URL, the only place it is answered after the link was made, and audits it as vpn_tunnel.share_link_copied (the audit row never holds the URL or its code). Takes no body. 409 when the newest link can't be copied (none live, or made before its token was kept).

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: copyVpnTunnelShareLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200The short URL, handed out and audited.
    Response fields

    application/json · object

    • urlstringrequired

      https://{connect host}/t/{code}: the workspace's branding connectHost, else the engine's origin. /t/{code} redirects to the engineer page.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/share/copy" \
  -H "Authorization: Bearer $TOKEN"

Open the engineer page

get/api/connect/{token}

Public: the shared link's token is the credential. The brand, the healthcare organization, live tunnel status and every vendor's firewall config, never the pre-shared key. Logs the open in the tunnel's access log. no-store, no-referrer, noindex; rate limited per IP.

Auth: None, public route · Operation: getConnectLink

Parameters

NameInTypeDescription
tokenrequiredpathstring

The shared link's token (from /connect/<token>).

Responses

  • 200The engineer page.
    Response fields

    application/json · object

    • statusstringrequired

      One of: "active"

    • previewboolean

      Set on the engineer preview only.

    • brandobjectrequired
      4 fields
      • namestringrequired

        The workspace's brand name; "MedHook" when none is set.

      • colorstring | nullrequired

        #rrggbb, or null for the engine's accent.

      • hasLogobooleanrequired

        A logo was uploaded (GET …/logo).

      • logoHashstring | nullrequired

        The logo's content hash (16 hex of its SHA-256), its ETag; the page asks for …/logo?v={logoHash}. Null without a logo.

    • organizationstring | nullrequired

      The healthcare organization, from the handoff packet.

    • recipientstring | nullrequired

      The engineer the link was sent to.

    • expiresAtstring (date-time) | nullrequired
    • tunnelobjectrequired
      3 fields
      • namestringrequired
      • typestringrequired
      • typeLabelstringrequired

        For example "Classic VPN".

    • liveobjectrequired
      5 fields
      • labelstringrequired

        The tunnel's status in words, for example "Up".

      • tonestringrequired

        One of: "ok", "err", "warn", "accent", "neutral"

      • lastHandshakeAtstring (date-time) | null
      • peerIpstringrequired

        Their firewall's public IP.

      • reachesstring | null

        MedHook's gateway IP.

    • vendorsarray of objectrequired
      2 fields
      • valuestring

        One of: "asa", "strongswan", "pfsense", "fortinet", "ios", "junos", "paloalto"

      • labelstring
    • configsmap of stringrequired

      Each vendor's config text, without the pre-shared key (it says <from the one-time link>).

    • keyobjectrequired
      4 fields
      • revealedbooleanrequired

        The key was already shown on this link.

      • revealedAtstring (date-time) | nullrequired
      • appliesAtstring (date-time)

        A staged rotation's key (G-tunnels-5): when MedHook applies it; enter it then. Absent otherwise.

      • keepVersioninteger

        With appliesAt: the live PSK version the peer keeps until then.

    • targetHintstring

      Test target placeholder, for example "10.20.0.x:port".

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 410The link is used, expired or replaced.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/connect/<token>"

Download a firewall config

get/api/connect/{token}/config

One vendor's config as a file, without the pre-shared key. Logged as "Downloaded {vendor} config".

Auth: None, public route · Operation: downloadConnectConfig

Parameters

NameInTypeDescription
tokenrequiredpathstring

The shared link's token (from /connect/<token>).

formatrequiredquerystring

Vendor format.

Responses

  • 200The config file.

    text/plain · string

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 410The link is used, expired or replaced.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/connect/<token>/config?format=asa"

Reveal the pre-shared key once

post/api/connect/{token}/reveal

Answers the key once per link; a second call gets 410 with status revealed. Audited as vpn_tunnel.share_psk_revealed (never the key) and logged. 409 while the key is being rotated. 403 with ?preview=1, before anything is read, claimed or logged.

Auth: None, public route · Operation: revealConnectKey

Parameters

NameInTypeDescription
tokenrequiredpathstring

The shared link's token (from /connect/<token>).

Responses

  • 200The key, shown once.
    Response fields

    application/json · object

    • sharedSecretstringrequired

      The pre-shared key.

    • pskVersionintegerrequired
  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 410The link is used, expired or replaced.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/connect/<token>/reveal"

Send a test message through the tunnel

post/api/connect/{token}/test-mllp

Sends the synthetic test ADT^A01 (no real patient) to a host inside the tunnel's subnets and answers the console lines; any other host is 400. Logged and audited as vpn_tunnel.share_mllp_tested. 403 with ?preview=1, sending nothing.

Auth: None, public route · Operation: testConnectMllp

Parameters

NameInTypeDescription
tokenrequiredpathstring

The shared link's token (from /connect/<token>).

Request body (required)

application/json · object

  • targetstringrequired

    IPv4 host and port, for example 10.20.0.15:6661.

Responses

  • 200The test's result.
    Response fields

    application/json · object

    • okboolean
    • roundTripMsinteger | null
    • ackobject
      2 fields
      • codestring
      • controlIdstring
    • linesarray of object
      2 fields
      • textstring
      • tonestring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 410The link is used, expired or replaced.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/connect/<token>/test-mllp" \
  -H "Content-Type: application/json" \
  -d '{
  "target": "string"
}'

Refresh the live status strip

get/api/connect/{token}/status

Only the page's live status (tunnel, last handshake, peer, gateway). The page polls it every 20 s while visible; unlike GET /api/connect/{token} it logs no open. Rate limited per IP.

Auth: None, public route · Operation: getConnectStatus

Parameters

NameInTypeDescription
tokenrequiredpathstring

The shared link's token (from /connect/<token>).

Responses

  • 200The live status.
    Response fields

    application/json · object

    • liveobjectrequired
      5 fields
      • labelstringrequired

        The tunnel's status in words, for example "Up".

      • tonestringrequired

        One of: "ok", "err", "warn", "accent", "neutral"

      • lastHandshakeAtstring (date-time) | null
      • peerIpstringrequired

        Their firewall's public IP.

      • reachesstring | null

        MedHook's gateway IP.

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 410The link is used, expired or replaced.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/connect/<token>/status"

Preview the engineer page

get/api/vpn-tunnels/{id}/share/preview

The engineer page's view of this tunnel, as their network engineer sees it, with preview: true. No key, no token, and no access row.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: previewVpnTunnelShareLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200The engineer page.
    Response fields

    application/json · object

    • statusstringrequired

      One of: "active"

    • previewboolean

      Set on the engineer preview only.

    • brandobjectrequired
      4 fields
      • namestringrequired

        The workspace's brand name; "MedHook" when none is set.

      • colorstring | nullrequired

        #rrggbb, or null for the engine's accent.

      • hasLogobooleanrequired

        A logo was uploaded (GET …/logo).

      • logoHashstring | nullrequired

        The logo's content hash (16 hex of its SHA-256), its ETag; the page asks for …/logo?v={logoHash}. Null without a logo.

    • organizationstring | nullrequired

      The healthcare organization, from the handoff packet.

    • recipientstring | nullrequired

      The engineer the link was sent to.

    • expiresAtstring (date-time) | nullrequired
    • tunnelobjectrequired
      3 fields
      • namestringrequired
      • typestringrequired
      • typeLabelstringrequired

        For example "Classic VPN".

    • liveobjectrequired
      5 fields
      • labelstringrequired

        The tunnel's status in words, for example "Up".

      • tonestringrequired

        One of: "ok", "err", "warn", "accent", "neutral"

      • lastHandshakeAtstring (date-time) | null
      • peerIpstringrequired

        Their firewall's public IP.

      • reachesstring | null

        MedHook's gateway IP.

    • vendorsarray of objectrequired
      2 fields
      • valuestring

        One of: "asa", "strongswan", "pfsense", "fortinet", "ios", "junos", "paloalto"

      • labelstring
    • configsmap of stringrequired

      Each vendor's config text, without the pre-shared key (it says <from the one-time link>).

    • keyobjectrequired
      4 fields
      • revealedbooleanrequired

        The key was already shown on this link.

      • revealedAtstring (date-time) | nullrequired
      • appliesAtstring (date-time)

        A staged rotation's key (G-tunnels-5): when MedHook applies it; enter it then. Absent otherwise.

      • keepVersioninteger

        With appliesAt: the live PSK version the peer keeps until then.

    • targetHintstring

      Test target placeholder, for example "10.20.0.x:port".

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/share/preview" \
  -H "Authorization: Bearer $TOKEN"

Read the tunnel's settings

get/api/vpn-tunnels/{id}/settings

Alerts, maintenance windows and failover for the tunnel. A failover pair's switches and last failover test are the pair's: a backup answers its primary's. Inside a maintenance window on either tunnel of a pair the watcher holds (no failover, re-establish or alert); an outage still there when it closes is alerted then.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getVpnTunnelSettings

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200The tunnel's settings.
    Response fields

    application/json · object

    • settingsobjectrequired
      4 fields
      • alertsobjectrequired
        4 fields
        • downboolean

          "Tunnel down for 2 min" (or as long as the watcher takes to confirm, if longer) and its recovery. Sent 2 min after the first bad read; a tunnel back before then never alerts.

        • flappingboolean

          "Flapping: {flapDrops} drops in {flapWindowMinutes} min": the watcher pausing a flapping tunnel (a pause for the hourly action cap always alerts).

        • bgpWithdrawnboolean

          "BGP route withdrawn" (one HA interface down).

        • pskAgeboolean

          "PSK older than 90 days": one alert per PSK version, checked hourly.

      • alertRulesobjectrequired

        The alert rules' fixed numbers.

        4 fields
        • downobject
          1 field
          • minutesinteger

            2.

        • flappingobject
          2 fields
          • dropsinteger

            3.

          • windowMinutesinteger

            10.

        • bgpWithdrawnobject
        • pskAgeobject
          1 field
          • daysinteger

            90.

      • maintenanceWindowsarray of objectrequired
        9 fields
        • idstringrequired

          Unique within the tunnel.

        • kindstringrequired

          One of: "weekly", "once"

        • dayinteger

          weekly: 0 = Sunday … 6 = Saturday.

        • datestring (date)

          once: the start date in the window's zone.

        • startstringrequired

          HH:MM, wall clock in timeZone.

        • endstringrequired

          HH:MM, exclusive. At or before start, the window runs past midnight.

        • timeZonestringrequired

          IANA zone, for example America/Chicago.

        • notestring

          For example "set by Demo Health IT".

        • enabledboolean
      • failoverobjectrequired
        4 fields
        • autoFailoverboolean

          "Fail over to the backup after {thresholds.downAfterSeconds} down".

        • failbackboolean

          "Fail back when the primary is stable for {failbackStableMinutes} min".

        • afterSecondsinteger

          How long the watcher waits before failing over (60 by default): the live TUNNEL_WATCHER_* number, the same as thresholds.downAfterSeconds.

        • failbackStableMinutesinteger

          How long the primary must be stable before failback (5 by default): the live number, the same as thresholds.failbackStableMinutes.

    • pairobject | nullrequired

      The failover pair; null when there is no backup.

      2 fields
      • primarystring
      • backupstring
    • alertRoutesarray of stringrequired

      Who hears the alerts: the workspace's tunnel_events alert rules, as "PagerDuty · Integrations on-call".

    • alertChannelsobjectrequired

      Who hears each alert: every enabled Tunnel events rule of its kind (down → PagerDuty, flapping and BGP → Slack, PSK age → email), else every rule. The sender routes the same way.

      4 fields
      • downobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

      • flappingobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

      • bgpWithdrawnobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

      • pskAgeobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

    • activeWindowstring | nullrequired

      The maintenance window open now, by id.

    • lastFailoverTestobject | nullrequired
      4 fields
      • atstring (date-time)required
      • passedbooleanrequired
      • secondsintegerrequired

        How long the move there and back took.

      • errorstring | nullrequired

        Why it failed, and where the traffic is.

    • thresholdsobjectrequired

      The watcher's numbers, for the labels.

      4 fields
      • downAfterSecondsintegerrequired

        About how long until the watcher confirms an outage (TUNNEL_WATCHER_DOWN_READS × poll).

      • flapDropsintegerrequired

        Drops in the flap window that pause the watcher.

      • flapWindowMinutesintegerrequired
      • failbackStableMinutesintegerrequired

        How long a recovered primary must stay up before it takes traffic back.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/settings" \
  -H "Authorization: Bearer $TOKEN"

Change the tunnel's settings

put/api/vpn-tunnels/{id}/settings

Part of the alerts or failover switches, or the whole maintenance window list; the rules' numbers are fixed. Failover switches need a backup tunnel (409). Audited as vpn_tunnel.settings_updated with the field names only (alerts.flapping, failover.autoFailover, maintenanceWindows).

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: updateVpnTunnelSettings

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body (required)

application/json · object

  • alertsobject
    4 fields
    • downboolean

      "Tunnel down for 2 min" (or as long as the watcher takes to confirm, if longer) and its recovery. Sent 2 min after the first bad read; a tunnel back before then never alerts.

    • flappingboolean

      "Flapping: {flapDrops} drops in {flapWindowMinutes} min": the watcher pausing a flapping tunnel (a pause for the hourly action cap always alerts).

    • bgpWithdrawnboolean

      "BGP route withdrawn" (one HA interface down).

    • pskAgeboolean

      "PSK older than 90 days": one alert per PSK version, checked hourly.

  • maintenanceWindowsarray of object
    9 fields
    • idstringrequired

      Unique within the tunnel.

    • kindstringrequired

      One of: "weekly", "once"

    • dayinteger

      weekly: 0 = Sunday … 6 = Saturday.

    • datestring (date)

      once: the start date in the window's zone.

    • startstringrequired

      HH:MM, wall clock in timeZone.

    • endstringrequired

      HH:MM, exclusive. At or before start, the window runs past midnight.

    • timeZonestringrequired

      IANA zone, for example America/Chicago.

    • notestring

      For example "set by Demo Health IT".

    • enabledboolean
  • failoverobject
    2 fields
    • autoFailoverboolean

      "Fail over to the backup after {thresholds.downAfterSeconds} down".

    • failbackboolean

      "Fail back when the primary is stable for {failbackStableMinutes} min".

Responses

  • 200The saved settings.
    Response fields

    application/json · object

    • settingsobjectrequired
      4 fields
      • alertsobjectrequired
        4 fields
        • downboolean

          "Tunnel down for 2 min" (or as long as the watcher takes to confirm, if longer) and its recovery. Sent 2 min after the first bad read; a tunnel back before then never alerts.

        • flappingboolean

          "Flapping: {flapDrops} drops in {flapWindowMinutes} min": the watcher pausing a flapping tunnel (a pause for the hourly action cap always alerts).

        • bgpWithdrawnboolean

          "BGP route withdrawn" (one HA interface down).

        • pskAgeboolean

          "PSK older than 90 days": one alert per PSK version, checked hourly.

      • alertRulesobjectrequired

        The alert rules' fixed numbers.

        4 fields
        • downobject
          1 field
          • minutesinteger

            2.

        • flappingobject
          2 fields
          • dropsinteger

            3.

          • windowMinutesinteger

            10.

        • bgpWithdrawnobject
        • pskAgeobject
          1 field
          • daysinteger

            90.

      • maintenanceWindowsarray of objectrequired
        9 fields
        • idstringrequired

          Unique within the tunnel.

        • kindstringrequired

          One of: "weekly", "once"

        • dayinteger

          weekly: 0 = Sunday … 6 = Saturday.

        • datestring (date)

          once: the start date in the window's zone.

        • startstringrequired

          HH:MM, wall clock in timeZone.

        • endstringrequired

          HH:MM, exclusive. At or before start, the window runs past midnight.

        • timeZonestringrequired

          IANA zone, for example America/Chicago.

        • notestring

          For example "set by Demo Health IT".

        • enabledboolean
      • failoverobjectrequired
        4 fields
        • autoFailoverboolean

          "Fail over to the backup after {thresholds.downAfterSeconds} down".

        • failbackboolean

          "Fail back when the primary is stable for {failbackStableMinutes} min".

        • afterSecondsinteger

          How long the watcher waits before failing over (60 by default): the live TUNNEL_WATCHER_* number, the same as thresholds.downAfterSeconds.

        • failbackStableMinutesinteger

          How long the primary must be stable before failback (5 by default): the live number, the same as thresholds.failbackStableMinutes.

    • pairobject | nullrequired

      The failover pair; null when there is no backup.

      2 fields
      • primarystring
      • backupstring
    • alertRoutesarray of stringrequired

      Who hears the alerts: the workspace's tunnel_events alert rules, as "PagerDuty · Integrations on-call".

    • alertChannelsobjectrequired

      Who hears each alert: every enabled Tunnel events rule of its kind (down → PagerDuty, flapping and BGP → Slack, PSK age → email), else every rule. The sender routes the same way.

      4 fields
      • downobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

      • flappingobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

      • bgpWithdrawnobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

      • pskAgeobject
        2 fields
        • channelIdsarray of stringrequired

          The Tunnel events alert rules of the switch's kind it goes to, oldest first; empty: every rule (no rule of its kind).

        • labelstringrequired

          Every rule of its kind, joined with " · ": "PagerDuty · Integrations on-call", "#integrations · #ops". The every-rule fallback names the first 2 and "+N more".

    • activeWindowstring | nullrequired

      The maintenance window open now, by id.

    • lastFailoverTestobject | nullrequired
      4 fields
      • atstring (date-time)required
      • passedbooleanrequired
      • secondsintegerrequired

        How long the move there and back took.

      • errorstring | nullrequired

        Why it failed, and where the traffic is.

    • thresholdsobjectrequired

      The watcher's numbers, for the labels.

      4 fields
      • downAfterSecondsintegerrequired

        About how long until the watcher confirms an outage (TUNNEL_WATCHER_DOWN_READS × poll).

      • flapDropsintegerrequired

        Drops in the flap window that pause the watcher.

      • flapWindowMinutesintegerrequired
      • failbackStableMinutesintegerrequired

        How long a recovered primary must stay up before it takes traffic back.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X PUT "$ENGINE_URL/api/vpn-tunnels/<id>/settings" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "alerts": {
    "down": true,
    "flapping": true,
    "bgpWithdrawn": true,
    "pskAge": true
  },
  "maintenanceWindows": [
    {
      "id": "string",
      "kind": "weekly",
      "day": 0,
      "date": "2026-01-01",
      "start": "string",
      "end": "string",
      "timeZone": "string",
      "note": "string",
      "enabled": true
    }
  ],
  "failover": {
    "autoFailover": true,
    "failback": true
  }
}'

Run a failover test

post/api/vpn-tunnels/{id}/failover-test

Moves the pair's live traffic to the standby and back, under the pair's lock and the watcher's lease. A standby that is not established fails the test without moving anything; one that is not established once it has the traffic fails it, and the traffic goes back. A failed test answers 200 with the error. Audited as vpn_tunnel.failover_tested.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: testVpnTunnelFailover

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

Responses

  • 200The test's result.
    Response fields

    application/json · object

    • atstring (date-time)required
    • passedbooleanrequired
    • secondsintegerrequired

      How long the move there and back took.

    • errorstring | nullrequired

      Why it failed, and where the traffic is.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

  • 502Error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/failover-test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Create a one-time key link

post/api/vpn-tunnels/{id}/psk-link

Makes the link that shows the tunnel's pre-shared key once to the network engineer: since G-tunnels-8 the engineer page's shared link, opened as /t/{code} (path; url is absolute, on the workspace's connect host when one is set). It lives 24 h (PSK_LINK_TTL) and replaces the tunnel's live shared link. /psk/<token> links made before keep working until they expire. While a rotation is staged (pskStaged, G-tunnels-5) the link is for the waiting key; resend: true is the rotating banner's Resend link (audited as vpn_tunnel.psk_link_resent) and is a 409 with nothing staged. 409 while GCP applies a key. Audited.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: createVpnPskLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

  • resendboolean

    Re-mint the staged rotation's link; the previous unused one stops working.

Responses

  • 201Created.
    Response fields

    application/json · object

    • pathstringrequired

      The short link's path.

    • urlstringrequired

      The absolute short URL.

    • expiresAtstring (date-time)required
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/psk-link" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "resend": true
}'

Roll back to the previous pre-shared key for 24 h

post/api/vpn-tunnels/{id}/psk-rollback

A rotation keeps the key it replaced, encrypted, for 24 h after GCP accepts the new one; the tunnel's pskRollbackVersion is that version (null when none is kept). This puts it back for 24 h: the tunnel is re-created with it in the background (202, state updating) and the newer key is held ready, so one-time links and the engineer link hand out the newer key. When the 24 h end (pskRollbackUntil) MedHook applies the newer key again and drops the old one. Never returns or logs a key. Audited as vpn_tunnel.psk_rolled_back (versions and end time). 409 when no previous key is kept, a rollback is already running, or the tunnel is busy; 400 for Interconnect.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: rollbackVpnTunnelPsk

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

  • proposalstring

    The signed proposal of the Agent card the rollback was opened from (tunnel.psk-rollback), audited ai.proposal.resolved with the version put back. Not a tunnel field: never stored or echoed.

Responses

  • 202Rolling back: the tunnel with pskVersion set to the previous version and pskRollbackUntil.
    Response fields

    application/json · object

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/psk-rollback" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "proposal": "string"
}'

Rotate the pre-shared key (staged)

post/api/vpn-tunnels/{id}/psk-rotation

Mints the next PSK version and keeps it, encrypted, while GCP keeps the live key for 72 h (pskStaged.overlapUntil); then MedHook applies it, or POST /psk-rotation/apply does it now. Returns the new key's link (path /t/{code}, url, expiresAt: the engineer page's shared link, G-tunnels-8), which replaces the tunnel's live shared link. GCP is not called. Never returns or logs a key. Audited as vpn_tunnel.secret_rotation_started (version, deadline). During a PSK rollback it puts back the held key (pskHeldVersion) the links handed out instead: 202 with reapplied, no new key and no link, the tunnel re-created in the background, audited as vpn_tunnel.psk_rollback_ended (early). 409 when a rotation is staged or the tunnel is busy; 400 for Interconnect.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: startVpnTunnelPskRotation

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

  • proposalstring

    The signed proposal of the Agent card the rotation was opened from, audited ai.proposal.resolved with the staged version; the card reads it in progress until the tunnel is on that version. Not a tunnel field: never stored or echoed.

Responses

  • 201Staged: the tunnel with pskStaged, and the one-time link.
    Response fields

    application/json · object

    • tunnelVpnTunnelrequired
    • pathstringrequired

      The short link's path.

    • urlstringrequired

      The absolute short URL.

    • expiresAtstring (date-time)required
  • 202During a PSK rollback: the held key is live again (re-created in the background); no link.
    Response fields

    application/json · object

    • tunnelVpnTunnelrequired
    • reappliedobjectrequired
      2 fields
      • versionintegerrequired
      • fromintegerrequired
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/psk-rotation" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "proposal": "string"
}'

Cancel a staged PSK rotation

post/api/vpn-tunnels/{id}/psk-rotation/cancel

Drops the staged key and revokes the link the rotation sent if its key wasn't revealed yet (and any unused /psk link from before). The tunnel keeps the live key, which GCP never stopped using. Audited as vpn_tunnel.psk_rotation_cancelled. 409 with nothing staged.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: cancelVpnTunnelPskRotation

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

Responses

  • 200Cancelled: the tunnel with pskStaged null.
    Response fields

    application/json · object

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/psk-rotation/cancel" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Apply a staged PSK now

post/api/vpn-tunnels/{id}/psk-rotation/apply

Gives GCP the staged key before its overlap ends: the tunnel is re-created with it in the background (202, state updating, pskRotationPending true) and the replaced key is kept 24 h for a rollback. The version moves once GCP accepts it. Audited as vpn_tunnel.psk_rotation_applied. 409 with nothing staged or while busy.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: applyVpnTunnelPskRotation

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body

application/json · object

Responses

  • 202Applying: the tunnel being re-created.
    Response fields

    application/json · object

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 501Not available in this deployment.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/psk-rotation/apply" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Read the tunnel's lab link

get/api/vpn-tunnels/{id}/lab

The HL7 lab this tunnel reaches, or null. Never the key: it is sealed at rest and only used for the lab calls.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: getVpnTunnelLabLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200The lab link.
    Response fields

    application/json · object

    • linkobject | nullrequired
      4 fields
      • hoststringrequired

        The lab's IPv4 address, inside the tunnel's remote subnets.

      • portintegerrequired

        The lab's engine access API port.

      • setAtstring (date-time)required

        When it was last set.

      • setBystring | nullrequired

        Who set it (user id).

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/lab" \
  -H "Authorization: Bearer $TOKEN"

Set the tunnel's lab link

put/api/vpn-tunnels/{id}/lab

Sets or replaces the lab link. host must be an IPv4 address inside the tunnel's remote subnets, and not loopback, link-local or the engine's own ranges (400). The key is the one the lab keeps the SHA-256 of; it is encrypted at rest and never returned. Audited as vpn_tunnel.lab_link_set, without the key.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: setVpnTunnelLabLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Request body (required)

application/json · object

  • hoststringrequired

    IPv4 address inside the tunnel's remote subnets.

  • portinteger
  • keystringrequired

    The lab's engine key.

Responses

  • 200The saved lab link.
    Response fields

    application/json · object

    • linkobject | nullrequired
      4 fields
      • hoststringrequired

        The lab's IPv4 address, inside the tunnel's remote subnets.

      • portintegerrequired

        The lab's engine access API port.

      • setAtstring (date-time)required

        When it was last set.

      • setBystring | nullrequired

        Who set it (user id).

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X PUT "$ENGINE_URL/api/vpn-tunnels/<id>/lab" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "string",
  "port": 8090,
  "key": "string"
}'

Clear the tunnel's lab link

delete/api/vpn-tunnels/{id}/lab

Removes the lab link and its key. Audited as vpn_tunnel.lab_link_cleared.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: clearVpnTunnelLabLink

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

Responses

  • 200Cleared.
    Response fields

    application/json · object

    • linkobject | nullrequired
      4 fields
      • hoststringrequired

        The lab's IPv4 address, inside the tunnel's remote subnets.

      • portintegerrequired

        The lab's engine access API port.

      • setAtstring (date-time)required

        When it was last set.

      • setBystring | nullrequired

        Who set it (user id).

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X DELETE "$ENGINE_URL/api/vpn-tunnels/<id>/lab" \
  -H "Authorization: Bearer $TOKEN"

Read from the tunnel's lab

get/api/vpn-tunnels/{id}/lab/{op}

Calls the lab's engine access API through the tunnel and passes its answer on: status (the lab's view of the tunnel, its MLLP listener, the last burst, drills), samples, received (what this engine sent the lab) or round-trips. Only the configured lab address, while it is inside the tunnel's remote subnets (409 LAB_ADDRESS_OUTSIDE_TUNNEL); no redirects, short timeouts, a size cap. A lab that can't be reached or refuses the key is 502 with LAB_TIMEOUT, LAB_UNREACHABLE, LAB_KEY_REFUSED, LAB_ADDRESS_REFUSED, LAB_REDIRECT, LAB_TOO_LARGE or LAB_BAD_RESPONSE; 409 NO_LAB_LINK without a link.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: readVpnTunnelLab

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

oprequiredpathstring

GET: status, samples, received, round-trips. POST: send, burst, burst-stop, drill.

Responses

  • 200The lab's answer.

    application/json · object

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 405Error.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 502Error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/vpn-tunnels/<id>/lab/status" \
  -H "Authorization: Bearer $TOKEN"

Act on the tunnel's lab

post/api/vpn-tunnels/{id}/lab/{op}

send ({ sample | message }: one message with a new control ID; the ACK verdict), burst ({ sample | message, count 1-500, rate 1-50 }, 202; the lab runs one at a time), burst-stop, or drill ({ minutes 1-30 }, 202: the lab takes the tunnel down and brings it back by itself when the time is up; until then this engine can't reach the lab). The lab's own refusals keep their status (400, 409, 429). Audited as vpn_tunnel.lab_sent, lab_burst_started, lab_burst_stopped or lab_drill_started, with counts and minutes, never message content.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: actOnVpnTunnelLab

Parameters

NameInTypeDescription
idrequiredpathstring

Tunnel id.

oprequiredpathstring

GET: status, samples, received, round-trips. POST: send, burst, burst-stop, drill.

Request body

application/json · object

  • samplestring

    A bundled sample's name, e.g. ADT^A01.

  • messagestring

    HL7 v2 text.

  • countinteger
  • rateinteger

    Messages a second.

  • minutesinteger

Responses

  • 200The lab's answer (202 for burst and drill).

    application/json · object

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 405Error.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 502Error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/vpn-tunnels/<id>/lab/status" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "sample": "string",
  "message": "string",
  "count": 1,
  "rate": 1,
  "minutes": 1
}'

Schemas

Named objects the operations above link to.

ApiError

The error body. error is always present. code is present on most errors and is the field to branch on; a few routes and the sign-in and role checks return only error (and sometimes detail).

  • errorstringrequired

    Human-readable error message.

  • codestring

    Machine-readable error code.

    One of: "BAD_REQUEST", "INVALID_REQUEST", "UNAUTHORIZED", "UNAUTHENTICATED", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "UNPROCESSABLE_ENTITY", "RATE_LIMITED", "INTERNAL_ERROR", "SERVICE_UNAVAILABLE", "NOT_CONFIGURED", "SIGNATURE_REQUIRED", "INVALID_SIGNATURE", "TIMESTAMP_REQUIRED", "TIMESTAMP_INVALID", "TIMESTAMP_OUT_OF_TOLERANCE", "INVALID_CREDENTIALS", "INVALID_TOKEN", "PAYLOAD_TOO_LARGE", "INVALID_NDJSON", "PHI_NOT_AUTHORIZED", "PHI_IN_SANDBOX", "IN_PROGRESS", "RETRY_SCHEDULED", "WORKFLOW_DISABLED", "CONFLICTING_SCOPE", "ALREADY_DELIVERED", "CHAIN_TOO_DEEP", "NO_FAILED_DESTINATION", "STALE_SCOPE", "UNKNOWN_DESTINATION", "NO_DESTINATIONS", "NOT_A_MESSAGE", "AI_FEATURES_DISABLED"

  • detailsany

    Optional structured context about the error.

VpnPeerConfig

What the healthcare organization's network engineer enters on their firewall. sharedSecret appears only when it was just generated or reveal=1 was passed.

  • medhookGatewayIpstring
  • medhookSubnetsarray of string
  • yourSubnetsarray of string

    The ranges their side presents. With NAT, the translated ranges.

  • natobject

    Per-tunnel NAT only: the real → translated pairs their firewall maps 1:1 before the tunnel, and a note saying so.

    2 fields
    • mappingsarray of object
      2 fields
      • realstring
      • translatedstring
    • notestring
  • ikeVersioninteger

    One of: 1, 2

  • phase1object
  • phase2object
  • sharedSecretstring

VpnTunnel

  • idstring
  • namestring
  • gcpNamestring
  • peerIpstring
  • remoteSubnetsarray of string

    The ranges GCP routes into the tunnel. For a NAT tunnel these are the translated ranges (see natMappings).

  • natMappingsarray of object | null

    Per-tunnel NAT: each real range of the organization and the unique translated range MedHook routes for it. Destinations use translated addresses. Null without NAT.

    2 fields
    • realstring
    • translatedstring
  • localSubnetsarray of string

    The MedHook side's protected networks this tunnel carries: its own override, else the node subnet plus Terraform's vpn_extra_local_ranges.

  • localSubnetsOverrideboolean

    localSubnets was set for this tunnel.

  • carriesOtherTrafficboolean

    The local ranges go beyond MedHook's node subnet: the tunnel carries other applications' traffic, which MedHook does not audit.

  • ikeVersioninteger

    One of: 1, 2

  • statestring

    One of: "provisioning", "ready", "failed", "deleting", "updating"

  • errorstring | null
  • healthstring | null

    Live GCP status; null unless state is ready. degraded: an HA tunnel with one of its two interfaces (tunnel and BGP session) up.

    One of: "established", "degraded", "connecting", "down", "unknown"

  • gcpStatusstring | null
  • detailedStatusstring | null
  • watchobject | null

    The tunnel watcher's state; null until it has read the tunnel.

    7 fields
    • phasestring
    • lastActionstring | null
    • lastActionAtstring (date-time) | null
    • suppressedUntilstring (date-time) | null
    • lastErrorstring | null
    • lastEstablishedAtstring (date-time) | null

      The last read that found the tunnel up (the Tunnels page's "Last handshake").

    • downSincestring (date-time) | null

      When the current outage started; null while up.

  • createdBystring | null
  • createdAtstring (date-time)
  • updatedAtstring (date-time)
  • pskRollbackVersioninteger | null

    R48b: the previous PSK version POST /psk-rollback would put back (kept 24 h after a rotation); null when none is kept.

  • pskRollbackUntilstring (date-time) | null

    R48b: when the running PSK rollback ends and the newer key is applied again; null when none runs.

  • pskHeldVersioninteger | null

    R48b: while a PSK rollback is set, the newer version held ready (links hand it out; POST /psk-rotation applies it again); null otherwise.

  • pskStagedobject | null

    G-tunnels-5: a staged rotation (never its key): the waiting version, when its one-time link was last sent, and when MedHook applies it (the live key keeps working until then). Null when none is staged.

    3 fields
    • versioninteger
    • linkSentAtstring (date-time) | null
    • overlapUntilstring (date-time)
  • pskLinkSentboolean

    G-tunnels-5: GCP is applying a staged key whose one-time link already went out (Apply now or the scheduled apply), so no new link is needed.

VpnTunnelWithConfig

  • tunnelVpnTunnelrequired
  • peerConfigVpnPeerConfig

    What the healthcare organization's network engineer enters on their firewall. sharedSecret appears only when it was just generated or reveal=1 was passed.