Creating a client
Printful offers 2 levels of access for a client, a Store client and an Account client.
Currently the SDK only offers support for Store Clients. Support for Account Clients is WIP🚧.
Store Level Client​
To instantiate a client, do the following:
import {createPrintfulStoreClient} from "printful-sdk-js";
const STORE_TOKEN = "YOUR STORE TOKEN";
const client = createPrintfulStoreClient(STORE_TOKEN);
Getting an access token​
Read the following guide on Prinful API Docs on Authentication.
IMPORTANT NOTE: It is advised to keep your API keys safe by storing them in a .env file and importing it into your project using a tool like dotenv or any equivalent you may have available in your project.
Submodules of Store Client​
After instantiation, client
offers a multitude of submodules that correspond to the sub-APIs as described by the Printful API Documentation.
Below is a table mapping the SDK submodules to their respective sub-APIs.
NOTE: Parts of the HTTP responses are abstracted away by the SDK. If you would like to investigate further, you are welcome to dive into the source code.
SDK Submodule | Printful Sub-API |
---|---|
client.oauth | OAuth API |
client.catalog | Catalog API |
client.products | Products API |
client.orders | Orders API |
client.fileLibrary | File Library API |
client.shippingRate | Shipping Rate API |
client.ecommerceSync | Ecommerce Platform Sync API |
client.countryCodes | Country/State Code API |
client.taxRate | Tax Rate API |
client.webhook | Webhook API |
client.storeInformation | Store Information API |
client.mockupGenerator | Mockup Generator API |
client.warehouseProducts | Warehouse Products API |
client.reports | Reports API |
client.approvalSheets | Approval Sheets API |
Account Level Client​
Support for Account Clients is WIP🚧.