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

# Get the Google Ad Manager snapshot of an upstream media buy

> Fetch the Google Ad Manager order and line items the ad server source booked for one upstream media buy. Each line item's targeted and excluded Google Ad Manager locations are read live from Google Ad Manager, each with the AdCP v2.5 geo targeting it stands for; geo targeting is null, with a reason, when it could not be read. At most 50 line items and 100 locations per list are returned, each with its exact count.



## OpenAPI

````yaml /v2/storefront-api-v2.yaml get /esa/{esaId}/media-buys/{mediaBuyId}/gam-snapshot
openapi: 3.0.0
info:
  title: Scope3 Storefront API
  version: 2.0.0
  description: >-
    REST API for partners to manage Seller Accounts, inventory sources, and
    billing.


    ## Authentication


    All endpoints require a Bearer token in the Authorization header:

    ```

    Authorization: Bearer your-api-key

    ```


    ## Base URL


    `https://api.apostra.com/api/v2/storefront`


    ## For AI Agents


    AI agents can use the MCP endpoint at `/mcp/v2/storefront` with three tools:

    - `initialize`: Start an MCP session

    - `api_call`: Make REST API calls

    - `ask_about_capability`: Learn about API features
servers:
  - url: https://api.apostra.com/api/v2/storefront
    description: Production server
security: []
tags:
  - name: Account
    description: Account management, service tokens, and preferences
  - name: Asks
    description: >-
      What you are waiting on Scope3 for — support, product, and supply asks in
      one list
  - name: Storefront
    description: Manage storefront and inventory sources
  - name: Storefront Agents
    description: List and manage registered sales, signals, and outcomes agents
  - name: Storefront Activity
    description: Audit log of configuration and inventory changes on the storefront
  - name: Storefront Billing
    description: Payout bank details and billing configuration for Seller Accounts
  - name: AI Usage
    description: Seller Account AI token usage visibility by model
  - name: MCP
    description: Model Context Protocol endpoints
paths:
  /esa/{esaId}/media-buys/{mediaBuyId}/gam-snapshot:
    get:
      tags:
        - Storefront Ad Server Diagnostics
      summary: Get the Google Ad Manager snapshot of an upstream media buy
      description: >-
        Fetch the Google Ad Manager order and line items the ad server source
        booked for one upstream media buy. Each line item's targeted and
        excluded Google Ad Manager locations are read live from Google Ad
        Manager, each with the AdCP v2.5 geo targeting it stands for; geo
        targeting is null, with a reason, when it could not be read. At most 50
        line items and 100 locations per list are returned, each with its exact
        count.
      operationId: getEsaMediaBuyGamSnapshot
      parameters:
        - in: path
          name: esaId
          schema:
            type: integer
            minimum: 0
            exclusiveMinimum: true
            maximum: 9007199254740991
            description: >-
              Ad server source connection id. The wire field remains `esaId` for
              API compatibility.
            example: 123
          required: true
          description: >-
            Ad server source connection id. The wire field remains `esaId` for
            API compatibility.
        - in: path
          name: mediaBuyId
          schema:
            type: string
            minLength: 1
            description: Upstream media buy id for the ad server source.
            example: adcp_mb_123
          required: true
          description: Upstream media buy id for the ad server source.
      responses:
        '200':
          description: Get the Google Ad Manager snapshot of an upstream media buy
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EsaGamSnapshot'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    EsaGamSnapshot:
      type: object
      properties:
        mediaBuyId:
          type: string
        gamOrderId:
          nullable: true
          type: string
        fetchedAt:
          type: string
        lineItemCount:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        lineItemsTruncated:
          type: boolean
        lineItems:
          maxItems: 50
          type: array
          items:
            type: object
            properties:
              lineItemId:
                type: string
              orderId:
                type: string
              packageId:
                nullable: true
                type: string
              name:
                type: string
              status:
                type: string
              lineItemType:
                type: string
              geoTargeting:
                nullable: true
                description: >-
                  Read live from GAM. Null when it could not be read;
                  geoTargetingUnavailableReason says why.
                type: object
                properties:
                  targetedLocations:
                    type: object
                    properties:
                      count:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      truncated:
                        type: boolean
                      items:
                        maxItems: 100
                        type: array
                        items:
                          $ref: '#/components/schemas/EsaGamLocation'
                    required:
                      - count
                      - truncated
                      - items
                    additionalProperties: false
                  excludedLocations:
                    type: object
                    properties:
                      count:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      truncated:
                        type: boolean
                      items:
                        maxItems: 100
                        type: array
                        items:
                          $ref: '#/components/schemas/EsaGamLocation'
                    required:
                      - count
                      - truncated
                      - items
                    additionalProperties: false
                required:
                  - targetedLocations
                  - excludedLocations
                additionalProperties: false
              geoTargetingUnavailableReason:
                nullable: true
                description: >-
                  adapter_not_gam, gam_not_connected, gam_read_failed, or
                  line_item_not_found.
                type: string
            required:
              - lineItemId
              - orderId
              - packageId
              - name
              - status
              - lineItemType
              - geoTargeting
              - geoTargetingUnavailableReason
            additionalProperties: false
      required:
        - mediaBuyId
        - gamOrderId
        - fetchedAt
        - lineItemCount
        - lineItemsTruncated
        - lineItems
      additionalProperties: false
      description: >-
        The GAM line items an ad server source booked for one upstream media
        buy, with each line item's targeted and excluded GAM locations read live
        from GAM and the AdCP v2.5 geo targeting each location stands for.
        Bounded: line items and locations carry exact counts and a truncated
        flag.
    ErrorResponse:
      type: object
      properties:
        data:
          type: string
          nullable: true
          enum:
            - null
        error:
          $ref: '#/components/schemas/ApiError'
      required:
        - data
        - error
      additionalProperties: false
      description: Standard error response
    EsaGamLocation:
      type: object
      properties:
        locationId:
          type: string
          description: GAM location id, for example 200501 for Nielsen DMA 501.
        type:
          nullable: true
          description: GAM location type, for example DMA_REGION or COUNTRY.
          type: string
        displayName:
          nullable: true
          type: string
        adcpTargeting:
          description: >-
            The AdCP v2.5 geo targeting this GAM location stands for, for
            example `{ geo_metro_any_of: ['501'] }` for Nielsen DMA 501. Empty
            when it maps to nothing v2.5 can express.
          allOf:
            - $ref: '#/components/schemas/EsaGamLocationAdcpTargeting'
      required:
        - locationId
        - type
        - displayName
        - adcpTargeting
      additionalProperties: false
    ApiError:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code
        message:
          type: string
          description: Human-readable error message
        field:
          description: Field path associated with the error
          type: string
        details:
          description: Additional error context
          type: object
          additionalProperties: {}
      required:
        - code
        - message
      additionalProperties: false
      description: Structured error object
    EsaGamLocationAdcpTargeting:
      type: object
      properties:
        geo_country_any_of:
          type: array
          items:
            type: string
            pattern: ^[A-Z]{2}$
        geo_region_any_of:
          type: array
          items:
            type: string
        geo_metro_any_of:
          type: array
          items:
            type: string
        geo_postal_code_any_of:
          type: array
          items:
            type: string
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key or access token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.