A Performance Max campaign requires a
[budget](https://developers.google.com/google-ads/api/docs/campaigns/budgets/create-budgets.md.txt) like all other campaigns,
but with the following restrictions:

- The budget cannot be [shared](https://support.google.com/google-ads/answer/10487241).
- If using an average daily budget, the budget period must be [`DAILY`](https://developers.google.com/google-ads/api/reference/rpc/v26/BudgetPeriodEnum.BudgetPeriod.md.txt#daily).
- If using a campaign total budget, the budget period must be [`CUSTOM_PERIOD`](https://developers.google.com/google-ads/api/reference/rpc/v26/BudgetPeriodEnum.BudgetPeriod.md.txt#custom_period). Campaign total budgets are only available for campaigns with a set start and end date.

Try an [average daily budget](https://support.google.com/google-ads/answer/6385083)
of at least three times your CPA or cost per conversion for the conversion
actions selected for your campaign. Generally, the budget should be consistent
with other well-performing campaigns in your account.
[Learn more](https://support.google.com/google-ads/answer/2375454) about choosing
budget.

If a budget is too low relative to the CPA or cost per conversion, you might
see a slower ramp-up period or fewer conversions over several days.


### Java

```java
/** Creates a MutateOperation that creates a new CampaignBudget. */
private MutateOperation createCampaignBudgetOperation(long customerId) {
  CampaignBudget campaignBudget =
      CampaignBudget.newBuilder()
          .setName("Performance Max campaign budget #" + getPrintableDateTime())
          // The budget period already defaults to DAILY.
          .setAmountMicros(50_000_000)
          .setDeliveryMethod(BudgetDeliveryMethod.STANDARD)
          // A Performance Max campaign cannot use a shared campaign budget.
          .setExplicitlyShared(false)
          // Set a temporary ID in the budget's resource name, so it can be referenced
          // by the campaign in later steps.
          .setResourceName(ResourceNames.campaignBudget(customerId, BUDGET_TEMPORARY_ID))
          .build();

  return MutateOperation.newBuilder()
      .setCampaignBudgetOperation(
          CampaignBudgetOperation.newBuilder().setCreate(campaignBudget).build())
      .build();
}

      
```

### C#

```c#
/// <summary>
/// Creates a MutateOperation that creates a new CampaignBudget.
///
/// A temporary ID will be assigned to this campaign budget so that it can be
/// referenced by other objects being created in the same Mutate request.
/// </summary>
/// <param name="budgetResourceName">The temporary resource name of the budget to
/// create.</param>
/// <returns>A MutateOperation that creates a CampaignBudget.</returns>
private MutateOperation CreateCampaignBudgetOperation(string budgetResourceName)
{
    MutateOperation operation = new MutateOperation
    {
        CampaignBudgetOperation = new CampaignBudgetOperation
        {
            Create = new CampaignBudget
            {
                Name = "Performance Max campaign budget #"
                  + ExampleUtilities.GetRandomString(),

                // The budget period already defaults to DAILY.
                AmountMicros = 50000000,

                // A Performance Max campaign cannot use a shared campaign budget.
                ExplicitlyShared = false,

                // Set a temporary ID in the budget's resource name so it can be referenced
                // by the campaign in later steps.
                ResourceName = budgetResourceName
            }
        }
    };

    return operation;
}

      
```

### PHP

```php
private static function createCampaignBudgetOperation(int $customerId): MutateOperation
{
    // Creates a mutate operation that creates a campaign budget operation.
    return new MutateOperation(
        [
        'campaign_budget_operation' => new CampaignBudgetOperation(
            [
            'create' => new CampaignBudget(
                [
                // Sets a temporary ID in the budget's resource name so it can be referenced
                // by the campaign in later steps.
                'resource_name' => ResourceNames::forCampaignBudget(
                    $customerId,
                    self::BUDGET_TEMPORARY_ID
                ),
                'name' => 'Performance Max campaign budget #' . Helper::getPrintableDatetime(),
                // The budget period already defaults to DAILY.
                'amount_micros' => 50000000,
                'delivery_method' => BudgetDeliveryMethod::STANDARD,
                // A Performance Max campaign cannot use a shared campaign budget.
                'explicitly_shared' => false
                ]
            )
            ]
        )
        ]
    );
}
      
```

### Python

```python
def create_campaign_budget_operation(
    client: GoogleAdsClient,
    customer_id: str,
) -> MutateOperation:
    """Creates a MutateOperation that creates a new CampaignBudget.

    A temporary ID will be assigned to this campaign budget so that it can be
    referenced by other objects being created in the same Mutate request.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a client customer ID.

    Returns:
        a MutateOperation that creates a CampaignBudget.
    """
    mutate_operation: MutateOperation = client.get_type("MutateOperation")
    campaign_budget_operation: CampaignBudgetOperation = (
        mutate_operation.campaign_budget_operation
    )
    campaign_budget: CampaignBudget = campaign_budget_operation.create
    campaign_budget.name = f"Performance Max campaign budget #{uuid4()}"
    # The budget period already defaults to DAILY.
    campaign_budget.amount_micros = 50000000
    campaign_budget.delivery_method = (
        client.enums.BudgetDeliveryMethodEnum.STANDARD
    )
    # A Performance Max campaign cannot use a shared campaign budget.
    campaign_budget.explicitly_shared = False

    # Set a temporary ID in the budget's resource name so it can be referenced
    # by the campaign in later steps.
    campaign_budget.resource_name = client.get_service(
        "CampaignBudgetService"
    ).campaign_budget_path(customer_id, _BUDGET_TEMPORARY_ID)

    return mutate_operation
      
```

### Ruby

```ruby
# Creates a MutateOperation that creates a new CampaignBudget.
#
# A temporary ID will be assigned to this campaign budget so that it can be
# referenced by other objects being created in the same Mutate request.
def create_campaign_budget_operation(client, customer_id)
  client.operation.mutate do |m|
    m.campaign_budget_operation = client.operation.create_resource.campaign_budget do |cb|
      cb.name = "Performance Max campaign budget #{SecureRandom.uuid}"
      # The budget period already defaults to DAILY.
      cb.amount_micros = 50_000_000
      cb.delivery_method = :STANDARD
        # A Performance Max campaign cannot use a shared campaign budget.
        cb.explicitly_shared = false

      # Set a temporary ID in the budget's resource name so it can be referenced
      # by the campaign in later steps.
      cb.resource_name = client.path.campaign_budget(customer_id, BUDGET_TEMPORARY_ID)
    end
  end
end
      
```

### Perl

```perl
sub create_campaign_budget_operation {
  my ($customer_id) = @_;

  # Create a mutate operation that creates a campaign budget operation.
  return
    Google::Ads::GoogleAds::V26::Services::GoogleAdsService::MutateOperation->
    new({
      campaignBudgetOperation =>
        Google::Ads::GoogleAds::V26::Services::CampaignBudgetService::CampaignBudgetOperation
        ->new({
          create => Google::Ads::GoogleAds::V26::Resources::CampaignBudget->new(
            {
              # Set a temporary ID in the budget's resource name so it can be
              # referenced by the campaign in later steps.
              resourceName =>
                Google::Ads::GoogleAds::V26::Utils::ResourceNames::campaign_budget(
                $customer_id, BUDGET_TEMPORARY_ID
                ),
              name => "Performance Max campaign budget #" . uniqid(),
              # The budget period already defaults to DAILY.
              amountMicros   => 50000000,
              deliveryMethod => STANDARD,
              # A Performance Max campaign cannot use a shared campaign budget.
              explicitlyShared => "false",
            })})});
}
      
```

### curl

> [!NOTE]
> **Note:** While a direct REST code sample for this step isn't provided here, you can achieve this using a manual REST request.   
>
> Refer to the Google Ads API REST interface documentation and the method-specific reference pages. You will need to construct the JSON payload based on the proto definitions.   
>
> Key Resources:
>
> - [Using REST](https://developers.google.com/google-ads/api/rest/overview.md.txt)
> - [REST Interface Structure](https://developers.google.com/google-ads/api/rest/design/overview.md.txt)
> - [JSON Field Mappings](https://developers.google.com/google-ads/api/rest/design/json-mappings.md.txt)
> - Consult the [REST API Reference](https://developers.google.com/google-ads/api/reference/rpc/latest/overview) for the specific service and method.

<br />