> For the complete documentation index, see [llms.txt](https://polkadot.novabloq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://polkadot.novabloq.com/element-polkadot-api/actions/subscribe-to-new-blocks.md).

# Subscribe to new Blocks

Just like subscribing to balance changes, this will trigger an event every time a new block is mined, and publish a state with the block number.

## Setup

This action doesn't have any fields, just run it after the api was initialised.

### Action - Unsubscribe from new Block event

After subscribing you can of course unsubscribe by running this action and receiving events about new blocks.

### Event - New Block

This is the event that will be triggered every time a new block is mined.

### State - Last Block Nr

In this state you will find the number of the latest block.

## Demo

Find a demo on the [polkadot api](https://bubble.io/page?type=page\&name=polkadot_api\&id=polkadotjs\&test_plugin=1639402639641x977692461648052200_current\&tab=tabs-1) page. See the workflow folder **Subscribe blocks**

![](https://2273326906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIMKdkPzZeUlk7WD5V4J8%2Fuploads%2FzdgVyVmUjsZfELCozjoK%2FScreenshot%202022-02-10%20at%2015.23.55.png?alt=media\&token=7becf27d-f2d4-4c36-b9bc-0efaba95e352)
