> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vortexiq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get entity counts

> Exact totals on the **source** store for the entities you selected — the numbers behind the count badges in the StagingPro UI. Fast, parallel reads; no run is created and the destination is never touched.

`destination_store_hash` is optional here, so you can get counts with only a source store chosen. Pass a `selection` to scope the counts to a selective run's real picks rather than the whole store. Orders are counted per selected `order_status_{id}` when those keys are requested.



## OpenAPI

````yaml vortex-apps/staging-pro/api/openapi.json POST /entity-counts
openapi: 3.1.0
info:
  title: StagingPro V2 Migration API (BigCommerce)
  version: 2.0.0
  description: >-
    REST API for the StagingPro V2 BC Migration app. Browse a connected store's
    catalogue, size a migration before you run it, launch bulk or selective
    store-to-store migrations, control runs, and follow live progress.


    All endpoints are served from `https://app.vortexiq.ai/v2/api/bc-migration`
    and are scoped to your organisation. Authenticate with a bearer token from
    the Login endpoint (scripts and services) or your signed-in session
    (browser). See
    [Authentication](/vortex-apps/staging-pro/api/authentication).
  contact:
    name: Vortex IQ Support
    url: https://www.vortexiq.ai/contact-us
servers:
  - url: https://app.vortexiq.ai/v2/api/bc-migration
    description: Vortex IQ platform (production)
security:
  - sessionAuth: []
  - bearerAuth: []
tags:
  - name: Authentication
    description: >-
      Exchange your identity and your organisation's API credential for a bearer
      token.
  - name: Migrations
    description: >-
      Create migrations, list history, read run detail and per-item issues, and
      follow live progress.
  - name: Migration Controls
    description: Pause, resume, cancel, and verify-only re-runs.
  - name: Counts & Forecast
    description: Size a migration before launching it. Neither endpoint creates a run.
paths:
  /entity-counts:
    post:
      tags:
        - Counts & Forecast
      summary: Get entity counts
      description: >-
        Exact totals on the **source** store for the entities you selected — the
        numbers behind the count badges in the StagingPro UI. Fast, parallel
        reads; no run is created and the destination is never touched.


        `destination_store_hash` is optional here, so you can get counts with
        only a source store chosen. Pass a `selection` to scope the counts to a
        selective run's real picks rather than the whole store. Orders are
        counted per selected `order_status_{id}` when those keys are requested.
      operationId: getEntityCounts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CountsRequest'
            example:
              source_store_hash: abc123xyz
              selected_entities:
                - products
                - categories
                - brands
      responses:
        '200':
          description: >-
            Entity counts. Keys listed in `estimated` are sampled estimates
            rather than exact totals.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntityCounts'
              example:
                counts:
                  products: 1200
                  categories: 210
                  brands: 40
                estimated: []
                at: '2026-07-16T09:00:00.000Z'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/StoreNotFound'
        '502':
          description: >-
            Counts could not be fetched from BigCommerce (`counts_failed`), or
            the migration service is unreachable (`proxy_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CountsRequest:
      type: object
      required:
        - source_store_hash
        - selected_entities
      description: >-
        Counts and forecast read the **source** store only, so
        `destination_store_hash` is optional.
      properties:
        source_store_hash:
          type: string
          description: BigCommerce store hash to read.
        destination_store_hash:
          type: string
          description: >-
            Optional. Supplying it lets the forecast price `update`/`replace`
            against the destination's real size.
        selected_entities:
          type: array
          items:
            type: string
          minItems: 1
          description: Entity keys to count or price.
        selection:
          $ref: '#/components/schemas/Selection'
        conflict_strategy:
          type: string
          enum:
            - skip
            - update
            - replace
          description: 'Forecast only: price the ETA for this strategy.'
        channel_map:
          type: object
          additionalProperties:
            type: integer
          description: Optional channel map.
        source_channel_id:
          type: integer
          minimum: 1
          description: Optional storefront scope.
        destination_channel_id:
          type: integer
          minimum: 1
          description: Optional storefront scope.
    EntityCounts:
      type: object
      properties:
        counts:
          type: object
          additionalProperties:
            type: integer
          description: Entity key → total on the source store.
        estimated:
          type: array
          items:
            type: string
          description: Keys whose value is a sampled estimate.
        at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable explanation.
        status:
          type: integer
          description: 'Present on `bc_error`: the status BigCommerce returned.'
        errors:
          type: object
          additionalProperties: true
          description: 'Present on validation failures: field-level messages.'
    Selection:
      type: object
      description: >-
        Selective migration picks. Parents and ancestors are included
        automatically, and products pull in their brands and categories.


        Find the ids to pass here in the StagingPro app's Selective Migration
        tab. A selection also scopes [entity
        counts](/vortex-apps/staging-pro/api/get-entity-counts) and the
        [forecast](/vortex-apps/staging-pro/api/get-forecast).
      properties:
        products:
          type: array
          items:
            type: integer
          maxItems: 5000
          description: Product ids.
        categories:
          type: array
          items:
            type: integer
          maxItems: 5000
          description: Category ids.
        pages:
          type: array
          items:
            type: integer
          maxItems: 2000
          description: Page ids.
        promotions:
          type: array
          items:
            type: integer
          maxItems: 2000
          description: Promotion ids.
        themes:
          type: array
          items:
            type: string
            format: uuid
          maxItems: 20
          description: >-
            Theme **UUIDs** (BigCommerce theme ids are uuids, not integers).
            When present, `activate_theme` is ignored in favour of
            `theme_activation`.
        page_templates:
          type: array
          items:
            type: string
            pattern: ^pages/
          maxItems: 50
          description: >-
            Page template files, all beginning `pages/` (for example
            `pages/home`). Template-level Page Builder content only — content
            scoped to a specific product, category, or page is not included.
        page_template_globals:
          type: array
          items:
            type: string
            pattern: ^pages/
          maxItems: 50
          description: >-
            Page templates whose **global** widget content also migrates. Must
            be a subset of `page_templates`.
  responses:
    Forbidden:
      description: >-
        Store Migration is not enabled for your organisation. Requests with no
        valid bearer token or session return `401` instead.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Store Migration is not enabled for this organization.
    StoreNotFound:
      description: >-
        The store is not found or not authorised for your organisation
        (`store_not_found`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: store_not_found
            message: >-
              source or destination store not found / not authorized for this
              organization
  securitySchemes:
    sessionAuth:
      type: apiKey
      in: cookie
      name: vortexiq_session
      description: >-
        Your signed-in Vortex IQ session (browser calls). Requests are scoped to
        your organisation, which must have Store Migration enabled. For
        server-to-server calls use a bearer token instead — see
        [Authentication](/vortex-apps/staging-pro/api/authentication).
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        A bearer token from [Login](/vortex-apps/staging-pro/api/login). Valid
        for 10 days; scoped to the user and organisation it was issued for.
        Rotating or disabling the organisation's API credential immediately
        invalidates all outstanding tokens.

````