Google Cloud Pub/Sub Topics API

Operations for managing Pub/Sub topics

OpenAPI Specification

google-cloud-pubsub-topics-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Google Cloud Pub/Sub Schemas Topics API
  description: The Cloud Pub/Sub API provides reliable, many-to-many, asynchronous messaging between applications. Publishers send messages to topics, and subscribers receive messages via subscriptions. It supports both push and pull delivery modes.
  version: v1
  contact:
    name: Google Cloud
    url: https://cloud.google.com/pubsub
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://pubsub.googleapis.com/v1
  description: Google Cloud Pub/Sub API v1
security:
- oauth2: []
tags:
- name: Topics
  description: Operations for managing Pub/Sub topics
paths:
  /projects/{projectId}/topics:
    get:
      operationId: listTopics
      summary: Google Cloud Pub/Sub List topics
      description: Lists matching topics in the given project.
      tags:
      - Topics
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: pageSize
        in: query
        schema:
          type: integer
      - name: pageToken
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListTopicsResponse'
  /projects/{projectId}/topics/{topicId}:
    get:
      operationId: getTopic
      summary: Google Cloud Pub/Sub Get a topic
      description: Gets the configuration of a topic.
      tags:
      - Topics
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: topicId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Topic'
    put:
      operationId: createTopic
      summary: Google Cloud Pub/Sub Create a topic
      description: Creates the given topic with the given name.
      tags:
      - Topics
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: topicId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Topic'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Topic'
    delete:
      operationId: deleteTopic
      summary: Google Cloud Pub/Sub Delete a topic
      description: Deletes the topic with the given name.
      tags:
      - Topics
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: topicId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
  /projects/{projectId}/topics/{topicId}:publish:
    post:
      operationId: publishMessages
      summary: Google Cloud Pub/Sub Publish messages
      description: Adds one or more messages to the topic.
      tags:
      - Topics
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: topicId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                messages:
                  type: array
                  items:
                    $ref: '#/components/schemas/PubsubMessage'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  messageIds:
                    type: array
                    items:
                      type: string
components:
  schemas:
    PubsubMessage:
      type: object
      properties:
        data:
          type: string
          description: The message data field (base64-encoded).
        attributes:
          type: object
          additionalProperties:
            type: string
        messageId:
          type: string
          description: Output only. ID of this message.
        publishTime:
          type: string
          format: date-time
          description: Output only. The time at which the message was published.
        orderingKey:
          type: string
    Topic:
      type: object
      properties:
        name:
          type: string
          description: The name of the topic in the format projects/{project}/topics/{topic}.
        labels:
          type: object
          additionalProperties:
            type: string
        messageStoragePolicy:
          type: object
          properties:
            allowedPersistenceRegions:
              type: array
              items:
                type: string
        kmsKeyName:
          type: string
          description: The resource name of the Cloud KMS key to protect access to messages.
        schemaSettings:
          type: object
          properties:
            schema:
              type: string
            encoding:
              type: string
              enum:
              - ENCODING_UNSPECIFIED
              - JSON
              - BINARY
            firstRevisionId:
              type: string
            lastRevisionId:
              type: string
        satisfiesPzs:
          type: boolean
        messageRetentionDuration:
          type: string
          description: Duration for message retention, in seconds format (e.g. 86400s).
    ListTopicsResponse:
      type: object
      properties:
        topics:
          type: array
          items:
            $ref: '#/components/schemas/Topic'
        nextPageToken:
          type: string
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          tokenUrl: https://oauth2.googleapis.com/token
          scopes:
            https://www.googleapis.com/auth/pubsub: View and manage Pub/Sub topics and subscriptions
            https://www.googleapis.com/auth/cloud-platform: Full access to Google Cloud Platform
externalDocs:
  description: Google Cloud Pub/Sub Documentation
  url: https://cloud.google.com/pubsub/docs/reference/rest