Announcing Hashnode Public APIs 2.0 closed beta

Announcing Hashnode Public APIs 2.0 closed beta

Β·

5 min read

Featured on Hashnode

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

Β