Azure Event Grid Publish API

Publish events to a topic

OpenAPI Specification

azure-event-grid-publish-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Azure Event Grid Publisher Namespace Topics Publish API
  version: '2018-01-01'
  description: 'Data-plane REST API for publishing events to Azure Event Grid topics, domains,

    and namespace topics. Supports the Event Grid event schema, the CloudEvents 1.0

    schema, and custom schemas. Authentication is via Microsoft Entra ID OAuth 2.0

    bearer tokens or the topic''s shared-access key sent in the `aeg-sas-key` header

    (or a SAS token in the `aeg-sas-token` header).

    '
  contact:
    name: Azure Event Grid
    url: https://learn.microsoft.com/en-us/rest/api/eventgrid/
servers:
- url: https://{topic-endpoint}
  description: Event Grid topic or domain endpoint (e.g. https://my-topic.eastus-1.eventgrid.azure.net)
  variables:
    topic-endpoint:
      default: my-topic.eastus-1.eventgrid.azure.net
      description: Topic or domain endpoint host
tags:
- name: Publish
  description: Publish events to a topic
paths:
  /api/events:
    post:
      summary: Publish events to a topic
      description: 'Publish a batch of Event Grid events or CloudEvents to a topic or domain.

        The request body is an array; the schema depends on whether the topic is

        configured for `EventGridSchema`, `CloudEventSchemaV1_0`, or a custom schema.

        '
      operationId: publishEvents
      tags:
      - Publish
      parameters:
      - in: query
        name: api-version
        schema:
          type: string
          default: '2018-01-01'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
              - type: array
                items:
                  $ref: '#/components/schemas/EventGridEvent'
              - type: array
                items:
                  $ref: '#/components/schemas/CloudEvent'
          application/cloudevents-batch+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/CloudEvent'
          application/cloudevents+json:
            schema:
              $ref: '#/components/schemas/CloudEvent'
      responses:
        '200':
          description: Events accepted
      security:
      - sasKey: []
      - sasToken: []
      - entra: []
components:
  schemas:
    CloudEvent:
      type: object
      required:
      - id
      - source
      - type
      - specversion
      properties:
        id:
          type: string
        source:
          type: string
          format: uri
        type:
          type: string
        specversion:
          type: string
          enum:
          - '1.0'
        time:
          type: string
          format: date-time
        datacontenttype:
          type: string
        subject:
          type: string
        data: {}
        data_base64:
          type: string
          format: byte
    EventGridEvent:
      type: object
      required:
      - id
      - subject
      - data
      - eventType
      - eventTime
      - dataVersion
      properties:
        id:
          type: string
        topic:
          type: string
        subject:
          type: string
        data: {}
        eventType:
          type: string
        eventTime:
          type: string
          format: date-time
        metadataVersion:
          type: string
        dataVersion:
          type: string
  securitySchemes:
    sasKey:
      type: apiKey
      in: header
      name: aeg-sas-key
      description: Topic shared-access key
    sasToken:
      type: apiKey
      in: header
      name: aeg-sas-token
      description: Topic shared-access signature token
    entra:
      type: oauth2
      description: Microsoft Entra ID OAuth 2.0 bearer token
      flows:
        clientCredentials:
          tokenUrl: https://login.microsoftonline.com/common/oauth2/v2.0/token
          scopes:
            https://eventgrid.azure.net/.default: Publish/receive Event Grid events