Dapr PubSub API

Publish and subscribe messaging operations.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

dapr-pubsub-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Dapr Actors PubSub API
  description: The Dapr Actors API provides virtual actor capabilities for distributed applications, including actor method invocation, state management, timers, and reminders. Actors provide a single-threaded programming model with guaranteed message ordering.
  version: 1.0.0
  contact:
    name: Dapr
    url: https://dapr.io
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost:3500
  description: Dapr Sidecar
tags:
- name: PubSub
  description: Publish and subscribe messaging operations.
paths:
  /v1.0/publish/{pubsubname}/{topic}:
    post:
      summary: Dapr Publish Event
      description: Publishes an event to the specified topic on the given pub/sub component. If content type is not application/cloudevents+json, the payload is automatically wrapped in a CloudEvent envelope.
      operationId: publishEvent
      tags:
      - PubSub
      parameters:
      - name: pubsubname
        in: path
        required: true
        description: The name of the pub/sub component.
        schema:
          type: string
      - name: topic
        in: path
        required: true
        description: The name of the topic.
        schema:
          type: string
      - name: metadata.rawPayload
        in: query
        description: Set to true to disable CloudEvent wrapping of the payload.
        schema:
          type: string
      - name: metadata.ttlInSeconds
        in: query
        description: Time-to-live for the message in seconds.
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema: {}
          application/cloudevents+json:
            schema: {}
      responses:
        '204':
          description: Event published successfully.
        '403':
          description: Event forbidden by access controls.
        '404':
          description: Pub/sub component not found.
        '500':
          description: Failed to publish event.
  /v1.0/publish/bulk/{pubsubname}/{topic}:
    post:
      summary: Dapr Bulk Publish Events
      description: Publishes multiple events to the specified topic in a single request.
      operationId: bulkPublishEvents
      tags:
      - PubSub
      parameters:
      - name: pubsubname
        in: path
        required: true
        description: The name of the pub/sub component.
        schema:
          type: string
      - name: topic
        in: path
        required: true
        description: The name of the topic.
        schema:
          type: string
      - name: metadata.rawPayload
        in: query
        description: Set to true to disable CloudEvent wrapping.
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                required:
                - entryId
                - event
                properties:
                  entryId:
                    type: string
                    description: Unique identifier for the entry.
                  event:
                    description: The event data.
                  contentType:
                    type: string
                    description: Content type of the event.
                  metadata:
                    type: object
                    additionalProperties:
                      type: string
      responses:
        '200':
          description: Bulk publish completed (may include partial failures).
          content:
            application/json:
              schema:
                type: object
                properties:
                  failedEntries:
                    type: array
                    items:
                      type: object
                      properties:
                        entryId:
                          type: string
                        error:
                          type: string
        '404':
          description: Pub/sub component not found.
        '500':
          description: Failed to publish events.
externalDocs:
  description: Dapr Actors API Reference
  url: https://docs.dapr.io/reference/api/actors_api/