Google Cloud Pub/Sub Subscriptions API

Operations for managing Pub/Sub subscriptions

OpenAPI Specification

google-cloud-pubsub-subscriptions-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Google Cloud Pub/Sub Schemas Subscriptions 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: Subscriptions
  description: Operations for managing Pub/Sub subscriptions
paths:
  /projects/{projectId}/subscriptions:
    get:
      operationId: listSubscriptions
      summary: Google Cloud Pub/Sub List subscriptions
      description: Lists matching subscriptions in the given project.
      tags:
      - Subscriptions
      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/ListSubscriptionsResponse'
  /projects/{projectId}/subscriptions/{subscriptionId}:
    get:
      operationId: getSubscription
      summary: Google Cloud Pub/Sub Get a subscription
      description: Gets the configuration details of a subscription.
      tags:
      - Subscriptions
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: subscriptionId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
    put:
      operationId: createSubscription
      summary: Google Cloud Pub/Sub Create a subscription
      description: Creates a subscription to a given topic.
      tags:
      - Subscriptions
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: subscriptionId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Subscription'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
    delete:
      operationId: deleteSubscription
      summary: Google Cloud Pub/Sub Delete a subscription
      description: Deletes an existing subscription.
      tags:
      - Subscriptions
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: subscriptionId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
  /projects/{projectId}/subscriptions/{subscriptionId}:pull:
    post:
      operationId: pullMessages
      summary: Google Cloud Pub/Sub Pull messages
      description: Pulls messages from the server.
      tags:
      - Subscriptions
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: subscriptionId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                maxMessages:
                  type: integer
                  description: Required. Maximum number of messages to return.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  receivedMessages:
                    type: array
                    items:
                      $ref: '#/components/schemas/ReceivedMessage'
  /projects/{projectId}/subscriptions/{subscriptionId}:acknowledge:
    post:
      operationId: acknowledgeMessages
      summary: Google Cloud Pub/Sub Acknowledge messages
      description: Acknowledges the messages associated with the ack IDs in the request.
      tags:
      - Subscriptions
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      - name: subscriptionId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ackIds:
                  type: array
                  items:
                    type: string
      responses:
        '200':
          description: Successful response
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
    ListSubscriptionsResponse:
      type: object
      properties:
        subscriptions:
          type: array
          items:
            $ref: '#/components/schemas/Subscription'
        nextPageToken:
          type: string
    ReceivedMessage:
      type: object
      properties:
        ackId:
          type: string
        message:
          $ref: '#/components/schemas/PubsubMessage'
        deliveryAttempt:
          type: integer
    Subscription:
      type: object
      properties:
        name:
          type: string
          description: The name of the subscription.
        topic:
          type: string
          description: The name of the topic from which this subscription receives messages.
        pushConfig:
          type: object
          properties:
            pushEndpoint:
              type: string
            attributes:
              type: object
              additionalProperties:
                type: string
            oidcToken:
              type: object
              properties:
                serviceAccountEmail:
                  type: string
                audience:
                  type: string
        ackDeadlineSeconds:
          type: integer
          description: The approximate amount of time Pub/Sub waits for acknowledgment.
        retainAckedMessages:
          type: boolean
        messageRetentionDuration:
          type: string
        labels:
          type: object
          additionalProperties:
            type: string
        enableMessageOrdering:
          type: boolean
        expirationPolicy:
          type: object
          properties:
            ttl:
              type: string
        filter:
          type: string
          description: Expression to filter messages.
        deadLetterPolicy:
          type: object
          properties:
            deadLetterTopic:
              type: string
            maxDeliveryAttempts:
              type: integer
        retryPolicy:
          type: object
          properties:
            minimumBackoff:
              type: string
            maximumBackoff:
              type: string
        detached:
          type: boolean
        enableExactlyOnceDelivery:
          type: boolean
        state:
          type: string
          enum:
          - STATE_UNSPECIFIED
          - ACTIVE
          - RESOURCE_ERROR
  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