Google Business Profile API in Python and Node: list and reply to reviews
To list and reply to Google reviews from Python or Node, use your own Google Cloud project approved for Basic API Access, sign in with OAuth for the business.manage scope, find the account and location names, then call GET .../reviews and PUT .../reviews/{reviewId}/reply with a comment. Without code, easyCoexistence lets ChatGPT or Claude do the same work through its MCP server, with you approving each reply.
Google's API policies require agencies and end-clients using Business Profile programmatically to use their own Business Profile project.
The OAuth scope the Business Profile APIs require: https://www.googleapis.com/auth/business.manage.
A project's Business Profile API quota before and after Google approves its Application for Basic API Access.
The maximum length of a review reply's comment.
updateReply, the call that creates or changes a reply, is valid only when the location is verified.
Google has no sandbox for the Business Profile APIs; some calls take validateOnly to check a request without changes.
Why do you need your own Google Cloud project?
Because Google's Business Profile API policies say "Any automatic or programmatic use of Business Profile by agencies or end-clients requires them to use their own Business Profile project." Code that reads reviews or posts replies is programmatic use, so it runs on a Cloud project you own and Google approves, never through another company's project or API. Google grants that access per project, and any user with access to the project can then call the APIs.
What do you need before calling Google's API?
Four things, each set up in your own Google account and project:
- A Cloud project approved for Basic API Access, requested through Google's GBP API contact form from an email that is an owner or manager on the profile. Until then the quota is 0 QPM.
- The Business Profile APIs enabled in the Cloud console. This code uses three: the Google My Business API, which holds reviews, the My Business Account Management API and the My Business Business Information API.
- An OAuth client of the Desktop app type, saved as credentials.json next to the script. If the app's audience is External and in Testing, add your Google account as a test user.
- A Google account that owns or manages the location, to sign in with when the browser opens.
Which Google endpoints list reviews and post a reply?
The first two calls find the resource names Google wants, accounts/{accountId} and locations/{locationId}, and the reviews calls then work under accounts/{accountId}/locations/{locationId}. All of them need the business.manage scope, and the Google My Business API behind the v4 calls only shows in the Cloud console once Google approves your access request.
How do you list reviews and reply in Python?
With Google's auth library and plain HTTPS calls. The script opens the browser for the Google sign-in, prints each review with its id and star rating, then asks which one to answer and with what text, so nothing is posted until a person types it in.
# pip install google-auth-oauthlib
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import AuthorizedSession
SCOPES = ["https://www.googleapis.com/auth/business.manage"]
flow = InstalledAppFlow.from_client_secrets_file("credentials.json", SCOPES)
google = AuthorizedSession(flow.run_local_server(port=0))
# accounts[0] is your personal account; pick another from the list if the location sits elsewhere
account = google.get("https://mybusinessaccountmanagement.googleapis.com/v1/accounts").json()["accounts"][0]["name"]
location = google.get(
f"https://mybusinessbusinessinformation.googleapis.com/v1/{account}/locations",
params={"readMask": "name,title"},
).json()["locations"][0]["name"]
reviews_url = f"https://mybusiness.googleapis.com/v4/{account}/{location}/reviews"
for r in google.get(reviews_url).json().get("reviews", []):
print(r["reviewId"], r["starRating"], r.get("comment", ""), "(replied)" if "reviewReply" in r else "")
review_id = input("Review id to answer: ")
text = input("Reply, as the owner approved it: ")
google.put(f"{reviews_url}/{review_id}/reply", json={"comment": text}).raise_for_status()How do you do the same in Node?
With Google's local-auth package, which opens the same browser sign-in and returns an authorized client whose request method calls any of the endpoints. The script lists the reviews, then asks for a review id and the approved text, as the Python one does. Save it as a .mjs file so top-level await works.
// npm install @google-cloud/local-auth then: node reviews.mjs
import path from "node:path";
import readline from "node:readline/promises";
import { authenticate } from "@google-cloud/local-auth";
const google = await authenticate({
scopes: ["https://www.googleapis.com/auth/business.manage"],
keyfilePath: path.resolve("credentials.json"),
});
const get = async (url) => (await google.request({ url })).data;
// accounts[0] is your personal account; pick another if the location sits elsewhere
const { accounts } = await get("https://mybusinessaccountmanagement.googleapis.com/v1/accounts");
const account = accounts[0].name;
const { locations } = await get(
`https://mybusinessbusinessinformation.googleapis.com/v1/${account}/locations?readMask=name,title`
);
const reviewsUrl = `https://mybusiness.googleapis.com/v4/${account}/${locations[0].name}/reviews`;
const { reviews = [] } = await get(reviewsUrl);
for (const r of reviews) console.log(r.reviewId, r.starRating, r.comment ?? "", r.reviewReply ? "(replied)" : "");
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
const reviewId = await rl.question("Review id to answer: ");
const comment = await rl.question("Reply, as the owner approved it: ");
rl.close();
await google.request({ url: `${reviewsUrl}/${reviewId}/reply`, method: "PUT", data: { comment } });Why does the code wait for a person before replying?
Because Google's policies say "you must not automate or trigger review replies, Q&As, listing creations, listing edits, or other actions without the user's prior specific and express consent," and an agency answering for a client must receive the client's authorization first. A reply is also public: once Google approves it, it appears under the review as the business, without anyone's personal name, and the reviewer is notified.
How do you do the same work without code?
Sign in and ask, through easyCoexistence. In its dashboard, choose New connection, then Google Business, sign in with Google as an owner or manager of the profile, then add https://easycoexistence.com/api/mcp to ChatGPT or Claude. Ask for the reviews without a reply: the assistant calls list_google_reviews, drafts an answer for each, shows you each draft and calls reply_to_google_review only for the ones you approve. delete_google_review_reply takes a reply down, and the review stays. To answer new reviews without asking each time, switch on a review automation in the dashboard: it replies with a fixed text or your own AI, or sends each new review to your webhook and posts the reply it returns.
How to set it up
- Create your projectCreate a Google Cloud project, note its project number and send Google's GBP API contact form, choosing Application for Basic API Access.
- Enable the APIsOnce the quota reads 300 QPM, enable the Business Profile APIs in the Cloud console.
- Create an OAuth clientCreate a Desktop app OAuth client and save its JSON as credentials.json beside the script.
- Run and sign inRun the Python or Node script and sign in with a Google account that owns or manages the location.
- Reply to one reviewPick a review id from the list and type the reply the owner approved.
Common mistakes
- Requesting a quota increase at 0 QPM. Google's limits page says a quota of 0 means access is not granted yet, so submit the Application for Basic API Access instead.
- Leaving readMask off the locations call. The Business Information API marks it required, so send at least readMask=name,title.
- Testing the reply call on a live review. There is no sandbox for the Business Profile APIs, so a test reply is a real, public reply from the business.
- Measuring the 4,096-byte reply limit in characters. Accented letters and emoji take several bytes each, so a reply that looks short can still be refused.
easyCoexistence is the no-code route to the same work: connect a location with Google sign-in, add its MCP server to ChatGPT or Claude and ask for the reviews without a reply. The assistant drafts the answers and posts only the ones you approve, with reviews read live from Google and never stored. Or switch on a review automation in its dashboard to answer new reviews by itself. US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.
easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook, Google Business Profile and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.
Frequently asked questions
Why does the script get a 403 error?
Google's setup guide names one cause: calls fail with 403 PERMISSION DENIED when Business Profile is turned off for a Google Workspace account. Also check that the three APIs the script calls are enabled on your project.
How do I list more than 50 reviews?
Follow the page token. reviews.list returns at most 50 reviews a page, and while more remain, each response carries a nextPageToken to send as pageToken in the next request.
How do I test without touching a real profile?
Google has no test listings: its API FAQ says fake listings usually get flagged and suspended. It suggests a listing for your company headquarters, a client listing worked after hours without changing its name, address or category, or mock API responses.
How do I know a reply went live?
List the reviews again and read the reply's reviewReplyState: PENDING, APPROVED or REJECTED, with a policyViolation on a rejected one. reviews.get leaves that state out, and Google's check usually takes up to 10 minutes, sometimes 30 days.
Keep reading
Connect your first channel in two minutes.
No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.
- 3 days free
- Cancel any time
- Official APIs only
- Monitored 24/7
Verified on