# Hashnode Integration

> Part of the [NextBlog documentation](https://nextblog.ai/docs.md). Live page: [https://nextblog.ai/docs/integration-hashnode](https://nextblog.ai/docs/integration-hashnode)

Publish, update, and unpublish your NextBlog posts on [Hashnode](https://hashnode.com/) using Hashnode’s GraphQL API.

#### Prerequisites

- A Hashnode account
- A Hashnode API token (PAT) for GraphQL mutations
- Your Hashnode **publicationId** (where posts will be created/published)

### Step 1: Create your Hashnode API token

#### 1.1 Generate a token

Go to [Hashnode Developer Settings](https://hashnode.com/settings/developer) and click **Generate New Token**.

NextBlog sends this token as the GraphQL header `Authorization: <token>`.

### Step 2: Get your publicationId

#### 2.1 Find the publication you want to publish to

Your **publicationId** tells NextBlog where to create drafts and publish posts.

If you already know your publicationId, paste it below in the project settings.

### Step 3: Connect Hashnode in NextBlog

#### 3.1 Enable Hashnode and test connection

Open **Project Settings** → **Integrations** → enable **Hashnode**, paste your API token and publicationId, then click **Test Connection**.

### How Publishing Works

#### Generation creates a draft

When Hashnode is enabled, NextBlog creates a Hashnode draft for every generated post and stores the draft id.

#### auto_publish publishes immediately

If **auto_publish** is enabled, the draft is published right away and NextBlog stores the published post id.

#### Approve updates or publishes

When you approve a post:

- If we have a published Hashnode post id, NextBlog updates the post content.
- Otherwise, NextBlog publishes the stored draft.

#### Unpublish removes and recreates a draft

When you unpublish a post, NextBlog removes the published Hashnode post and recreates a fresh draft from your current blog markdown.

### Troubleshooting

#### Test Connection fails

Check that:

- Your API token is valid (and not revoked)
- Your publicationId matches where you want to publish
- You pasted values without extra whitespace
