Registry / social / pinterest-node-api

pinterest-node-api

JSON →
library0.0.10jsnpmunverified

Unofficial Node.js wrapper for the Pinterest v5 REST API (0.0.10, last updated 2021). Supports ES5/6/8, TypeScript, async-await, promises, and callbacks. Provides coverage for Ads, Pins, Boards, Catalogs, User Account endpoints. No official Pinterest SDK for Node exists; this is a community-maintained alternative. Release cadence is low; relies on access token authentication.

npm install pinterest-node-api
INSTALL
IMPORT
SIG · PINTEREST-NODE-API
P
pinterest-node-api
socialjavascriptv0.0.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export (factory)
import pinterestFactory from 'pinterest-node-api'; const pinterest = pinterestFactory('ACCESS_TOKEN');
const pinterest = require('pinterest-node-api'); // missing factory call
Version 0.0.9+ uses a factory function; you must call it with your token.
PinterestAPI class
import PinterestAPI from 'pinterest-node-api'; const pinterest = new PinterestAPI(); pinterest.setUserToken('ACCESS_TOKEN');
const PinterestAPI = require('pinterest-node-api').PinterestAPI; // no named export
TypeScript usage via class instantiation, as shown in README.
access token setter
pinterest.setUserToken('TOKEN');
pinterest.accessToken = 'TOKEN'; // not a property
Must call setUserToken, not assign directly.

Demonstrates how to import the factory, instantiate with an access token from env, and call user_account.get().

import pinterestFactory from 'pinterest-node-api'; const pinterest = pinterestFactory(process.env.PINTEREST_USER_TOKEN ?? ''); async function getUser() { try { const user = await pinterest.user_account.get(); console.log('User:', user); } catch (error) { console.error('Error:', error.message); } } getUser();
Debug
Known issues
gotchaThe factory function returns a Pinterest instance with methods bound incorrectly in older versions. Ensure you are using version 0.0.10.
fix
Update to version 0.0.10 via npm install pinterest-node-api@0.0.10
affects: <0.0.10
gotchaMethods return Axios response objects, not raw data. You must access .data to get the API response body.
fix
After calling a method, use response.data to get the JSON body.
affects: >=0.0.1
breakingThe import style changed from require factory call to default import in v0.0.9. require('pinterest-node-api') no longer works as a constructor.
fix
Use import or const pinterest = require('pinterest-node-api')('TOKEN');
affects: >=0.0.9
deprecatedSupport for callback-based usage is deprecated; promises and async-await are preferred.
fix
Use async/await instead of callbacks.
affects: >=0.0.10
Errors
Common errors & fixes
TypeError: pinterest.user_account.get is not a function
Using require without calling the factory, e.g., const pinterest = require('pinterest-node-api');
fix
const pinterest = require('pinterest-node-api')('YOUR_TOKEN');
Error: Request failed with status code 401
Missing, expired, or invalid access token.
fix
Set a valid PINTEREST_USER_TOKEN environment variable or pass token to factory.
Cannot read property 'data' of undefined
Assuming method returns raw data, but it returns an Axios response object.
fix
Access .data on the result, e.g., const data = (await pinterest.user_account.get()).data;
Module not found: 'pinterest-node-api'
Package is not installed or is installed globally but not locally.
fix
Run npm install pinterest-node-api --save in your project directory.
Upgrade
Version history
0.0.10latest on npm
Audit
Dependencies
axiosrequiredHTTP client used internally for API requests
Agent activity
39 hits · last 30 days
node
34
Resources
pinterest-node-api — npm install pinterest-node-api · libregistry