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

# Update media buy

> Partially update a single media buy, resolved top-level by mediaBuyId — the owning campaign is resolved server-side, consistent with GET /media-buys/{mediaBuyId}. Rejected outright (not a warning) when it would violate a campaign invariant: currency (a product's replacement pricing option settles in a different currency than this buy), budget headroom (the update would exceed the campaign's remaining all-in budget), or mode compatibility (the campaign is directed and has no platform-managed update path). A flight date outside the campaign's current window is not a failure — the campaign flight is widened to cover it and a warning is returned.



## OpenAPI

````yaml /v2/buyer-api-v2.yaml patch /media-buys/{mediaBuyId}
openapi: 3.0.0
info:
  title: Scope3 Buyer API
  version: 2.0.0
  description: |-
    REST API for advertisers to manage advertisers, campaigns, and reporting.

    ## Authentication

    All endpoints require a Bearer token in the Authorization header:
    ```
    Authorization: Bearer your-api-key
    ```

    ## Base URL

    `https://api.interchange.io/api/v2/buyer`

    ## For AI Agents

    AI agents can use the MCP endpoint at `/mcp/v2/buyer` 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.interchange.io/api/v2/buyer
    description: Production server
security: []
tags:
  - name: Account
    description: Account management, service tokens, and preferences
  - name: Advertisers
    description: Manage advertisers
  - name: Product Discovery
    description: Discover and select products
  - name: Campaigns
    description: Manage advertising campaigns
  - name: Creatives
    description: Build, manage, and sync campaign creatives via AdCP Creative Protocol
  - name: Reporting
    description: Access performance metrics
  - name: Event Sources
    description: >-
      Manage event source configurations and log conversion/marketing events for
      attribution
  - name: Property Lists
    description: Validate property lists against AAO registry
  - name: Sales Agents
    description: View and connect sales agents
  - name: Measurement
    description: Measurement sources, records, context, and freshness
  - name: Syndication
    description: Syndicate resources to ADCP agents
  - name: Tasks
    description: Track async operation status
  - name: Buyer Billing
    description: >-
      Consolidated invoicing for buyers — invoices and pending invoice items
      issued by Scope3 across the buyer customer.
  - name: MCP
    description: Model Context Protocol endpoints for AI agents
paths:
  /media-buys/{mediaBuyId}:
    patch:
      tags:
        - Campaigns
      summary: Update media buy
      description: >-
        Partially update a single media buy, resolved top-level by mediaBuyId —
        the owning campaign is resolved server-side, consistent with GET
        /media-buys/{mediaBuyId}. Rejected outright (not a warning) when it
        would violate a campaign invariant: currency (a product's replacement
        pricing option settles in a different currency than this buy), budget
        headroom (the update would exceed the campaign's remaining all-in
        budget), or mode compatibility (the campaign is directed and has no
        platform-managed update path). A flight date outside the campaign's
        current window is not a failure — the campaign flight is widened to
        cover it and a warning is returned.
      operationId: updateMediaBuy
      parameters:
        - in: path
          name: mediaBuyId
          schema:
            description: Buyer media buy ID
            example: mb_ETBn4gJ9Wu
            type: string
            minLength: 1
          required: true
          description: Buyer media buy ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMediaBuyRequest'
      responses:
        '200':
          description: Update media buy
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateMediaBuyResponse'
        '400':
          description: >-
            Validation failed: the campaign is directed, the campaign is
            completed/archived/cancelled, the update would exceed the campaign's
            remaining budget headroom, or a product's replacement pricing option
            settles in a different currency than this buy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Caller is not a buyer — the route is mounted behind the buyer role
            guard.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No media buy with this id owned by the caller.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: The media buy is in a terminal status and can no longer be updated.
          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:
    UpdateMediaBuyRequest:
      description: >-
        Partial update for a single media buy, resolved top-level by mediaBuyId.
        Rejected outright (not warned) when it would violate a campaign
        invariant: currency (a product's replacement pricing option settles in a
        different currency), budget headroom (the update would exceed the
        campaign's remaining all-in budget), or mode compatibility (the campaign
        is directed — its mirrored media buy has no platform-managed update
        path).
      type: object
      properties:
        name:
          description: Updated media buy name
          type: string
          minLength: 1
          maxLength: 255
        packages:
          description: Per-package updates (for media buys with deployed packages)
          type: array
          items:
            $ref: '#/components/schemas/UpdateMediaBuyPackageInput'
        products:
          description: >-
            Product updates — additive (existing products not listed are
            preserved).
          type: array
          items:
            $ref: '#/components/schemas/UpdateMediaBuyProductInput'
        start_time:
          description: >-
            "asap" or ISO 8601 date-time. A value earlier than the campaign's
            current flight start does not fail the request — it is applied and
            surfaced as a warning, and the campaign flight is widened to cover
            it.
          type: string
        end_time:
          description: >-
            ISO 8601 date-time. A value later than the campaign's current flight
            end does not fail the request — it is applied and surfaced as a
            warning, and the campaign flight is widened to cover it.
          type: string
        optimization_goals:
          description: >-
            Replace media-buy-level optimization goals; applied to every package
            at execution time. Pass an empty array to clear all goals.
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - metric
                  metric:
                    anyOf:
                      - type: string
                        enum:
                          - clicks
                      - type: string
                        enum:
                          - views
                      - type: string
                        enum:
                          - completed_views
                      - type: string
                        enum:
                          - viewed_seconds
                      - type: string
                        enum:
                          - attention_seconds
                      - type: string
                        enum:
                          - attention_score
                      - type: string
                        enum:
                          - engagements
                      - type: string
                        enum:
                          - follows
                      - type: string
                        enum:
                          - saves
                      - type: string
                        enum:
                          - profile_visits
                      - type: string
                        enum:
                          - reach
                  reach_unit:
                    anyOf:
                      - type: string
                        enum:
                          - individuals
                      - type: string
                        enum:
                          - households
                      - type: string
                        enum:
                          - devices
                      - type: string
                        enum:
                          - accounts
                      - type: string
                        enum:
                          - cookies
                      - type: string
                        enum:
                          - custom
                  target_frequency:
                    type: object
                    properties:
                      min:
                        type: number
                        minimum: 1
                      max:
                        type: number
                        minimum: 1
                      window:
                        type: object
                        properties:
                          interval:
                            type: number
                            minimum: 1
                          unit:
                            anyOf:
                              - type: string
                                enum:
                                  - seconds
                              - type: string
                                enum:
                                  - minutes
                              - type: string
                                enum:
                                  - hours
                              - type: string
                                enum:
                                  - days
                              - type: string
                                enum:
                                  - campaign
                        required:
                          - interval
                          - unit
                        additionalProperties: {}
                    required:
                      - window
                    additionalProperties: {}
                  view_duration_seconds:
                    type: number
                  target:
                    anyOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - cost_per
                          value:
                            type: number
                        required:
                          - kind
                          - value
                        additionalProperties: {}
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - threshold_rate
                          value:
                            type: number
                        required:
                          - kind
                          - value
                        additionalProperties: {}
                  priority:
                    type: number
                    minimum: 1
                required:
                  - kind
                  - metric
                additionalProperties: {}
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - event
                  event_sources:
                    type: array
                    items:
                      type: object
                      properties:
                        event_source_id:
                          type: string
                          minLength: 1
                        event_type:
                          anyOf:
                            - type: string
                              enum:
                                - page_view
                            - type: string
                              enum:
                                - view_content
                            - type: string
                              enum:
                                - select_content
                            - type: string
                              enum:
                                - select_item
                            - type: string
                              enum:
                                - search
                            - type: string
                              enum:
                                - share
                            - type: string
                              enum:
                                - add_to_cart
                            - type: string
                              enum:
                                - remove_from_cart
                            - type: string
                              enum:
                                - viewed_cart
                            - type: string
                              enum:
                                - add_to_wishlist
                            - type: string
                              enum:
                                - initiate_checkout
                            - type: string
                              enum:
                                - add_payment_info
                            - type: string
                              enum:
                                - purchase
                            - type: string
                              enum:
                                - refund
                            - type: string
                              enum:
                                - lead
                            - type: string
                              enum:
                                - qualify_lead
                            - type: string
                              enum:
                                - close_convert_lead
                            - type: string
                              enum:
                                - disqualify_lead
                            - type: string
                              enum:
                                - complete_registration
                            - type: string
                              enum:
                                - subscribe
                            - type: string
                              enum:
                                - follow
                            - type: string
                              enum:
                                - content_view
                            - type: string
                              enum:
                                - watch_milestone
                            - type: string
                              enum:
                                - start_trial
                            - type: string
                              enum:
                                - app_install
                            - type: string
                              enum:
                                - app_launch
                            - type: string
                              enum:
                                - contact
                            - type: string
                              enum:
                                - schedule
                            - type: string
                              enum:
                                - donate
                            - type: string
                              enum:
                                - submit_application
                            - type: string
                              enum:
                                - custom
                        custom_event_name:
                          type: string
                        value_field:
                          type: string
                        value_factor:
                          type: number
                      required:
                        - event_source_id
                        - event_type
                      additionalProperties: {}
                  target:
                    anyOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - cost_per
                          value:
                            type: number
                        required:
                          - kind
                          - value
                        additionalProperties: {}
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - per_ad_spend
                          value:
                            type: number
                        required:
                          - kind
                          - value
                        additionalProperties: {}
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - maximize_value
                        required:
                          - kind
                        additionalProperties: {}
                  attribution_window:
                    type: object
                    properties:
                      post_click:
                        type: object
                        properties:
                          interval:
                            type: number
                            minimum: 1
                          unit:
                            anyOf:
                              - type: string
                                enum:
                                  - seconds
                              - type: string
                                enum:
                                  - minutes
                              - type: string
                                enum:
                                  - hours
                              - type: string
                                enum:
                                  - days
                              - type: string
                                enum:
                                  - campaign
                        required:
                          - interval
                          - unit
                        additionalProperties: {}
                      post_view:
                        type: object
                        properties:
                          interval:
                            type: number
                            minimum: 1
                          unit:
                            anyOf:
                              - type: string
                                enum:
                                  - seconds
                              - type: string
                                enum:
                                  - minutes
                              - type: string
                                enum:
                                  - hours
                              - type: string
                                enum:
                                  - days
                              - type: string
                                enum:
                                  - campaign
                        required:
                          - interval
                          - unit
                        additionalProperties: {}
                      model:
                        anyOf:
                          - type: string
                            enum:
                              - last_touch
                          - type: string
                            enum:
                              - first_touch
                          - type: string
                            enum:
                              - linear
                          - type: string
                            enum:
                              - time_decay
                          - type: string
                            enum:
                              - data_driven
                    additionalProperties: {}
                  priority:
                    type: number
                    minimum: 1
                required:
                  - kind
                  - event_sources
                additionalProperties: {}
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - vendor_metric
                  vendor:
                    type: object
                    properties:
                      domain:
                        type: string
                        pattern: >-
                          ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
                      brand_id:
                        type: string
                      industries:
                        type: array
                        items:
                          type: string
                      data_subject_contestation:
                        type: object
                        properties:
                          url:
                            type: string
                            pattern: ^https:\/\/
                          email:
                            type: string
                            format: email
                            pattern: >-
                              ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                          languages:
                            type: array
                            items:
                              type: string
                        additionalProperties: {}
                      brand_kit_override:
                        type: object
                        properties:
                          logo:
                            type: object
                            properties:
                              asset_type:
                                type: string
                                enum:
                                  - image
                              url:
                                type: string
                              width:
                                type: number
                                minimum: 1
                              height:
                                type: number
                                minimum: 1
                              format:
                                type: string
                              alt_text:
                                type: string
                              provenance:
                                type: object
                                properties:
                                  digital_source_type:
                                    anyOf:
                                      - type: string
                                        enum:
                                          - digital_capture
                                      - type: string
                                        enum:
                                          - digital_creation
                                      - type: string
                                        enum:
                                          - trained_algorithmic_media
                                      - type: string
                                        enum:
                                          - composite_with_trained_algorithmic_media
                                      - type: string
                                        enum:
                                          - algorithmic_media
                                      - type: string
                                        enum:
                                          - composite_capture
                                      - type: string
                                        enum:
                                          - composite_synthetic
                                      - type: string
                                        enum:
                                          - human_edits
                                      - type: string
                                        enum:
                                          - data_driven_media
                                  ai_tool:
                                    type: object
                                    properties:
                                      name:
                                        type: string
                                      version:
                                        type: string
                                      provider:
                                        type: string
                                    required:
                                      - name
                                    additionalProperties: {}
                                  human_oversight:
                                    anyOf:
                                      - type: string
                                        enum:
                                          - none
                                      - type: string
                                        enum:
                                          - prompt_only
                                      - type: string
                                        enum:
                                          - selected
                                      - type: string
                                        enum:
                                          - edited
                                      - type: string
                                        enum:
                                          - directed
                                  declared_by:
                                    type: object
                                    properties:
                                      agent_url:
                                        type: string
                                      role:
                                        anyOf:
                                          - type: string
                                            enum:
                                              - creator
                                          - type: string
                                            enum:
                                              - advertiser
                                          - type: string
                                            enum:
                                              - agency
                                          - type: string
                                            enum:
                                              - platform
                                          - type: string
                                            enum:
                                              - tool
                                    required:
                                      - role
                                    additionalProperties: {}
                                  declared_at:
                                    type: string
                                    format: date-time
                                    pattern: >-
                                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                                  created_time:
                                    type: string
                                    format: date-time
                                    pattern: >-
                                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                                  c2pa:
                                    type: object
                                    properties:
                                      manifest_url:
                                        type: string
                                    required:
                                      - manifest_url
                                    additionalProperties: {}
                                  embedded_provenance:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        method:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - manifest_wrapper
                                            - type: string
                                              enum:
                                                - provenance_markers
                                        standard:
                                          type: string
                                        provider:
                                          type: string
                                        verify_agent:
                                          type: object
                                          properties:
                                            agent_url:
                                              type: string
                                              pattern: ^https:\/\/
                                            feature_id:
                                              type: string
                                          required:
                                            - agent_url
                                          additionalProperties: {}
                                        embedded_at:
                                          type: string
                                          format: date-time
                                          pattern: >-
                                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                                      required:
                                        - method
                                        - provider
                                      additionalProperties: {}
                                  watermarks:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        media_type:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - audio
                                            - type: string
                                              enum:
                                                - image
                                            - type: string
                                              enum:
                                                - video
                                            - type: string
                                              enum:
                                                - text
                                        provider:
                                          type: string
                                        verify_agent:
                                          type: object
                                          properties:
                                            agent_url:
                                              type: string
                                              pattern: ^https:\/\/
                                            feature_id:
                                              type: string
                                          required:
                                            - agent_url
                                          additionalProperties: {}
                                        c2pa_action:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - c2pa.watermarked.bound
                                            - type: string
                                              enum:
                                                - c2pa.watermarked.unbound
                                        embedded_at:
                                          type: string
                                          format: date-time
                                          pattern: >-
                                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                                      required:
                                        - media_type
                                        - provider
                                      additionalProperties: {}
                                  disclosure:
                                    type: object
                                    properties:
                                      required:
                                        type: boolean
                                      jurisdictions:
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            country:
                                              type: string
                                            region:
                                              type: string
                                            regulation:
                                              type: string
                                            label_text:
                                              type: string
                                            render_guidance:
                                              type: object
                                              properties:
                                                persistence:
                                                  anyOf:
                                                    - type: string
                                                      enum:
                                                        - continuous
                                                    - type: string
                                                      enum:
                                                        - initial
                                                    - type: string
                                                      enum:
                                                        - flexible
                                                min_duration_ms:
                                                  type: number
                                                  minimum: 1
                                                positions:
                                                  type: array
                                                  items:
                                                    anyOf:
                                                      - type: string
                                                        enum:
                                                          - prominent
                                                      - type: string
                                                        enum:
                                                          - footer
                                                      - type: string
                                                        enum:
                                                          - audio
                                                      - type: string
                                                        enum:
                                                          - subtitle
                                                      - type: string
                                                        enum:
                                                          - overlay
                                                      - type: string
                                                        enum:
                                                          - end_card
                                                      - type: string
                                                        enum:
                                                          - pre_roll
                                                      - type: string
                                                        enum:
                                                          - companion
                                                ext:
                                                  type: object
                                                  properties: {}
                                                  additionalProperties: {}
                                              additionalProperties: {}
                                          required:
                                            - country
                                            - regulation
                                          additionalProperties: {}
                                    required:
                                      - required
                                    additionalProperties: {}
                                  verification:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        verified_by:
                                          type: string
                                        verified_time:
                                          type: string
                                          format: date-time
                                          pattern: >-
                                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                                        result:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - authentic
                                            - type: string
                                              enum:
                                                - ai_generated
                                            - type: string
                                              enum:
                                                - ai_modified
                                            - type: string
                                              enum:
                                                - inconclusive
                                        confidence:
                                          type: number
                                          minimum: 0
                                          maximum: 1
                                        details_url:
                                          type: string
                                      required:
                                        - verified_by
                                        - result
                                      additionalProperties: {}
                                  ext:
                                    type: object
                                    properties: {}
                                    additionalProperties: {}
                                additionalProperties: {}
                            required:
                              - asset_type
                              - url
                              - width
                              - height
                            additionalProperties: {}
                          colors:
                            type: object
                            properties:
                              primary:
                                type: string
                                pattern: ^#[0-9a-fA-F]{6}$
                              secondary:
                                type: string
                                pattern: ^#[0-9a-fA-F]{6}$
                              accent:
                                type: string
                                pattern: ^#[0-9a-fA-F]{6}$
                            additionalProperties: {}
                          voice:
                            type: string
                          tagline:
                            type: string
                        additionalProperties: {}
                    required:
                      - domain
                    additionalProperties: {}
                  metric_id:
                    type: string
                  target:
                    anyOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - cost_per
                          value:
                            type: number
                        required:
                          - kind
                          - value
                        additionalProperties: {}
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - threshold_rate
                          value:
                            type: number
                        required:
                          - kind
                          - value
                        additionalProperties: {}
                  priority:
                    type: number
                    minimum: 1
                required:
                  - kind
                  - vendor
                  - metric_id
                additionalProperties: {}
        creative_ids:
          description: >-
            Explicit creative IDs to attach to this media buy. Pass an empty
            array to clear all creatives.
          type: array
          items:
            type: string
            minLength: 1
        updated_reason:
          description: Reason for the update (stored with the new version)
          type: string
          maxLength: 1000
      additionalProperties: false
    UpdateMediaBuyResponse:
      description: >-
        The updated media buy (why-visibility fields included) plus any
        non-blocking warnings.
      type: object
      properties:
        mediaBuy:
          $ref: '#/components/schemas/BuyerMediaBuy'
        warnings:
          description: >-
            Non-blocking notices about this update, e.g. a flight date fell
            outside the campaign window (the campaign window was widened to
            cover it, rather than failing the request).
          type: array
          items:
            type: string
      required:
        - mediaBuy
      additionalProperties: false
    ErrorResponse:
      description: Standard error response
      type: object
      properties:
        data:
          type: string
          nullable: true
          enum:
            - null
        error:
          $ref: '#/components/schemas/ApiError'
      required:
        - data
        - error
      additionalProperties: false
    UpdateMediaBuyPackageInput:
      description: Per-package update for a media buy with deployed packages
      type: object
      properties:
        packageId:
          description: Package ID to update
          type: string
          minLength: 1
        budget:
          description: Updated budget amount
          type: number
          minimum: 0
          exclusiveMinimum: true
        pacing:
          description: Updated pacing strategy
          type: string
          enum:
            - even
            - asap
            - front_loaded
        bidPrice:
          description: Updated bid price (CPM). Pass null to clear.
          nullable: true
          type: number
        startTime:
          description: >-
            Updated flight start date/time for this package (ISO 8601). Must
            fall within the media buy's date range.
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        endTime:
          description: >-
            Updated flight end date/time for this package (ISO 8601). Must fall
            within the media buy's date range.
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
      required:
        - packageId
      additionalProperties: false
    UpdateMediaBuyProductInput:
      description: >-
        Product update — additive (existing products not listed are preserved).
        Use remove: true to delete a product. Does not add brand-new product
        selections; use create_media_buys for that.
      type: object
      properties:
        productId:
          description: Product ID (must already be on this media buy)
          type: string
          minLength: 1
        pricingOptionId:
          description: >-
            The replacement pricing option must resolve to this media buy's
            existing settlement currency — update_media_buy does not re-split a
            buy across sales agents or currencies.
          type: string
        budget:
          type: number
          minimum: 0
          exclusiveMinimum: true
        pacing:
          type: string
          enum:
            - even
            - asap
            - front_loaded
        bidPrice:
          description: Updated bid price (CPM). Pass null to clear.
          nullable: true
          type: number
        remove:
          description: Set to true to remove this product from the media buy
          type: boolean
      required:
        - productId
      additionalProperties: false
    BuyerMediaBuy:
      description: >-
        A single media buy with its why-visibility annotation (pendingReason,
        errorCode, forwardedAt, buyerReference). Use get_campaign for packages,
        products, and delivery.
      type: object
      properties:
        mediaBuyId:
          description: Buyer media buy ID
          example: mb_ETBn4gJ9Wu
          type: string
        name:
          description: Media buy name
          type: string
        status:
          description: >-
            Interchange media buy status (DRAFT, PENDING_APPROVAL, ACTIVE,
            PAUSED, COMPLETED, CANCELED, FAILED, REJECTED).
          example: PENDING_APPROVAL
          type: string
        pendingAt:
          description: >-
            Which layer the buy is parked at; only present while status is
            PENDING_APPROVAL. Use pendingReason for the specific wait.
          type: string
          enum:
            - storefront
            - salesagent
            - unknown
        pendingChange:
          description: >-
            A submitted change that has not yet reached the delivering buy.
            Every other field on this object describes what is LIVE, so this is
            the only place a queued change surfaces. Absent when there is
            nothing pending.
          allOf:
            - $ref: '#/components/schemas/MediaBuyPendingChange'
        pendingReason:
          description: >-
            Why the buy is not delivering yet, rolled up to the most-blocking
            wait across its legs. An annotation derived from persisted
            forwarding state — never a status. Absent when the buy is
            delivering, terminal, or not storefront-routed.
          allOf:
            - $ref: '#/components/schemas/MediaBuyPendingReason'
        pendingSince:
          description: >-
            When the current wait began (ISO 8601). Present when pendingReason
            is set and the start of the wait is known.
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        errorCode:
          description: >-
            Buyer-safe structured error code when forwarding failed or the buy
            was rejected. Internal platform codes are mapped to this set and
            never emitted raw.
          allOf:
            - $ref: '#/components/schemas/BuyerMediaBuyErrorCode'
        errorOwner:
          description: >-
            Which party owns fixing the error. Present whenever errorCode is
            present.
          allOf:
            - $ref: '#/components/schemas/MediaBuyErrorOwner'
        sourceMessage:
          description: >-
            The source's rejection or moderation message, when one was provided
            — whitespace-collapsed, truncated, and known upstream identifiers
            removed.
          type: string
        forwardedAt:
          description: >-
            When the buy was forwarded to its inventory source(s) (ISO 8601).
            Absent when it has not been forwarded.
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        buyerReference:
          description: >-
            Support reference for this buy (`sf:<storefrontId>:<mediaBuyId>`).
            Quote it with the request timestamp when contacting the seller or
            Scope3 support.
          example: sf:42:sf_mb_1783031864469_8pbc8mmr
          type: string
        startTime:
          description: 'When this media buy starts: "asap" or an ISO 8601 date-time.'
          type: string
        endTime:
          description: When this media buy ends (ISO 8601).
          type: string
        createdAt:
          description: When the media buy was created (ISO 8601)
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        updatedAt:
          description: When the media buy was last updated (ISO 8601)
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
      required:
        - mediaBuyId
        - name
        - status
        - createdAt
        - updatedAt
      additionalProperties: false
    ApiError:
      description: Structured error object
      type: object
      properties:
        code:
          description: Machine-readable error code
          type: string
        message:
          description: Human-readable error message
          type: string
        field:
          description: Field path associated with the error
          type: string
        details:
          description: Additional error context
          type: object
          additionalProperties: {}
      required:
        - code
        - message
      additionalProperties: false
    MediaBuyPendingChange:
      description: >-
        A buyer-submitted change that has been accepted by Interchange but has
        NOT yet taken effect on the delivering buy. Its presence is the signal
        that this buy has an unapplied change; absence means everything reported
        is live. Never treat these values as delivering.
      type: object
      properties:
        status:
          description: >-
            Lifecycle status of the pending change itself, typically
            PENDING_APPROVAL. This is NOT the status of the buy: the buy keeps
            its own top-level status, which reflects what is delivering now.
          example: PENDING_APPROVAL
          type: string
        pendingAt:
          description: >-
            Which layer the pending change is parked at. 'storefront' = waiting
            on the storefront operator's manual approval, 'salesagent' = the
            inventory source is still processing it, 'unknown' = indeterminate.
          type: string
          enum:
            - storefront
            - salesagent
            - unknown
        reason:
          description: >-
            Reason recorded when the change was submitted, when one was
            supplied.
          example: Extended to 8/11 with W5+W6 gross budget
          type: string
        differences:
          description: >-
            Only the fields whose pending value differs from live appear here.
            An empty object means a pending change exists whose comparable
            fields already match live.
          type: object
          properties:
            endTime:
              description: Flight end date change (ISO 8601).
              type: object
              properties:
                live:
                  description: The value currently in effect on the delivering buy.
                  type: string
                proposed:
                  description: The value the pending change would set.
                  type: string
              additionalProperties: false
            budget:
              description: >-
                Total budget change in the buy's currency, summed across its
                packages.
              type: object
              properties:
                live:
                  description: The value currently in effect on the delivering buy.
                  type: number
                proposed:
                  description: The value the pending change would set.
                  type: number
              additionalProperties: false
          additionalProperties: false
      required:
        - status
        - differences
      additionalProperties: false
    MediaBuyPendingReason:
      description: >-
        Why a not-yet-delivering media buy is waiting, and implicitly whose side
        owns the wait. A platform-derived annotation — never a status value.
        awaiting_storefront_approval / awaiting_source_moderation /
        creative_processing_at_source / awaiting_creative_approval = the seller
        side owns the wait; no_creatives_attached / source_rejected_creatives =
        the buyer owns it (attach or fix creatives); forward_failed_retrying /
        forward_failed_needs_correction = the platform owns it;
        accepted_awaiting_trafficking / scheduled_not_started = nothing is
        wrong, the buy is queued or scheduled.
      type: string
      enum:
        - forward_failed_needs_correction
        - forward_failed_retrying
        - awaiting_storefront_approval
        - awaiting_source_moderation
        - no_creatives_attached
        - source_rejected_creatives
        - creative_processing_at_source
        - awaiting_creative_approval
        - accepted_awaiting_trafficking
        - scheduled_not_started
    BuyerMediaBuyErrorCode:
      description: >-
        Buyer-safe structured error code for a media buy that failed to forward
        or was rejected. Paired with errorOwner (who owns the fix) and, when the
        source provided one, a sanitized human-readable message.
      type: string
      enum:
        - product_no_longer_available
        - source_rejected
        - storefront_rejected
        - source_unavailable
        - invalid_request
        - quote_expired
        - platform_error
    MediaBuyErrorOwner:
      description: >-
        Which party owns fixing the error: buyer_input (the request needs a
        correction from the buyer), platform (Scope3 owns the fault), seller
        (the storefront or its source made the decision or is unavailable).
      type: string
      enum:
        - buyer_input
        - platform
        - seller
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key or access token

````