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

# Stage or execute selections onto the DRAFT campaign



## OpenAPI

````yaml /openapi/buyer.yaml post /api/v2/buyer/media-buys/batch
openapi: 3.1.0
info:
  title: Semicola Exchange buyer API
  version: 2.0.0
  description: >-
    Buyer endpoints: advertisers, storefronts and connections, product
    discovery, campaigns, proposals, media buys, creatives and reporting. Every
    write accepts an Idempotency-Key header.
servers:
  - url: https://api.semicola.com
security:
  - bearerAuth: []
  - sessionCookie: []
tags:
  - name: Advertisers
  - name: Storefronts
  - name: Product Discovery
  - name: Campaigns
  - name: Media Buys
  - name: Creatives
  - name: Reporting
  - name: Event Sources
  - name: Webhooks
  - name: Tasks
  - name: Audit Logs
paths:
  /api/v2/buyer/media-buys/batch:
    post:
      tags:
        - Media Buys
      summary: Stage or execute selections onto the DRAFT campaign
      operationId: postBuyerMediaBuysBatch
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            minLength: 16
            maxLength: 255
            pattern: ^[A-Za-z0-9_.:-]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                productQueryId:
                  type: string
                  minLength: 1
                campaign:
                  anyOf:
                    - type: object
                      properties:
                        campaignId:
                          type: string
                          minLength: 1
                      required:
                        - campaignId
                    - type: object
                      properties:
                        create:
                          type: object
                          properties:
                            advertiserId:
                              type: integer
                              exclusiveMinimum: 0
                              maximum: 9007199254740991
                            name:
                              type: string
                              minLength: 1
                              maxLength: 200
                            brief:
                              type: string
                              maxLength: 20000
                            flightDates:
                              type: object
                              properties:
                                startDate:
                                  type: string
                                  pattern: ^\d{4}-\d{2}-\d{2}$
                                endDate:
                                  type: string
                                  pattern: ^\d{4}-\d{2}-\d{2}$
                              required:
                                - startDate
                                - endDate
                            budget:
                              type: object
                              properties:
                                total:
                                  type: string
                                  pattern: ^-?\d+(\.\d{1,6})?$
                                currency:
                                  type: string
                                  pattern: ^[A-Z]{3}$
                                dailyCap:
                                  type: string
                                  pattern: ^-?\d+(\.\d{1,6})?$
                                pacing:
                                  default: EVEN
                                  type: string
                                  enum:
                                    - EVEN
                                    - ASAP
                                    - FRONTLOADED
                              required:
                                - total
                                - currency
                            management:
                              default: managed
                              type: string
                              enum:
                                - managed
                                - tracked
                            constraints:
                              type: object
                              properties:
                                countries:
                                  type: array
                                  items:
                                    type: string
                                    pattern: ^[A-Z]{2}$
                                channels:
                                  type: array
                                  items:
                                    type: string
                                    enum:
                                      - display
                                      - olv
                                      - social
                                      - search
                                      - ctv
                                      - linear_tv
                                      - radio
                                      - streaming_audio
                                      - podcast
                                      - dooh
                                      - ooh
                                      - print
                                      - cinema
                                      - email
                                      - gaming
                                      - retail_media
                                      - influencer
                                      - affiliate
                                      - product_placement
                                      - sponsored_intelligence
                                geoRegions:
                                  type: array
                                  items:
                                    type: string
                                geoMetros:
                                  type: array
                                  items:
                                    type: string
                                language:
                                  type: string
                                audience:
                                  type: string
                                ageRange:
                                  type: object
                                  properties:
                                    min:
                                      type: integer
                                      minimum: -9007199254740991
                                      maximum: 9007199254740991
                                    max:
                                      type: integer
                                      minimum: -9007199254740991
                                      maximum: 9007199254740991
                                  required:
                                    - min
                                    - max
                            autonomy:
                              type: object
                              properties:
                                inventorySelection:
                                  type: string
                                  enum:
                                    - manual
                                    - propose
                                    - automatic
                                rebriefing:
                                  type: string
                                  enum:
                                    - manual
                                    - propose
                                    - automatic
                              required:
                                - inventorySelection
                                - rebriefing
                            storefrontIds:
                              type: array
                              items:
                                type: integer
                                exclusiveMinimum: 0
                                maximum: 9007199254740991
                            discoveryId:
                              type: string
                          required:
                            - advertiserId
                            - name
                            - flightDates
                            - budget
                      required:
                        - create
                mode:
                  type: string
                  enum:
                    - stage
                    - execute
                selections:
                  minItems: 1
                  type: array
                  items:
                    type: object
                    properties:
                      productId:
                        type: string
                      storefrontId:
                        type: integer
                        exclusiveMinimum: 0
                        maximum: 9007199254740991
                      pricingOptionId:
                        type: string
                      budget:
                        type: string
                        pattern: ^-?\d+(\.\d{1,6})?$
                      bidPrice:
                        type: string
                        pattern: ^-?\d+(\.\d{1,6})?$
                      groupId:
                        type: string
                    required:
                      - productId
                      - storefrontId
                      - pricingOptionId
                replace:
                  type: boolean
              required:
                - productQueryId
                - campaign
                - mode
                - selections
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    anyOf:
                      - type: object
                        properties:
                          campaignId:
                            type: string
                          campaignCreated:
                            type: boolean
                          mediaBuyRefs:
                            type: array
                            items:
                              type: object
                              properties:
                                mediaBuyId:
                                  type: string
                                status:
                                  type: string
                                pendingAt:
                                  type:
                                    - string
                                    - 'null'
                              required:
                                - mediaBuyId
                                - status
                                - pendingAt
                              additionalProperties: false
                          errors:
                            type: array
                            items:
                              type: object
                              properties:
                                storefrontId:
                                  type: integer
                                  minimum: -9007199254740991
                                  maximum: 9007199254740991
                                code:
                                  type: string
                                message:
                                  type: string
                              required:
                                - storefrontId
                                - code
                                - message
                              additionalProperties: false
                          noOp:
                            type: boolean
                        required:
                          - campaignId
                          - campaignCreated
                          - mediaBuyRefs
                          - errors
                          - noOp
                        additionalProperties: false
                      - type: 'null'
                  error:
                    anyOf:
                      - type: object
                        properties:
                          code:
                            type: string
                          message:
                            type: string
                          field:
                            type: string
                          details: {}
                        required:
                          - code
                          - message
                        additionalProperties: false
                      - type: 'null'
                required:
                  - data
                  - error
                additionalProperties: false
        default:
          description: >-
            Error envelope `{data: null, error: {code, message, field?,
            details?}}`.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key or OAuth access token.
    sessionCookie:
      type: apiKey
      in: cookie
      name: sc_session

````