openapi: 3.1.0 info: title: Azure Event Hubs Data Plane REST API description: >- The Azure Event Hubs Data Plane REST API enables you to send events to and interact with Event Hubs directly. This API operates against the Event Hubs service endpoint at {namespace}.servicebus.windows.net and supports sending individual events, batch events, partition-specific events, and events with publisher identity. Authentication is via Azure Active Directory tokens or Shared Access Signature (SAS) tokens. version: '2014-01' contact: name: Microsoft Azure Support url: https://azure.microsoft.com/en-us/support/ license: name: Microsoft Azure Terms of Service url: https://azure.microsoft.com/en-us/support/legal/ x-logo: url: https://azure.microsoft.com/svghandler/event-hubs/ servers: - url: https://{namespaceName}.servicebus.windows.net description: Azure Event Hubs Service Endpoint variables: namespaceName: description: The Event Hubs namespace name. default: my-namespace security: - sas_token: [] - bearer_token: [] paths: /{eventHubPath}/messages: post: operationId: SendEvent summary: Azure Event Hubs Send event description: >- Sends a new event to an event hub. The event body can be any content type. Custom user properties can be set via the UserProperties header. tags: - Events parameters: - $ref: '#/components/parameters/EventHubPathParameter' - $ref: '#/components/parameters/ApiVersionParameter' - $ref: '#/components/parameters/TimeoutParameter' - name: x-ms-retrypolicy in: header required: false description: >- Set to NoRetry to disable automatic retry on send operations when transient errors occur. schema: type: string enum: - NoRetry requestBody: required: true description: >- The body of the event message. Can be plain text, JSON, or any other content type. content: application/atom+xml;type=entry;charset=utf-8: schema: $ref: '#/components/schemas/EventBody' application/json: schema: $ref: '#/components/schemas/EventBody' application/octet-stream: schema: type: string format: binary responses: '201': description: Event sent successfully. headers: Content-Type: description: Response content type. schema: type: string content: application/xml: schema: type: string '401': description: Authorization failure. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal error. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' /{eventHubPath}/messages?batch=true: post: operationId: SendBatchEvents summary: Azure Event Hubs Send batch events description: >- Sends a new batched message event to an Event Hub. Batching reduces the number of messages that are transmitted by merging information from multiple messages into a single batch of messages. The message body must be a valid JSON array payload following the convention to describe each message. The Content-Type header must be set to application/vnd.microsoft.servicebus.json. tags: - Events parameters: - $ref: '#/components/parameters/EventHubPathParameter' - $ref: '#/components/parameters/ApiVersionParameter' - $ref: '#/components/parameters/TimeoutParameter' - name: x-ms-retrypolicy in: header required: false description: >- Set to NoRetry to disable automatic retry on send operations when transient errors occur. schema: type: string enum: - NoRetry requestBody: required: true description: >- JSON payload that contains the content of multiple messages. Each message object must have a Body property. UserProperties can be set per message in the batch payload. content: application/vnd.microsoft.servicebus.json: schema: $ref: '#/components/schemas/BatchEventPayload' example: - Body: Message1 UserProperties: Alert: Strong Wind - Body: Message2 - Body: Message3 responses: '201': description: Batch events sent successfully. content: application/xml: schema: type: string '401': description: Authorization failure. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal error. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' /{eventHubPath}/partitions/{partitionId}/messages: post: operationId: SendPartitionEvent summary: Azure Event Hubs Send partition event description: >- Sends a new event to a specified partition in an Event Hub. This allows you to target a specific partition for the event rather than letting Event Hubs distribute it. tags: - Events parameters: - $ref: '#/components/parameters/EventHubPathParameter' - $ref: '#/components/parameters/PartitionIdParameter' - $ref: '#/components/parameters/ApiVersionParameter' - $ref: '#/components/parameters/TimeoutParameter' - name: x-ms-retrypolicy in: header required: false description: >- Set to NoRetry to disable automatic retry on send operations when transient errors occur. schema: type: string enum: - NoRetry requestBody: required: true description: The body of the event message. content: application/atom+xml;type=entry;charset=utf-8: schema: $ref: '#/components/schemas/EventBody' application/json: schema: $ref: '#/components/schemas/EventBody' application/octet-stream: schema: type: string format: binary responses: '201': description: Partition event sent successfully. content: application/xml: schema: type: string '401': description: Authorization failure. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal error. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' /{eventHubPath}/publishers/{publisherId}/messages: post: operationId: SendEventWithPublisherId summary: Azure Event Hubs Send event with publisher ID description: >- Sends a new event to an Event Hub with a specified publisher ID. This enables publisher identity tracking and publisher policy enforcement on the event hub. tags: - Events parameters: - $ref: '#/components/parameters/EventHubPathParameter' - $ref: '#/components/parameters/PublisherIdParameter' - $ref: '#/components/parameters/ApiVersionParameter' - $ref: '#/components/parameters/TimeoutParameter' - name: x-ms-retrypolicy in: header required: false description: >- Set to NoRetry to disable automatic retry on send operations when transient errors occur. schema: type: string enum: - NoRetry requestBody: required: true description: The body of the event message. content: application/atom+xml;type=entry;charset=utf-8: schema: $ref: '#/components/schemas/EventBody' application/json: schema: $ref: '#/components/schemas/EventBody' application/octet-stream: schema: type: string format: binary responses: '201': description: Event with publisher ID sent successfully. content: application/xml: schema: type: string '401': description: Authorization failure. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal error. content: application/xml: schema: $ref: '#/components/schemas/ErrorResponse' components: securitySchemes: sas_token: type: apiKey in: header name: Authorization description: >- Shared Access Signature token. Format: SharedAccessSignature sr={namespace}.servicebus.windows.net&sig={signature}&se={expiry}&skn={keyName} bearer_token: type: http scheme: bearer bearerFormat: JWT description: >- Azure Active Directory (Azure AD) JSON Web Token (JWT). Format: Bearer {Azure AD JWT token} parameters: EventHubPathParameter: name: eventHubPath in: path required: true description: The path to the event hub. schema: type: string PartitionIdParameter: name: partitionId in: path required: true description: The ID of a partition on an event hub. schema: type: string PublisherIdParameter: name: publisherId in: path required: true description: The name of the publisher. schema: type: string ApiVersionParameter: name: api-version in: query required: true description: The API version to use for the request. schema: type: string default: '2014-01' TimeoutParameter: name: timeout in: query required: false description: >- Timeout for the REST operation in seconds. The value is between 1 and 120 seconds. schema: type: integer minimum: 1 maximum: 120 default: 60 schemas: EventBody: description: >- The body of an event message. Can be any valid JSON, plain text, or binary data. oneOf: - type: object additionalProperties: true description: JSON event payload. - type: string description: Plain text event payload. BatchEventPayload: type: array description: >- An array of event messages for batch sending. Each message must have a Body field. UserProperties can optionally be included per message. items: $ref: '#/components/schemas/BatchEventMessage' BatchEventMessage: type: object description: A single message within a batch of events. required: - Body properties: Body: description: The body content of the event message. oneOf: - type: string - type: object additionalProperties: true UserProperties: type: object additionalProperties: type: string description: >- Custom properties associated with the event message. These are user-defined key-value pairs. BrokerProperties: type: object description: Broker-level properties for the message. properties: PartitionKey: type: string description: >- The partition key used to determine the partition to send the event to. Label: type: string description: Application-specific label. MessageId: type: string description: The unique identifier of the message. CorrelationId: type: string description: The correlation identifier. SessionId: type: string description: The session identifier. ReplyTo: type: string description: The address to reply to. ErrorResponse: type: object description: Error response from the Event Hubs service. properties: code: type: integer description: The error code. detail: type: string description: The error detail message. tags: - name: Events description: >- Operations for sending events to Azure Event Hubs, including single events, batch events, partition-specific events, and events with publisher identity.