A TypeScript Express.js API server for interacting with the PlayStation Network (PSN) API. This project provides RESTful endpoints for managing friends, groups, messages, and other PSN features.
- π Authentication: Automatic NPSSO token fetching and management
- π₯ Friends Management: Get friends list, delete friends
- π¬ Messaging: Send and receive messages in groups
- π User Search: Search for PSN users
- π Groups: Create and manage message groups
- πΌοΈ Media Support: Send images, stickers, and voice messages
- π Web Interface: Built-in HTML interface for testing
- Node.js (v18 or higher recommended)
- npm or yarn
- PSN Client ID (required)
- PSN Client Secret (optional)
- Clone the repository:
git clone https://github.com/Tazhys/express-psn-api.git
cd express-psn-api- Install dependencies:
npm install- Build the project:
npm run buildRun the server in development mode with hot reload:
npm run devBuild and run the compiled JavaScript:
npm run build
npm startThe server will start on http://localhost:3000 (or the port specified in your .env file).
Open web.html in your browser to access the built-in web interface for testing the API.
GET /api/psn/npsso- Get NPSSO tokenGET /api/psn/token- Get access token
GET /api/psn/profile/:name?- Get user profile
GET /api/psn/friends- Get friends listDELETE /api/psn/friends/:name- Delete a friend
POST /api/psn/search- Search for PSN users
GET /api/psn/groups- Get all groupsPOST /api/psn/groups- Create a new group
GET /api/psn/messages/:groupId/:threadId?- Get messages from a groupPOST /api/psn/messages- Send a message
POST /api/psn/resources- Upload a resource (image)POST /api/psn/resources/send- Send a resource as a messageGET /api/psn/groups/:groupId/resources/:resourceId- Get a resource (image/audio)
For detailed API documentation, see API.md.
express-psn-api/
βββ src/
β βββ models/ # Data models
β βββ routes/ # Express routes
β β βββ psnRoutes.ts # PSN API routes
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utility functions
β β βββ npsso.ts # NPSSO token fetcher
β βββ PSNApi.ts # Main PSN API client
β βββ server.ts # Express server setup
βββ data/ # Data storage (tokens, etc.)
βββ web.html # Web interface
βββ API.md # Complete API documentation
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
The API supports multiple authentication methods:
-
Environment Variables (recommended for server-side)
- Set
CLIENT_ID,CLIENT_SECRET, andNPSSOin your.envfile
- Set
-
HTTP Headers (for API requests)
- Include
x-client-id,x-client-secret, andx-npssoheaders
- Include
-
Automatic NPSSO Fetching
- If NPSSO is not provided, the server will attempt to fetch it automatically from Sony's API
npm run buildContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project is not affiliated with, endorsed by, or associated with Sony Interactive Entertainment or PlayStation. This is an unofficial API wrapper created for educational and development purposes. Use at your own risk and ensure compliance with PlayStation's Terms of Service.
For issues, questions, or contributions, please open an issue on the GitHub repository.
- Built with Express.js and TypeScript
- Uses the PlayStation Network API
- Faultz - Dumping & Reversing api endpoints from the mobile app.
- Copilot - Writing this readme since i was lazy.