Skip to content
Start here

Update Workers VPC connectivity service

client.connectivity.directory.services.update(stringserviceId, ServiceUpdateParamsparams, RequestOptionsoptions?): ServiceUpdateResponse
PUT/accounts/{account_id}/connectivity/directory/services/{service_id}

Update Workers VPC connectivity service

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
serviceId: string
formatuuid
ServiceUpdateParams = InfraHTTPServiceConfig | InfraTCPServiceConfig
ServiceUpdateParamsBase
InfraHTTPServiceConfig extends ServiceUpdateParamsBase
InfraTCPServiceConfig extends ServiceUpdateParamsBase
ReturnsExpand Collapse
ServiceUpdateResponse = InfraHTTPServiceConfig { host, name, type, 6 more } | InfraTCPServiceConfig { host, name, type, 6 more }
One of the following:
InfraHTTPServiceConfig { host, name, type, 6 more }
host: InfraIPv4Host { ipv4, network } | InfraIPv6Host { ipv6, network } | InfraDualStackHost { ipv4, ipv6, network } | InfraHostnameHost { hostname, resolver_network }
One of the following:
InfraIPv4Host { ipv4, network }
ipv4: string
network: Network { tunnel_id }
tunnel_id: string
formatuuid
InfraIPv6Host { ipv6, network }
ipv6: string
network: Network { tunnel_id }
tunnel_id: string
formatuuid
InfraDualStackHost { ipv4, ipv6, network }
ipv4: string
ipv6: string
network: Network { tunnel_id }
tunnel_id: string
formatuuid
InfraHostnameHost { hostname, resolver_network }
hostname: string
resolver_network: ResolverNetwork { tunnel_id, resolver_ips }
tunnel_id: string
formatuuid
resolver_ips?: Array<string> | null
name: string
type: "tcp" | "http"
One of the following:
"tcp"
"http"
created_at?: string
formatdate-time
http_port?: number | null
formatint32
minimum1
https_port?: number | null
formatint32
minimum1
service_id?: string
formatuuid
tls_settings?: TLSSettings | null

TLS settings for a connectivity service.

If omitted, the default mode (verify_full) is used.

cert_verification_mode: string

TLS certificate verification mode for the connection to the origin.

  • "verify_full" — verify certificate chain and hostname (default)
  • "verify_ca" — verify certificate chain only, skip hostname check
  • "disabled" — do not verify the server certificate at all
updated_at?: string
formatdate-time
InfraTCPServiceConfig { host, name, type, 6 more }
host: InfraIPv4Host { ipv4, network } | InfraIPv6Host { ipv6, network } | InfraDualStackHost { ipv4, ipv6, network } | InfraHostnameHost { hostname, resolver_network }
One of the following:
InfraIPv4Host { ipv4, network }
ipv4: string
network: Network { tunnel_id }
tunnel_id: string
formatuuid
InfraIPv6Host { ipv6, network }
ipv6: string
network: Network { tunnel_id }
tunnel_id: string
formatuuid
InfraDualStackHost { ipv4, ipv6, network }
ipv4: string
ipv6: string
network: Network { tunnel_id }
tunnel_id: string
formatuuid
InfraHostnameHost { hostname, resolver_network }
hostname: string
resolver_network: ResolverNetwork { tunnel_id, resolver_ips }
tunnel_id: string
formatuuid
resolver_ips?: Array<string> | null
name: string
type: "tcp" | "http"
One of the following:
"tcp"
"http"
app_protocol?: "postgresql" | "mysql" | null
One of the following:
"postgresql"
"mysql"
created_at?: string
formatdate-time
service_id?: string
formatuuid
tcp_port?: number | null
formatint32
minimum1
tls_settings?: TLSSettings | null

TLS settings for a connectivity service.

If omitted, the default mode (verify_full) is used.

cert_verification_mode: string

TLS certificate verification mode for the connection to the origin.

  • "verify_full" — verify certificate chain and hostname (default)
  • "verify_ca" — verify certificate chain only, skip hostname check
  • "disabled" — do not verify the server certificate at all
updated_at?: string
formatdate-time

Update Workers VPC connectivity service

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const service = await client.connectivity.directory.services.update(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  {
    account_id: 'account_id',
    host: {
      ipv4: '10.0.0.1',
      network: { tunnel_id: '0191dce4-9ab4-7fce-b660-8e5dec5172da' },
    },
    name: 'postgres-db',
    type: 'tcp',
  },
);

console.log(service);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "host": {
      "ipv4": "10.0.0.1",
      "network": {
        "tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
      }
    },
    "name": "web-app",
    "type": "http",
    "created_at": "2024-01-15T09:30:00Z",
    "http_port": 8080,
    "https_port": 8443,
    "service_id": "550e8400-e29b-41d4-a716-446655440000",
    "tls_settings": {
      "cert_verification_mode": "verify_full"
    },
    "updated_at": "2024-01-15T10:45:00Z"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "host": {
      "ipv4": "10.0.0.1",
      "network": {
        "tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
      }
    },
    "name": "web-app",
    "type": "http",
    "created_at": "2024-01-15T09:30:00Z",
    "http_port": 8080,
    "https_port": 8443,
    "service_id": "550e8400-e29b-41d4-a716-446655440000",
    "tls_settings": {
      "cert_verification_mode": "verify_full"
    },
    "updated_at": "2024-01-15T10:45:00Z"
  }
}