Skip to main content

Command Palette

Search for a command to run...

Announcing Hashnode Public APIs 2.0 closed beta

Updated
β€’5 min read
Announcing Hashnode Public APIs 2.0 closed beta
S

I am the Co-Founder of Hashnode. I write (about) code and keep interest in Venture Funding and startups. Feel free to contact me at sandeep@hashnode.com.

Update: Hashnode Public APIs are now generally available.

We have been working on powerful new GraphQL APIs for Hashnode, and today we are inviting the amazing devs from the community to try it out and share their feedback.

Hashnode is one of the best choices for developers to start their blogs and newsletters on custom domains today. We have one of the best networks of technical writers who share their knowledge on various programming languages, frameworks, and key programming concepts.

Hashnode banner

However, our users have consistently asked one question: why isn't it easier to extend, customize, and further enhance Hashnode blogs? We carefully considered this and ultimately realized that we must release a robust set of public APIs to provide flexibility to our users. To provide some more context, we currently have a set of APIs that are mostly legacy and limited in capabilities.

The biggest problems are:

  • Limited support for all necessary fields in queries.

  • Confusing as it exposes certain queries and mutations that are no longer relevant. For example, the presence of both createStory and createPublicationStory mutations lead to a lot of confusion.

  • Not all queries are available. For example, you cannot fetch static pages, series, tags pages etc.

  • No support for team publications.

  • Mostly legacy in nature and doesn't incorporate optimal infrastructure and observability best practices.

Our new APIs solve all of the above issues, and offer much more! πŸ’₯

So, today I am excited to invite you all to try out our Public APIs 2.0 in closed beta. To start building with our new APIs, join our Discord server, and look for general-apis-chat channel.

Please note that we currently only offer queries. Mutations are in progress and are expected to become available in early October. Additionally, be aware that the APIs may undergo changes during the closed beta, and we will notify everyone on Discord when such changes occur.

Broader goals for Hashnode APIs 2.0

We have spoken to numerous active bloggers on Hashnode. A common piece of feedback they all shared was their love for the platform, as it allowed them to create content, build their audience, and develop amazing products such as courses, books, or SaaS software.

However, after some time, they feel the need for more customization. Some users need eCommerce platform integrations, while others want to more closely incorporate their products within their blog posts. We attempted to provide as much flexibility as possible with our editor, but it wasn't enough. With the APIs, we grant developers the superpowers to create anything they desire 🦸🏽.

By taking an API-first approach and investing in a robust set of public APIs, we'll eventually turn Hashnode into a headless CMS. This way, our writers can truly customize all major aspects of the frontend, and extend Hashnode easily while still benefiting from the community aspects of our platform.

Hashnode as headless CMS

The possibilities are endless:

  • Host a Hashnode blog on a subpath like /blog

  • Roll out a unique blog interface

  • Build custom integrations with eCommerce platforms and services like Gumroad

  • Build integrations for Hashnode

  • ... and much more!

We're going to run the APIs in closed beta and learn from your feedback. The first stable release (only with queries) will be shipped in the first week of September, and the mutations will release in beta in the subsequent weeks. So, it's safe to assume that you will have the full power to roll out a read-only front end for your Hashnode blog using our APIs at the end of the first week of September.

GraphQL queries to try

Now let's get to the fun part! We have many queries in beta that will help you recreate your Hashnode blog. Let me highlight some of these:

Fetch details about your publication

query Publication {
  publication(host:"blog.developerdao.com") {
    isTeam,
    title
    about {
      markdown
    }
  }
}

Fetch posts from your blog

query Publication {
  publication(host:"blog.developerdao.com") {
    isTeam,
    title
    posts (first:10){
      edges{
        node {
          title,
          brief,
          url
        }
      }
    }
  }
}

The queries support pagination, and let you fetch a full list of the posts to recreate your blog home page.

Fetch a single article (blog post)

query Publication {
  publication(host:"blog.developerdao.com") {
    isTeam,
    title
    post(slug:"the-developers-guide-to-chainlink-vrf-foundry-edition"){
      title,
      content{
        markdown
        html
      }
    }
  }
}

As long as you have your publication hostname and article slug, you can fetch it like the above.

Fetch posts from a series

query Publication {
  publication(host:"lo-victoria.com") {
    isTeam,
    title
    series(slug:"graphql"){
      posts(first:10){
        edges{
          node{
            title
          }
        }
      }
    }
  }
}

Fetch posts from a tag

query Tags {
  publication(host: "blog.developerdao.com") {
    posts(first: 10, filter: {tagSlugs: ["web3"]}) {
      edges {
        node {
          id
          title
        }
      }
    }
  }
}

Fetch static pages

query Publication {
  publication(host:"lo-victoria.com") {
    isTeam,
    title,
    staticPages(first:10){
      edges{
        node{
          title,
          slug
        }
      }
    }
  }
}

Fetch a single page

query Publication {
  publication(host:"lo-victoria.com") {
    isTeam,
    title,
    staticPage(slug:"about") {
      title,
      content {
        markdown
      }
    }
  }
}

These are some of the example queries to help you get a sense of what's possible. We also have more queries that are WIP. We'll be releasing them continuously in beta to get feedback from you all.

How to get beta access?

You can readily start using our new APIs by heading to gql.hashnode.com. Please join our Discord server to be in the loop, and get notified when there is a breaking change.

Additionally, we have some exciting Hashnode merchandise surprises in store for our beta testers. πŸ‘πŸ˜

πŸ‘‰ Join our Discord

- Your API team at Hashnode!

Hashnode team members

Comments (14)

Join the discussion
K

The shift from having both createStory and createPublicationStory to a unified schema was a solid move β€” that confusion was a real pain point for anyone building integrations.

M

amazing Good job! eggy car

V

Good job :)

P

Oh this is awesome, it'll be so much easier to make custom filtered RSS feeds!

2
F

Congrats on the launch! Was waiting for this.

S

Amazing! What are you looking to build with the new APIs?

K

Great news! I have put a lot of effort to create feature request descriptions that were directly addressed by this update. Really excited to try it out!

Any ideas about the commercials of this API access in the future? I'm very interested in subdomain hosting use case but I'm wondering about feasibility of investing my time in beta.

13
S

The APIs will be free to use! And in the future we'll provide what we call a "Blog Starter Kit" which consumes our APIs and lets you deploy it on your subpath with one click.

1
K

Sandeep Panda sounds like Santa came early this! will be happy to test it. I love the platform, being able to use it for more use cases sounds great to me

3
S

Karol Horosin Perfect, please fill out the short form included in this post and we'll get you added to the list.

1
S

I love building our new APIs + use it in the future for neater integration πŸš€

M

Hi, to be clear, is this new API a complete replacement of the API described in the below link? Or is the below link describing the new API? https://support.hashnode.com/en/collections/3684975-hashnode-api

S

This is a replacement for the old API described in that doc.

1
M

@sandeep

Thanks! I'm using it currently, and in v2 will we have the ability to use syntax highlighting externally? For example, I think with prism.js a className has to be set on the code block, but as I understand it that className will have to be sent by the API

S

Matthew Reed We will send post content in both markdown and html format. So, you are free to choose any syntax highlighter!

M

Sandeep Panda

Hi again, will we need to send a token with our API call? I'm currently not sending one with my v1 implementation

S

Matthew Reed you don’t need to send any tokens for queries in v2. You need token only for mutations. I also encourage you to join our discord: https://discord.gg/hashnode (general-apis-chat) to be in the loop and ask any quick questions!

1
A

This news is definitely exciting but what I like more in this blogpost is the team picture in the end :joy:

C

This is awesome πŸ’― Huge congrats to the Hashnode team for rolling out these powerful APIs!

More from this blog

T

Town Hall - The official Hashnode blog

208 posts

Welcome to the official Hashnode blog. Find our product updates, announcements, interviews, and more here. Get started with Hashnode now.