> ## 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.

# Create or update an event source



## OpenAPI

````yaml /openapi/buyer.yaml post /api/v2/buyer/event-sources
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/event-sources:
    post:
      tags:
        - Event Sources
      summary: Create or update an event source
      operationId: postBuyerEventSources
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                eventSourceId:
                  type: string
                  minLength: 1
                  maxLength: 100
                advertiserId:
                  anyOf:
                    - type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                    - type: string
                      pattern: ^[1-9]\d*$
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                eventTypes:
                  minItems: 1
                  type: array
                  items:
                    type: string
                    enum:
                      - page_view
                      - view_content
                      - add_to_cart
                      - initiate_checkout
                      - purchase
                      - lead
                      - complete_registration
                      - subscribe
                      - app_install
                      - custom
                integrationPlatform:
                  type: string
                  maxLength: 100
                allowedDomains:
                  maxItems: 50
                  type: array
                  items:
                    type: string
                    minLength: 3
                confirm:
                  type: boolean
                confirmationUid:
                  type: string
                  minLength: 5
              required:
                - eventSourceId
                - eventTypes
              additionalProperties: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    anyOf:
                      - type: object
                        properties:
                          created:
                            type: boolean
                          source:
                            type: object
                            properties:
                              eventSourceId:
                                type: string
                              name:
                                type: string
                              eventTypes:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - page_view
                                    - view_content
                                    - add_to_cart
                                    - initiate_checkout
                                    - purchase
                                    - lead
                                    - complete_registration
                                    - subscribe
                                    - app_install
                                    - custom
                              allowedDomains:
                                type: array
                                items:
                                  type: string
                              integrationPlatform:
                                type:
                                  - string
                                  - 'null'
                              health:
                                type: string
                                enum:
                                  - not_seen
                                  - receiving
                                  - needs_attention
                              lastEventAt:
                                anyOf:
                                  - 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|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                                  - type: 'null'
                              eventsLast24h:
                                type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              eventsLast7d:
                                type: integer
                                minimum: 0
                                maximum: 9007199254740991
                            required:
                              - eventSourceId
                              - name
                              - eventTypes
                              - allowedDomains
                              - integrationPlatform
                              - health
                              - lastEventAt
                              - eventsLast24h
                              - eventsLast7d
                            additionalProperties: false
                        required:
                          - created
                          - source
                        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

````