---
title: "Batch set account flag state"
method: POST
path: "/feature-flags/2026-09/{appId}/flags/{flagName}/portals/batch/upsert"
tags: ["Batch"]
---

# Batch set account flag state

`POST /feature-flags/2026-09/{appId}/flags/{flagName}/portals/batch/upsert`

## Request

- Base URL: `https://api.hubapi.com`
- URL: `https://api.hubapi.com/feature-flags/2026-09/{appId}/flags/{flagName}/portals/batch/upsert`
- Auth: API key in query parameter `hapikey`

Set the portal flag state for multiple HubSpot accounts at once. Use this endpoint to manage flag exposure for groups of HubSpot accounts.

## Path parameters

- `appId` integer, required
- `flagName` string, required

## Request body

- PortalFlagStateBatchPutRequest
  - `portalStates` BatchPortalEntry[], required: An array of portal flag state entries to be updated. Each entry contains details about the portal ID and the desired flag state.
    - `flagState` 'ABSENT' | 'OFF' | 'ON', required: The flag state for this portal (e.g. ON or OFF)
    - `portalId` integer, required: The ID of the portal

## Response `200`

successful operation

- PortalFlagStateBatchResponse
  - `portalFlagStates` PortalFlagStateResponse[], required: An array of portal flag state responses, each representing the state of a feature flag for a specific portal.
    - `appId` integer, required: The ID of the app
    - `flagName` string, required: The name of the flag
    - `flagState` 'ABSENT' | 'OFF' | 'ON', required: The state of the flag for this portal
    - `portalId` integer, required: The ID of the portal

## Other responses

- `default`: An error occurred.

## Changes

- **2026-10-10** (2026-09) `de25edbdcd67`: 2 info
  - the endpoint scheme security `developer_hapikey` was added to the API
  - the endpoint scheme security `oauth2` was removed from the API

[Operation history](https://skmtc.dev/hubspot/apis/crm-public-app-feature-flags-v3/changes/feature-flags/2026-09/:appId/flags/:flagName/portals/batch/upsert/post.md)

---

[API](https://skmtc.dev/hubspot/apis/crm-public-app-feature-flags-v3.md) - [All operations](https://skmtc.dev/hubspot/apis/crm-public-app-feature-flags-v3/llms.txt) - [OpenAPI document](https://skmtc.dev/hubspot/apis/crm-public-app-feature-flags-v3/revisions/de25edbdcd67?raw)
