Create Workers VPC connectivity service
POST/accounts/{account_id}/connectivity/directory/services
Create Workers VPC connectivity service
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Create Workers VPC connectivity service
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/connectivity/directory/services \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"host": {
"ipv4": "10.0.0.1",
"network": {
"tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
}
},
"name": "web-app",
"type": "http",
"http_port": 8080,
"https_port": 8443
}'{
"errors": [],
"messages": [],
"result": {
"created_at": "2024-01-15T09:30:00Z",
"host": {
"hostname": "api.example.com",
"resolver_network": {
"tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
}
},
"name": "web-server",
"service_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "http",
"updated_at": "2024-01-15T09:30:00Z"
},
"success": true
}{
"errors": [],
"messages": [],
"result": {
"created_at": "2024-01-15T09:30:00Z",
"host": {
"ipv4": "10.0.0.1",
"network": {
"tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
}
},
"name": "postgres-db",
"service_id": "550e8400-e29b-41d4-a716-446655440001",
"tcp_port": 5432,
"type": "tcp",
"updated_at": "2024-01-15T09:30:00Z"
},
"success": true
}Returns Examples
{
"errors": [],
"messages": [],
"result": {
"created_at": "2024-01-15T09:30:00Z",
"host": {
"hostname": "api.example.com",
"resolver_network": {
"tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
}
},
"name": "web-server",
"service_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "http",
"updated_at": "2024-01-15T09:30:00Z"
},
"success": true
}{
"errors": [],
"messages": [],
"result": {
"created_at": "2024-01-15T09:30:00Z",
"host": {
"ipv4": "10.0.0.1",
"network": {
"tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
}
},
"name": "postgres-db",
"service_id": "550e8400-e29b-41d4-a716-446655440001",
"tcp_port": 5432,
"type": "tcp",
"updated_at": "2024-01-15T09:30:00Z"
},
"success": true
}