Bybit P2P Node.js SDK (TypeScript)
npm install bybit-p2p-sdk

bybit-p2p-sdk is the unofficial Node.js SDK for Bybit's P2P API, enabling seamless integration of your software solutions with Bybit's P2P trading platform.
- Full Type Support: Written in TypeScript with complete definitions.
- Easy Authentication: Handles HMAC signature generation automatically.
- Actively Maintained: Supports latest V5 P2P endpoints.
This SDK implements all key methods available for the P2P API:
- Create, edit, delete, activate advertisements
- Get pending orders, mark orders as paid, release assets
- Get, send text messages, and upload files to chat
- Get all public advertisements
- And more!
``bash`
npm install bybit-p2p-sdk
`typescript
import { P2P } from 'bybit-p2p-sdk';
const client = new P2P({
testnet: false, // Set to true for testnet
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_API_SECRET"
});
// 1. Get current balance
const balance = await client.getCurrentBalance({ accountType: "FUND", coin: "USDT" });
console.log(balance);
// 2. Get pending orders
const orders = await client.getPendingOrders({ page: 1, size: 10 });
console.log(orders);
`
constructor accepts the following config:-
testnet: boolean (default: false)
- apiKey: string
- apiSecret: string
- recvWindow: number (default: 20000) - Time window for request validityDocumentation
This library provides a direct wrapper around Bybit's P2P REST API.
Official Documentation: P2P API Guide
$3
Here is how the SDK methods map to the API endpoints:
#### Advertisements
| SDK Method | API Endpoint | Description |
| --- | --- | --- |
|
getOnlineAds() | /v5/p2p/item/online | Get public online ads |
| postNewAd() | /v5/p2p/item/create | Post a new ad |
| removeAd() | /v5/p2p/item/cancel | Cancel an ad |
| updateAd() | /v5/p2p/item/update | Update or relist an ad |
| getAdsList() | /v5/p2p/item/personal/list | Get my ads list |
| getAdDetails() | /v5/p2p/item/info | Get ad details |#### Orders
| SDK Method | API Endpoint | Description |
| --- | --- | --- |
|
getOrders() | /v5/p2p/order/simplifyList | Get all orders |
| getOrderDetails() | /v5/p2p/order/info | Get order details |
| getPendingOrders() | /v5/p2p/order/pending/simplifyList | Get pending orders |
| markAsPaid() | /v5/p2p/order/pay | Mark order as paid |
| releaseAssets() | /v5/p2p/order/finish | Release crypto to buyer |
| sendChatMessage() | /v5/p2p/order/message/send | Send a chat message |
| uploadChatFile() | /v5/p2p/oss/upload_file | Upload a file to chat |
| getChatMessages() | /v5/p2p/order/message/listpage | Get chat history |#### User Info
| SDK Method | API Endpoint | Description |
| --- | --- | --- |
|
getAccountInformation() | /v5/p2p/user/personal/info | Get my account info |
| getCounterpartyInfo() | /v5/p2p/user/order/personal/info | Get counterparty info |
| getUserPaymentTypes() | /v5/p2p/user/payment/list | Get my payment methods |#### Misc
| SDK Method | API Endpoint | Description |
| --- | --- | --- |
|
getCurrentBalance() | /v5/asset/transfer/query-account-coins-balance | Get wallet balance |Development
Contributions are welcome!
$3
`bash
npm run build
`$3
`bash
npx ts-node examples/quickstart.ts
`🤝 Contributing
Contributions are welcome! Please see our contributing guidelines:
1. Fork the repository
2. Create a feature branch (
git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'Add amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)- Follow TypeScript best practices
- Use ESLint and Prettier (configured in project)
- Write tests for new features
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
For questions and support:
- Check the Documentation section
- Open an Issue
---
Built with ❤️ for traders by ENGR-ABI