Skip to main content

Connect To Subsocial

This section covers how to connect to the Subsocial blockchain using our JS SDK.

After the Configuration settings you can create an instance of the Subsocial api, so that you can have access to all blockchain methods:

Initializing The APIs

You need to initialize the Subsocial Api and set authorizations for saving content on IPFS with the following syntax:

import { SubsocialApi } from "@subsocial/api";
import { config } from "config";

const initSubsocialApi = async () => {
const api = await SubsocialApi.create(config);
return api;

// Required only for Testnet.

// Use this ipfs object, to set authHeader for writing on Crust IPFS cluster.
authorization: "Basic " + authHeader,

In order to deploy content on your own ipfs node, just change the property ipfsNodeUrl in the configuration settings

Before going deep in the SDK you can try out the code in our Playground.