rocket
Merchant API
– der offizielle Nachfolger der Content API for Shopping.
add_alert
Hinweis: Die Content API for Shopping wird am 18. August 2026 eingestellt.
Dienstkonten
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Dienstkonten sind spezielle Google-Konten, die von Anwendungen verwendet werden können, um programmatisch über OAuth 2.0 auf Google APIs zuzugreifen. Ein Dienstkonto verwendet einen OAuth 2.0-Vorgang, der keine manuelle Autorisierung erfordert.
Stattdessen wird eine Schlüsseldatei verwendet, auf die nur Ihre Anwendung zugreifen kann. In diesem Leitfaden erfahren Sie, wie Sie mit Dienstkonten auf die Content API for Shopping zugreifen.
Hinweis:Anwendungen, die für die Authentifizierung Dienstkonten verwenden, können nur auf Ihr eigenes Merchant Center-Konto zugreifen. Wenn Sie eine Drittanbieteranwendung entwickeln, die Zugriff auf die Merchant Center-Konten Ihrer Kunden benötigt, lesen Sie stattdessen den Leitfaden Anfragen autorisieren.
Vorbereitung
Schritte zum Zugriff auf die Content API for Shopping über ein Dienstkonto
- Generieren Sie Anmeldedaten für ein Dienstkonto oder greifen Sie auf die bereits generierten öffentlichen Anmeldedaten zu. Du musst eine OAuth 2.0-Client-ID erstellen und eine private *.json-Schlüsseldatei abrufen:
- Gehen Sie zur Google API Console.
- Wählen Sie oben auf der Seite im Drop-down-Menü ein Projekt aus. Falls Sie noch kein Projekt haben, erstellen Sie eines. Klicken Sie dazu auf NEUES PROJEKT.
- Wenn Sie die Content API for Shopping für dieses Projekt noch nicht aktiviert haben, suchen Sie in der Liste der Google APIs danach und aktivieren Sie sie.
- Wähle in der Seitenleiste links Anmeldedaten aus.
Möglicherweise müssen Sie oben links auf den nach links weisenden Pfeil klicken, um diese Option zu sehen.
- Wählen Sie zum Einrichten eines Dienstkontos ANMELDEDATEN ERSTELLEN und dann Dienstkonto aus.
- Geben Sie dem neuen Dienstkonto einen Namen. Dieser dient auch als Standardnutzername für die Dienstkonto-ID. Notieren Sie sich die Dienstkonto-ID, einschließlich des Teils nach dem Zeichen „@“, für später. Klicken Sie auf ERSTELLEN und führen Sie dann die optionalen Schritte aus, um Zugriff auf das Projekt und die Nutzer zu gewähren. Klicken Sie abschließend auf FERTIG.
Die Auswahl der Rolle für das Dienstkonto hat keine Auswirkungen darauf, welche Aufrufe an die Content API gesendet werden können. Der Zugriff auf Content API-Methoden wird stattdessen durch die Rolle bestimmt, die der Dienstkonto-ID im Merchant Center zugewiesen ist. Wenn Sie nicht sicher sind, was Sie auswählen sollen, wählen Sie einfach Projekt > Betrachter aus.
- Sie werden zur Seite „Dienstkonten“ weitergeleitet, auf der Sie auf das neue Dienstkonto zugreifen können.
- Klicken Sie auf das Dienstkonto und dann auf den Tab SCHLÜSSEL, um einen privaten JSON-Schlüssel abzurufen. Klicken Sie auf SCHLÜSSEL HINZUFÜGEN > Neuen Schlüssel erstellen und wählen Sie dann JSON als Schlüsseltyp aus. Klicke auf ERSTELLEN, um den privaten Schlüssel auf deinen Computer herunterzuladen.
- Füge deinem Merchant Center-Konto das neue Dienstkonto als Nutzer hinzu. Drittanbieter-Entwickler müssen Ihren Kunden diesen Schritt für Sie ausführen lassen.
- Rufen Sie Ihr Merchant Center-Konto auf.
- Rufen Sie in den Einstellungen Ihres Merchant Center-Kontos Kontozugriff auf.
- Klicken Sie auf + Nutzer hinzufügen und verwenden Sie die ID des Dienstkontos als E-Mail-Adresse für den neuen Nutzer.
Wenn Sie sich die Dienstkonto-ID nicht notiert haben, rufen Sie die Seite Dienstkonten auf und wählen Sie das von Ihnen erstellte Projekt aus.
- Geben Sie die Einstellungen für den Nutzerzugriff und die E-Mail-Benachrichtigungen für das Dienstkonto an. Für die Nutzung des
Accounts
-Dienstes ist Administratorzugriff erforderlich.
- Klicken Sie auf Nutzer hinzufügen, um die Einstellungen zu speichern und zur Liste der Nutzer zurückzukehren. Die Dienstkonto-ID sollte mit der ausgewählten Nutzerrolle aufgelistet sein.
- Wiederholen Sie diesen Vorgang für alle anderen Dienstkonten, die Sie hinzufügen möchten.
- Sie können jetzt über das Dienstkonto auf Ihr Merchant Center-Konto zugreifen. Verwenden Sie dazu entweder den Ablauf Standardanmeldedaten für Google-Anwendungen oder direkt den Ablauf für Dienstkonten. In den Beispielen für die Content API for Shopping wird gezeigt, wie Sie beide Abläufe für Dienstkonto-Anmeldedaten in den einzelnen unterstützten Programmiersprachen verwenden.
Sehen Sie sich die Codebeispiele an, um Ihr neues Dienstkonto auszuprobieren und herauszufinden, welche Änderungen Sie vornehmen müssen, um Dienstkonten in Ihrem eigenen Code zu verwenden.
Häufig gestellte Fragen
- Kann ich mich mit meinem Dienstkonto in der Merchant Center-Benutzeroberfläche anmelden?
- Nein. Dienstkonten sind keine regulären Google-Konten und können nicht auf die Merchant Center-Benutzeroberfläche zugreifen.
- Wie oft muss ich die Zugriffstokens für Dienstkonten aktualisieren?
- Zugriffstokens verfallen eine Stunde, nachdem sie vom Google OAuth 2.0 Authorization Server ausgestellt wurden. Wenn ein Zugriffstoken abläuft, sollte die Anwendung über die Clientbibliothek ein neues abrufen.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-08-29 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-08-29 (UTC)."],[[["\u003cp\u003eService accounts enable applications to programmatically access Google APIs, including the Content API for Shopping, using OAuth 2.0 without human intervention.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize service accounts, you need to generate service account credentials, add the service account as a user in your Merchant Center account, and then access your Merchant Center account using either the Google Application Default Credentials flow or the service account flow.\u003c/p\u003e\n"],["\u003cp\u003eApplications authenticated with service accounts can only access your own Merchant Center account; for third-party applications needing access to client accounts, refer to the Authorizing Requests guide.\u003c/p\u003e\n"],["\u003cp\u003eService accounts cannot be used to sign in to the Merchant Center UI and access tokens expire after one hour, requiring the application to fetch a new one using the client library.\u003c/p\u003e\n"]]],["Service accounts allow applications to access the Content API for Shopping programmatically. Key actions include: generating service account credentials by creating an OAuth 2.0 Client ID and a JSON private key file via the Google API Console, and adding the service account as a user within the Merchant Center account, specifying access and notification preferences. To access the Merchant center, you can use Google Application Default Credentials or a service account flow, with example code available. Access tokens expire hourly, requiring renewal.\n"],null,["# Service accounts are special Google accounts that can be used by\napplications to access Google APIs programmatically via OAuth 2.0. A service\naccount uses an OAuth 2.0 flow that does not require human authorization.\nInstead, it uses a key file that only your application can access. This guide\ndiscusses how to access the Content API for Shopping with service accounts.\n\n**Note:** Applications using service accounts\nfor authentication can only access your own Merchant Center account. If you are\nwriting a third-party application that needs access to your clients' Merchant\nCenter accounts, please see the [Authorizing Requests](/shopping-content/guides/how-tos/authorizing)\nguide instead.\n\nPrerequisites\n-------------\n\n- A [Merchant Center](//merchants.google.com/) account.\n\nSteps to using a service account to access the Content API for Shopping\n-----------------------------------------------------------------------\n\n1. Generate service account credentials or access the public credentials you've already generated. You will need to create an OAuth 2.0 Client ID and obtain a \\*.json private key file:\n 1. Go to the [Google API Console](https://console.cloud.google.com/apis/library).\n 2. Select a project in the drop-down menu at the top of the page. If you do not have one yet, create one by clicking **NEW PROJECT**.\n 3. If you have not already enabled the Content API for Shopping for this project, then search for it in the list of Google APIs and enable it.\n 4. In the sidebar on the left, select **Credentials**. You may need to click the left-pointing arrow at the top left to see this.\n 5. To set up a service account, select **CREATE CREDENTIALS** , and then **Service account** . \n 6. Name the new service account. This also serves as the default username for the service account ID. Record the service account ID, including the part after the '@' character, for later use. Click **CREATE** , then go through the optional steps of granting access to project and users, and click **DONE** .\n\n The choice of role for the service account will not\n have any effect on what calls can be made to the Content API, as access to\n Content API methods is determined instead by the role associated with the\n service account ID in Merchant Center. If you are unsure what to pick, just\n pick **Project \\\u003e Viewer**.\n 7. You will be directed to the Service Accounts page where your new service account can be accessed.\n 8. To obtain a JSON private key, click on the service account, then the **KEYS** tab. Click **ADD KEY \\\u003e Create new key** and then select JSON as the key type. Click **CREATE** to download the private key to your computer.\n2. Add the new service account as a user to your Merchant Center account. If you are a third-party developer, you will need to have your client do this step for you.\n 1. Go to your [Merchant\n Center account](//merchants.google.com/).\n 2. Go to **Account Access** in the settings of your Merchant Center account.\n 3. Click **+ Add user** and use the service account ID as the email address for the new user.\n\n If you did not take note of the\n service account ID earlier, go to the [Service\n Accounts](//console.developers.google.com/iam-admin/serviceaccounts/) administration page and select the project you created.\n 4. Specify the **User access** and **Email notifications** preferences for the service account. Note that the use of the `Accounts` service requires **Admin** access.\n 5. Click **Add user** to save preferences and be returned to the list of users. The service account ID should be listed with the chosen user role.\n 6. Repeat the process for all other service accounts you want to add.\n3. Now you can access your Merchant Center account using the service account either by using the [Google Application\n Default Credentials](/identity/protocols/application-default-credentials) flow or by using the [service account flow](/identity/protocols/OAuth2ServiceAccount) directly. The Content API for Shopping [Samples](/shopping-content/guides/libraries) show how to use both flows for service account credentials in each supported programming language. Please check out the code samples to try out your new service account and to learn what changes you will need to use service accounts in your own code.\n\nFrequently asked questions\n--------------------------\n\nCan I sign in to the Merchant Center UI with my service account?\n: No, service accounts are not regular Google accounts and cannot access the\n Merchant Center UI.\n\nHow often do I need to refresh service account access tokens?\n: Access tokens expire one hour after they are issued by the Google OAuth 2.0\n Authorization Server. When an access token expires, the application should use\n the client library to fetch another access token."]]