Zernio
Zernio
PlatformsGoogle Business ProfilePosts & Content TypesEvent & Offer PostsMulti-Location PostingBusiness Profile ManagementServices & Food MenusAnalyticsInboxFields, Media & Limits
Dashboard
llms.txtOpenAPI
OverviewPlatformsAPI ReferenceResources
Google Business Profile

Multi-Location Posting

List the Google Business Profile locations an account manages, post to several of them in one request, switch the account's default location, and give a location its own profile with POST /gmb-locations/assign.


When you finish 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, and 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 to change which location the account posts to when locationId is omitted (Update location). Pass googleAccountId (the accountId resource name from Step 1) as well, so the location is 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). The path accountId is the account whose OAuth grant is reused, so there is no second browser flow. Pass googleAccountId here too.

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 selectedLocationId is not one of the locations this Google login manages, or 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.

Business Profile Management

Read and update a Google Business Profile listing through the API, with verification, hours, photos, attributes and action links.

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