> ## Documentation Index
> Fetch the complete documentation index at: https://docs.primev.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscribe

> Subscribe to notifications for given topics. The client will receive
notifications for the topics it has subscribed to. The client can
subscribe to multiple topics.



## OpenAPI

````yaml /v1.2.x/api-reference/notifications-openapi-spec.json post /v1/subscribe
openapi: 3.0.0
info:
  title: Notifications API
  version: 1.1.5-oas3
  license:
    name: Business Source License 1.1
    url: https://github.com/primev/mev-commit/blob/main/LICENSE
servers: []
security: []
paths:
  /v1/subscribe:
    post:
      summary: Subscribe
      description: |-
        Subscribe to notifications for given topics. The client will receive
        notifications for the topics it has subscribed to. The client can
        subscribe to multiple topics.
      operationId: Notifications_Subscribe
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1SubscribeRequest'
        required: true
      responses:
        '200':
          description: A successful response.(streaming responses)
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    $ref: '#/components/schemas/v1Notification'
                  error:
                    $ref: '#/components/schemas/googlerpcStatus'
                title: Stream result of v1Notification
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googlerpcStatus'
components:
  schemas:
    v1SubscribeRequest:
      type: object
      properties:
        topics:
          type: array
          example:
            - peer_connected
            - validator_opted_in
          items:
            type: string
          description: >-
            List of topics to subscribe to. Available topics:


            - **peer_connected**: Emitted when a peer connects to the network

            - **peer_disconnected**: Emitted when a peer disconnects from the
            network

            - **validator_opted_in**: Emitted before an upcoming L1 block
            proposer has opted in to the mev-commit protocol

            - **epoch_validators_opted_in**: Emitted at the beginning of an
            epoch, specifying any slots where the L1 validator is opted-in to
            mev-commit

            - **provider_slashed**: Emitted when the provider node is slashed.

            - **commitment_store_failed**: Emitted when the commitment storing
            transaction fails.

            - **commitment_open_failed**: Emitted when the commitment opening
            transaction fails.
          title: Topics to subscribe to
      title: >-
        SubscribeRequest represents a request to subscribe to notification
        topics
    v1Notification:
      type: object
      properties:
        topic:
          type: string
          example: peer_connected
          description: Topic of the notification.
          title: Topic of the notification
        value:
          type: object
          example:
            ethAddress: 0x123...
            type: provider
          description: |-
            Payload depends on the topic.

            ## peer_connected
            ```json
            {
              "ethAddress": "0x...", // Ethereum address of the peer in hex format
              "type": "string"       // Type of the peer: "bootnode", "provider", or "bidder"
            }
            ```

            ## peer_disconnected
            ```json
            {
              "ethAddress": "0x...", // Ethereum address of the peer in hex format
              "type": "string"       // Type of the peer:"bootnode", "provider", or "bidder"
            }
            ```

            ## validator_opted_in
            ```json
            {
              "epoch": uint64,       // Epoch number
              "slot": uint64,        // Slot number
              "bls_key": "string"    // BLS key of the validator
            }
            ```

            ## epoch_validators_opted_in
            ```json
            {
              "epoch": uint64,             // Epoch number
              "epoch_start_time": uint64,  // Timestamp of epoch start
              "slots": [                   // Array of opted-in slots
                {
                  // opted-in slot details
                }
              ]
            }
            ```

            ## provider_slashed
            ```json
            {
              "provider": "0x...",       // Address of the node
              "amount": uint64,          // Amount slashed
              "hasEnoughStake": bool     // Provider has enough stake after slash
            }
            ```

            ## commitment_store_failed
            ```json
            {
              "commitment_digest": "0x...", // Digest in hex of the commitment that failed to store
              "txn_hash": "0x..."           // Transaction hash committed to.
              "error": string               // Error that occurred on-chain
            }
            ```

            ## commitment_open_failed
            ```json
            {
              "commitment_digest": "0x...", // Digest of the commitment that failed to open
              "txn_hash": "0x..."           // Transaction hash committed to.
              "error": string              // Error that occurred on-chain
            }
            ```
          title: Payload of the notification
      title: Notification represents a notification message sent to subscribers
    googlerpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}

````