PHP Client for Cloudflare API
Client Reference

Load Balancers

Load balancers distribute traffic across your origin servers to reduce response time and increase availability. A load balancer is scoped to either an account or a zone: pass exactly one of $accountId or $zoneId.

Load balancers distribute traffic across your origin servers to reduce response time and increase availability. A load balancer is scoped to either an account or a zone: pass exactly one of $accountId or $zoneId.

List

List configured load balancers.

ParamTypeRequiredDefaultDescription
accountIdstring|nullNoAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullNoZone Identifier. Provide exactly one of $accountId or $zoneId.
php
$response = $client->loadBalancers()->list('ACCOUNT_ID', 'ZONE_ID');
View this operation on the Cloudflare API Reference

Create

Create a new load balancer.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
valuesarrayYesValues to set on the load balancer, e.g. `name`, `default_pools`, `fallback_pool`.
php
$response = $client->loadBalancers()->create('ACCOUNT_ID', 'ZONE_ID', []);
View this operation on the Cloudflare API Reference

Get

Get a single configured load balancer.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
loadBalancerIdstringYesLoad Balancer Identifier.
php
$response = $client->loadBalancers()->get('ACCOUNT_ID', 'ZONE_ID', 'LOAD_BALANCER_ID');
View this operation on the Cloudflare API Reference

Update

Update an existing load balancer, overwriting the full configuration.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
loadBalancerIdstringYesLoad Balancer Identifier.
valuesarrayYesValues to set on the load balancer, e.g. `name`, `default_pools`, `fallback_pool`.
php
$response = $client->loadBalancers()->update('ACCOUNT_ID', 'ZONE_ID', 'LOAD_BALANCER_ID', []);
View this operation on the Cloudflare API Reference

Edit

Apply changes to an existing load balancer, overwriting only the supplied properties.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
loadBalancerIdstringYesLoad Balancer Identifier.
valuesarrayYesValues to patch on the load balancer.
php
$response = $client->loadBalancers()->edit('ACCOUNT_ID', 'ZONE_ID', 'LOAD_BALANCER_ID', []);
View this operation on the Cloudflare API Reference

Delete

Delete a load balancer.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
loadBalancerIdstringYesLoad Balancer Identifier.
php
$response = $client->loadBalancers()->delete('ACCOUNT_ID', 'ZONE_ID', 'LOAD_BALANCER_ID');
View this operation on the Cloudflare API Reference

Usage

Fetch the current load balancer usage for an account.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
php
$response = $client->loadBalancers()->usage('ACCOUNT_ID');
View this operation on the Cloudflare API Reference
Copyright © 2026