Zernio
APIFor you
Zernio
APIFor you
Platforms

Google Business Profile

Overview

Publish

Posts & content typesMedia requirementsEvent & offer postsMulti-location posting

Engage

AnalyticsInbox

Manage

Business Profile managementServices & food menus

Reference

Fields, media & limits
Dashboard
OverviewPlatformsAPI ReferenceResources
Google Business Profile

Multi-location posting

List the locations an account manages, post to several in one request, switch the default location, and give a location its own profile.


By the end of this page, you have:

  • published one post to several Google Business Profile (googlebusiness) locations from a single connected account
  • switched the location that account posts to by default
  • moved a location onto its own profile with POST /v1/accounts/{accountId}/gmb-locations/assign, which reuses the same OAuth grant

You need a connected account (accountId) whose Google login manages more than one location.

Step 1: list the locations

Call GET /v1/accounts/{accountId}/gmb-locations (List locations). It returns up to 100 locations and the one currently selected.

Pass search to filter by business name, or raise limit (max 500) for larger accounts.

import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: locations } = await zernio.connect.getGmbLocations({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d' }
});

console.log(locations.selectedLocationId, locations.locations);

Response (200):

{
  "locations": [
    {
      "id": "12345678901234567890",
      "name": "Joe's Pizza Downtown",
      "accountId": "accounts/123456789",
      "accountName": "Joe's Pizza",
      "address": "123 Main St, San Francisco, CA",
      "category": "Pizza restaurant"
    },
    {
      "id": "22345678901234567890",
      "name": "Joe's Pizza Marina",
      "accountId": "accounts/123456789",
      "accountName": "Joe's Pizza",
      "address": "45 Bay St, San Francisco, CA",
      "category": "Pizza restaurant"
    }
  ],
  "hasMore": false,
  "selectedLocationId": "12345678901234567890",
  "cached": true
}

Step 2: post to several locations

Repeat the platforms entry with the same accountId and a different platformSpecificData.locationId each time.

The value is locations/ followed by the location's id from Step 1. An entry without locationId posts to the selected location.

const { data: published } = await zernio.posts.createPost({
  body: {
    content: 'Now open at both locations. Visit us today.',
    mediaItems: [{ type: 'image', url: 'https://cdn.example.com/store.jpg' }],
    platforms: [
      {
        platform: 'googlebusiness',
        accountId: '66b2e19d8c3f5a7e9d0b1c2d',
        platformSpecificData: { locationId: 'locations/12345678901234567890' }
      },
      {
        platform: 'googlebusiness',
        accountId: '66b2e19d8c3f5a7e9d0b1c2d',
        platformSpecificData: { locationId: 'locations/22345678901234567890' }
      }
    ],
    publishNow: true
  }
});

console.log(published.post.platforms.map((p) => p.platformPostUrl));

Response (201), one platforms entry per location:

{
  "post": {
    "_id": "65f1c0a9e2b5af0012ab34cd",
    "status": "published",
    "platforms": [
      { "platform": "googlebusiness", "status": "published", "platformPostUrl": "https://business.google.com/..." },
      { "platform": "googlebusiness", "status": "published", "platformPostUrl": "https://business.google.com/..." }
    ]
  }
}

Step 3: switch the default location

Call PUT /v1/accounts/{accountId}/gmb-locations with selectedLocationId (Update location). It changes which location the account posts to when locationId is omitted.

Pass googleAccountId (the accountId resource name from Step 1) as well. The location is then resolved directly instead of by enumerating the account. Large accounts require it.

const { data: switched } = await zernio.connect.updateGmbLocation({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d' },
  body: { selectedLocationId: '22345678901234567890', googleAccountId: 'accounts/123456789' }
});

console.log(switched.selectedLocation.name);

Response (200):

{
  "message": "Google Business location updated successfully",
  "selectedLocation": {
    "id": "22345678901234567890",
    "name": "Joe's Pizza Marina"
  }
}

Step 4: give a location its own profile

An agency running one profile per client connects each location onto its own profile.

Call POST /v1/accounts/{accountId}/gmb-locations/assign with the target profileId and the selectedLocationId to move onto it (Assign location to another profile). Pass googleAccountId here too.

The path accountId is the account whose OAuth grant is reused, so there is no second browser flow.

const { data: assigned } = await zernio.connect.assignGoogleBusinessLocation({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d' },
  body: {
    profileId: '66a1f0c2a4b9d3e8f1a2b3c4',
    selectedLocationId: 'locations/22345678901234567890',
    googleAccountId: 'accounts/123456789'
  }
});

console.log(assigned.account.accountId);

Response (200), a new connected account on the target profile:

{
  "message": "Location assigned successfully",
  "account": {
    "accountId": "66b2e19d8c3f5a7e9d0b1c2e",
    "platform": "googlebusiness",
    "username": "Joe's Pizza Marina",
    "displayName": "Joe's Pizza Marina",
    "isActive": true,
    "selectedLocationName": "Joe's Pizza Marina",
    "selectedLocationId": "22345678901234567890"
  }
}

account.selectedLocationId comes back as bare digits, not a resource name. Post to the new account with its own accountId and no locationId.

If it fails

A 400 on PUT /v1/accounts/{accountId}/gmb-locations means one of two things:

  • selectedLocationId is not one of the locations this Google login manages.
  • googleAccountId is not one of its accounts.
{
  "error": "Location not in available locations",
  "type": "invalid_request_error"
}

Take the id and accountId values from Step 1 rather than typing them, then retry.

A 404 means accountId is not one of your connected accounts. Error handling covers the envelope.

Related

  • List locations: search, filter and limit for accounts with many locations.
  • Assign location to another profile: one profile per client without a second OAuth.
  • Posts & Content Types: the base request.
  • Inbox: reviews across several locations in one call.
  • Profiles: how profiles group accounts.
Was this page helpful?

Event & offer posts

Publish event and offer posts to Google Business Profile with topicType, event and offer in platformSpecificData.

Analytics

Read daily performance metrics and the search keywords that triggered impressions for a Google Business Profile location.

On this page

Step 1: list the locationsStep 2: post to several locationsStep 3: switch the default locationStep 4: give a location its own profileIf it failsRelated