
Product
Introducing Reports: An Extensible Reporting Framework for Socket Data
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.
A well-tested library that lets you get trophy, user, and game data from the PlayStation Network.
A JavaScript library that lets you get trophy, user, and game data from the PlayStation Network.
✅ Modular by design, and supports tree-shaking.
✅ Aligns with the community API documentation.
✅ Supports Node environments (14 and above).
✅ Supports browsers.
✅ Ships with TypeScript support and types.
✅ Small, <5Kb.
Learn how to authenticate and start fetching data from the PlayStation Network on our documentation website.
Run the following command:
npm install psn-api
To use any endpoint function in the API, you must first be authorized by PSN. Fortunately, this is a fairly straightforward process.
In your web browser, visit https://www.playstation.com/, click the "Sign In" button, and log in with a PSN account.
In the same browser (due to a persisted cookie), visit https://ca.account.sony.com/api/v1/ssocookie. You will see a JSON response that looks something like:
{ "npsso": "<64 character token>" }
Copy your NPSSO. Do not expose it anywhere publicly, it is equivalent to your password.
If you see an error response, try using different browser.
// This is the value you copied from the previous step.
const myNpsso = "<64 character token>";
// We'll exchange your NPSSO for a special access code.
const accessCode = await exchangeNpssoForAccessCode(myNpsso);
// We can use the access code to get your access token and refresh token.
const authorization = await exchangeAccessCodeForAuthTokens(accessCode);
const authorization = await exchangeAccessCodeForAuthTokens(accessCode);
// This returns a list of all the games you've earned trophies for.
const userTitlesResponse = await getUserTitles(
{ accessToken: authorization.accessToken },
"me"
);
Click the function names to open their complete docs on the docs site.
exchangeAccessCodeForAuthTokens() - Exchange your access code for access and refresh tokens.exchangeNpssoForAccessCode() - Exchange your NPSSO for an access code.exchangeRefreshTokenForAuthTokens() - Get a new access token using your refresh token (bypassing the need to constantly auth with your NPSSO).makeUniversalSearch() - Search the PSN API. This is a good way to find a user's accountId from their username.getProfileFromUserName() - Get a user's legacy profile from the username. Often used to check for legacy presence.getProfileFromAccountId() - Get a user's profile from the accountId.getUserFriendsAccountIds() - Get a list
of accountId values present on a target account's friends list.getUserBlockedAccountIds() - Get a list
of accountId values corresponding to accounts blocked by the account the client is logged into.getUserFriendsRequests() - Get a list
of accountId values corresponding to received friend requests for the account the client is logged into.getBasicPresence() - Get a user's basic presence
information.getUserRegion() - Get a user's region information based on their username.getProfileShareableLink() - Get a shareable link and QR code for a user's profile.getAccountDevices() - Get a list of devices associated with the account (PS5, PS4, PS3, PSVita).getTitleTrophies() - Retrieve the individual trophy details of a single or all trophy groups for a title.getTitleTrophyGroups() - Get a list of trophy groups (typically the base set and DLCs) for a title.getUserTitles() - Retrieve a list of the titles associated with an account and a summary of trophies earned from them.getUserTrophiesEarnedForTitle() - Retrieve the earned status of trophies for a user from either a single or all trophy groups in a title.getUserTrophyGroupEarningsForTitle() - Get a summary of trophies earned for a user broken down by trophy group within a title.getUserTrophyProfileSummary() - Retrieve an overall summary of the number of trophies earned for a user broken down by type.getUserTrophiesForSpecificTitle() - Retrieve a summary of the trophies earned by a user for specific titles.getRecentlyPlayedGames() - Retrieve a list of recently played games for the user associated with the access token provided to this function.getPurchasedGames() - Retrieve purchased games for the user associated with the access token. Returns only PS4 and PS5 games.getUserPlayedGames() - Retrieve a list of played games and playtime info (ordered by recency) associated with a user (either from token or external if privacy settings allow).This project is not intended to be used for spam or abuse. Please use this project to elevate the PlayStation Network experience, not damage it.
Wes Copeland 💻 💡 📖 | xelnia 🤔 📓 | andshrew 📖 | Susan Ma 📖 | Travis Roy 💻 💡 📖 | Yetu 💻 | Yoshikage Kira 📖 |
Evan Shortiss 💻 📖 | crawfordj 💻 📖 | Hartaithan. 💻 | Cássio Lamarck 💻 📖 | R 💻 📖 | July 💻 📖 | silmarillenschnaps 📖 |
Bartek 💻 📖 |
FAQs
A well-tested library that lets you get trophy, user, and game data from the PlayStation Network.
The npm package psn-api receives a total of 1,959 weekly downloads. As such, psn-api popularity was classified as popular.
We found that psn-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.