📠HTTP API

Learn how to integrate Airstack Hubs HTTP API into your Farcaster app within minutes.

Step 1: Install Dependencies

First, install the necessary dependencies to your project:

npm i axios dotenv

Step 2: Connect to HTTP API

Then, you can connect and call to Airstack Hubs HTTP API by using library such as axios and provide the URL with the Airstack API key added to the headers field x-airstack-hubs:

import axios from "axios";
import { config } from "dotenv";

config();

const main = async () => {
  const server = "https://hubs.airstack.xyz";
  try {
    const response = await axios.get(`${server}/v1/info?dbstats=1`, {
      headers: {
        "Content-Type": "application/json",
        // Provide API key here
        "x-airstack-hubs": process.env.AIRSTACK_API_KEY as string,
      },
    });
  
    console.log(response);
  
    console.log(json);
  } catch (e) {
    console.error(e);
  }
}

main();

Next Steps

Once you have the HTTP API integrated, you can start exploring all the APIs offered:

Developer Support

If you have any questions or need help regarding integrating Airstack HTTP API into your Farcaster app, please join our Airstack's Telegram group.

More Resources

Last updated