RE: performance max: "operation_not_permitted_for_context" when creating campaign using real user account via oauth

50 views
Skip to first unread message
Message has been deleted

Google Ads API Forum Advisor

unread,
Aug 7, 2025, 12:52:24 AMAug 7
to acc...@oneclickads.co, adwor...@googlegroups.com

Hi,

Thank you for contacting the Google Ads API support team.

Please find answers to your queries below: 

1. Is this error caused by using a **test-mode Developer Token** with a **real user account**?

Answer: The OPERATION_NOT_PERMITTED_FOR_CONTEXT error indicates that the operation is not allowed for the given context. Using a developer token with test access level for a production account should result in DEVELOPER_TOKEN_NOT_APPROVED error. But, as per the error you have encountered, it seems to be more related to the operation you are performing.

In order to verify that the operation you are performing is a valid operation or not, we will need to check the complete API logs (request and response with request-id and request header) generated at your end without redacting any information. If you are not able to provide the complete API logs, try to at least provide a request ID for it. If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

2. Do I **need a production-approved Developer Token** to create Performance Max campaigns on real user accounts via OAuth?

Answer: Yes, your understanding is correct. In order to make API calls to the production accounts, you will need a developer token with either ‘Basic Access’ or ‘Standard Access’. The access level controls the number of API calls you can make per day with the token, as well as the environment to which you can make calls. Please refer to this document for more information and to understand how to apply for each access level and their permissible use. In addition to it, you may refer to the Obtain a developer token document for more information.

3. Can I only use the test token with **test accounts** (those with the red "test account" banner)?

Answer: Yes, your understanding is correct. As per the Access Levels section, a developer token with access level as ‘Test account access’ can only access test accounts.

4. Does the real user account require specific permissions or settings to allow campaign creation?

Answer: For campaign creation in a production account using Google Ads API, you just need to follow the prerequisites for using Google Ads API, have a developer token with appropriate access level and should follow the CampaignOperation document in order to know the required fields for campaign creation.

5. Is there any workaround to test the full campaign creation flow (including asset groups and conversion actions) without production token access?

Answer: If you are aiming to manage conversion actions and asset groups in your production account, you need to have a developer token with either Basic or Standard access.

I understand that you are using version v18 of Google Ads API. Please note that the 'v18' is deprecated and is about to sunset in August, 2025. After this date, all v18 API requests will begin to fail. I would suggest you upgrade to the latest version, 'v21', as soon as possible to benefit from new features. You may refer to this documentation on deprecation and sunset for more information regarding the specific deprecation and sunset dates for each available version.

Also, I understand that you are using NodeJS client library for using Google Ads API. Please be informed that as per this documentation, we don't test, contribute to or maintain these libraries. You may use them at your own risk. Any questions you may have should be directed to the owners of the open source projects.

You can send the details via Reply privately to the author option, or direct private reply to this email.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-08-07 04:51:46Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01syNeX:ref" (ADR-00329029)



Message has been deleted

Google Ads API Forum Advisor

unread,
Aug 28, 2025, 9:58:52 AM (11 days ago) Aug 28
to acc...@oneclickads.co, adwor...@googlegroups.com

Hi,

Please find the answers below for your queries.

How do I correctly set up the linkage between a production MCC (with the developer token in Test Access) and a test MCC (with the red banner) so I can use the dev token against the test accounts?

  • A direct "linking" of a production MCC (Manager Account) with a developer token to a test MCC in Google Ads is not possible in the sense of a hierarchical linking like linking sub-accounts. Because test accounts can't interact with your production accounts in any way
  • However, you can use the developer token of your production manager account when making requests against the test manager account. Even if it's not approved yet, the token still works on test accounts, including the ones just created.
  • Kindly refer to this API documentation: Linking to Manager Accounts to link between two Google Ads accounts in the Google Ads API.

Is `OPERATION_NOT_PERMITTED_FOR_CONTEXT` expected if I mistakenly try to create campaigns on a real account using only a test access token?

  • It seems you have encountered a ContextError. That error said, "The operation is not allowed for the given context." However, so our team can better check this concern, could you provide the complete API logs (request and response with request-id and request header) generated at your end and customer-id to further investigate this?
  • Maybe you are creating a campaign in the manager account. Unfortunately, from the Google Ads API's perspective, this is not possible, as creating a campaign is only possible on a client account. This is also the reason why the error occurred.

Could you confirm that the only supported way to create Performance Max campaigns in sandbox is

   - Use a developer token from a production MCC (test access level).

   - But always target customer IDs that belong to a test MCC (red flag)

  • Please note that regarding sandbox testing, it is not specifically mentioned in the API documentation. However, from the Google Ads perspective, you can refer to the Testing API documentation to do full testing of your integration.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-08-28 13:57:53Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01syNeX:ref" (ADR-00329029)



Reply all
Reply to author
Forward
0 new messages