I'm trying to create an AccountBudgetProposal using the Google Ads API 
(v14), but I keep encountering the following error:

Request with ID "xxxx" failed with status "INVALID_ARGUMENT" and includes 
the following errors: Error with message "You are not allowed to make 
changes to budgets." On field: operation  

*Steps I've taken:*

   1. 
   
   *Verified Permissions:*
   - My account has "Standard" access level, which I believe should be 
      sufficient.
      - Confirmed that I have appropriate permissions to make changes to 
      budgets.
   2. 
   
   *Checked Billing Setup Status:*
   - Verified that the billing_setup_id is active and correctly formatted.
      - Used the following code to check the status of the billing setup:
   
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException

def get_billing_setup_status(client, customer_id, billing_setup_id):
    ga_service = client.get_service("GoogleAdsService")

    query = f"""
        SELECT
            billing_setup.id,
            billing_setup.status
        FROM billing_setup
        WHERE billing_setup.resource_name = 
'customers/{customer_id}/billingSetups/{billing_setup_id}'
    """

    try:
        response = ga_service.search(customer_id=customer_id, query=query)
        for row in response:
            billing_setup = row.billing_setup
            status = billing_setup.status
            status_name = 
client.enums.BillingSetupStatusEnum.BillingSetupStatus(status).name
            print(f"Billing setup ID: {billing_setup.id}, Status: 
{status_name}")
            return status_name
    except GoogleAdsException as ex:
        print(f'Request with ID "{ex.request_id}" failed with status 
"{ex.error.code().name}" and includes the following errors:')
        for error in ex.failure.errors:
            print(f'\tError with message "{error.message}".')
            if error.location:
                for field_path_element in 
error.location.field_path_elements:
                    print(f'\t\tOn field: {field_path_element.field_name}')
        return None

if __name__ == "__main__":
    google_ads_client = 
GoogleAdsClient.load_from_storage('path_to_google_ads.yaml', version='v14')
    customer_id = 'your_customer_id'  # Replace with your customer ID
    billing_setup_id = 'your_billing_setup_id'  # Replace with your billing 
setup ID

    billing_setup_status = get_billing_setup_status(google_ads_client, 
customer_id, billing_setup_id)
    if billing_setup_status == "ACTIVE":
        print(f"Billing setup {billing_setup_id} is active.")
    else:
        print(f"Billing setup {billing_setup_id} is not active or not 
found.")
*Creating Account Budget Proposal:*
   
   - Attempted to create the AccountBudgetProposal using the following code:
   
   
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException

def create_account_budget_proposal(client, customer_id, billing_setup_id):
    account_budget_proposal_service = 
client.get_service("AccountBudgetProposalService")

    account_budget_proposal_operation = 
client.get_type("AccountBudgetProposalOperation")
    proposal = account_budget_proposal_operation.create

    proposal.proposal_type = 
client.enums.AccountBudgetProposalTypeEnum.CREATE
    proposal.billing_setup = 
f'customers/{customer_id}/billingSetups/{billing_setup_id}'
    proposal.proposed_name = "Account Budget Proposal (example)"
    proposal.proposed_start_time_type = client.enums.TimeTypeEnum.NOW
    proposal.proposed_end_time_type = client.enums.TimeTypeEnum.FOREVER
    proposal.proposed_spending_limit_micros = 100000000  # Example amount: 
$100,000.00

    try:
        account_budget_proposal_response = 
account_budget_proposal_service.mutate_account_budget_proposals(
            customer_id=customer_id,
            operations=[account_budget_proposal_operation],
        )
        print(f"Created account budget proposal 
'{account_budget_proposal_response.results[0].resource_name}'.")
    except GoogleAdsException as ex:
        print(f'Request with ID "{ex.request_id}" failed with status 
"{ex.error.code().name}" and includes the following errors:')
        for error in ex.failure.errors:
            print(f'\tError with message "{error.message}".')
            if error.location:
                for field_path_element in 
error.location.field_path_elements:
                    print(f'\t\tOn field: {field_path_element.field_name}')
        sys.exit(1)

if __name__ == "__main__":
    google_ads_client = 
GoogleAdsClient.load_from_storage('path_to_google_ads.yaml', version='v14')
    customer_id = 'your_customer_id'  # Replace with your customer ID
    billing_setup_id = 'your_billing_setup_id'  # Replace with your billing 
setup ID

    billing_setup_status = get_billing_setup_status(google_ads_client, 
customer_id, billing_setup_id)
    if billing_setup_status == "ACTIVE":
        create_account_budget_proposal(google_ads_client, customer_id, 
billing_setup_id)
    else:
        print("The billing setup ID is not active or not found. Please 
check the billing setup ID and try again.")

*Questions:*

   1. Are there any specific permissions required beyond "Standard" to make 
   changes to budgets?
   2. Is there any additional configuration needed for billing_setup_id to 
   be accepted?
   3. Could there be any other reason why I am encountering this error 
   despite having the correct permissions and an active billing setup?

Any help or insights would be greatly appreciated. Thank you!

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/0fa8ef42-05d6-47ba-a438-8098118b14b6n%40googlegroups.com.

Reply via email to