AI-generated Key Takeaways
- 
          The Google Ads API allows linking Google Ads accounts to other product accounts. 
- 
          Account linking can happen through either an invitation flow or a direct linking flow. 
- 
          The invitation flow is used when you have administrator access to only the Google Ads account and involves sending or accepting an invitation. 
- 
          The direct linking flow is used when you have administrator access to both accounts and allows for direct link creation. 
- 
          Users of the deprecated AccountLinkServiceshould migrate toProductLinkServiceor continue usingAccountLinkServicebased on the link type.
The Google Ads API supports linking Google Ads accounts to other product accounts. This guide explains how to use the API to link your accounts.
Ways to link accounts
When linking a Google Ads account to another product account, there are two different ways in which the linking can happen.
Invitation flow
Invitation flow is used when you have administrator access to the Google Ads account, but not the product account. This flow works in two scenarios:
- You want to link the two accounts and create an invitation for an administrator of the product account. The product account administrator accepts the invitation to complete the account linking process.
- The product account administrator wants to link the two accounts, but doesn't have access to the Google Ads account. The product account administrator creates an invitation, and you accept the invitation and complete the linking process.
The following methods are used in this scenario:
| Scenario | Action | Remarks | 
|---|---|---|
| Scenario 1 | Create an invitation | Use the ProductLinkInvitationService.CreateProductLinkInvitationmethod
    to create an invitation. Thestatusof theProductLinkInvitationshouldn't be set; the Google Ads API server
    will set this toREQUESTEDupon the successful completion of
    the API call. | 
| Inspect the status of an invitation | Use GoogleAdsService.SearchorGoogleAdsService.SearchStreamto query theproduct_link_invitationresource and inspect its status. | |
| Scenario 2 | Retrieve an invitation | Use GoogleAdsService.SearchorGoogleAdsService.SearchStreamto query theproduct_link_invitationresource. Filter forstatus = PENDING_APPROVALto accept or reject
    a pending invitation. | 
| Accept or reject an invitation | Use the ProductLinkInvitationService.UpdateProductLinkInvitationmethod to
   update the status of theProductLinkInvitationtoACCEPTEDorREJECTED. | |
| Revoke an invitation | Use the ProductLinkInvitationService.RemoveProductLinkInvitationmethod to
   revoke an existingProductLinkInvitation. | 
The following common errors can be thrown in this workflow:
| Error code | Explanation | 
|---|---|
| ProductLinkInvitationError.PERMISSION_DENIED | The customer doesn't have the permission to perform this action. | 
| ProductLinkError.NO_INVITATION_REQUIRED | An invitation couldn't be created, since the user already has administrator access to the invited account. The user should use the ProductLinkService to directly create an active link. | 
Direct linking flow
Direct linking flow is used when you have administrator access to both the Google Ads account and the product account. In this case, you directly link the Google Ads account to the product account instead of sending an invitation.
The following methods are used in this scenario:
| Action | Remarks | 
|---|---|
| Create an active link | Use ProductLinkService.createProductLinkto create aProductLink. | 
| Disable an active link | Use ProductLinkService.removeProductLinkto remove an
   activeProductLink. | 
| Retrieve active links | Use GoogleAdsService.SearchorGoogleAdsService.SearchStreamto query theproduct_linkresource. | 
The following common errors may be thrown in this workflow:
| Error code | Explanation | 
|---|---|
| 
   ProductLinkError.CREATION_NOT_PERMITTED | An account linking was attempted using the direct link flow, but this
   isn't supported due to lack of permissions. The user should use ProductLinkInvitationServiceto do the invitation flow instead. | 
| 
   ProductLinkError.INVITATION_EXISTS | A link cannot be created because a pending invitation already exists. | 
Changes to AccountLinkService
If you use AccountLinkService to link a Google Ads account to another product
account, you must migrate your existing application to one of the workflows
listed earlier. For the following link types, migrate off AccountLinkService
and use ProductLinkService:
- GoogleAdsIdentifier
- MerchantCenterIdentifier
- AdvertisingPartnerIdentifier
For ThirdPartyAppAnalyticsLinkIdentifier, continue to use
AccountLinkService.