Setup: Using NextAPI with Postman
Set up Postman to test NextAPI endpoints quickly and efficiently during development.
Prerequisites
- Postman installed on your computer
- NextAPI account and API keys
- Basic understanding of REST APIs
Importing the NextAPI Collection
1. Download the Collection
Download our official Postman collection from: https://nextapi.com/postman-collection
2. Import to Postman
- Open Postman
- Click "Import" in the top left
- Select the downloaded collection file
- Choose "Import" to add to your workspace
Configuring Authentication
Set Up Environment Variables
- Create a new environment called "NextAPI Sandbox"
- Add these variables:
| Variable | Value | Description |
|---|---|---|
base_url | https://api-sandbox.nextapi.com | Sandbox API endpoint |
api_key | sk_test_your_key_here | Your sandbox API key |
wallet_id | wallet_test_123 | Test wallet ID |
Configure Authorization
- Go to the "Authorization" tab in any request
- Set Type to "Bearer Token"
- Enter
{{api_key}}in the Token field
Testing Key Endpoints
Health Check
GET {{base_url}}/v1/health
Get Account Info
GET {{base_url}}/v1/account
Create a Test Payout
POST {{base_url}}/v1/payouts
Content-Type: application/json
{
"amount": 1000,
"currency": "PHP",
"recipient": {
"type": "wallet",
"id": "{{wallet_id}}"
}
}
Using Postman Features
Automated Tests
Add tests to your requests:
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Response has required fields", function () {
var jsonData = pm.response.json();
pm.expect(jsonData).to.have.property('id');
pm.expect(jsonData).to.have.property('status');
});
Pre-request Scripts
Set up dynamic values:
// Generate unique reference ID
pm.environment.set("reference_id", "test_" + Date.now());
// Set current timestamp
pm.environment.set("timestamp", new Date().toISOString());
Collections Organization
Our Postman collection is organized by:
- Authentication: Login, API key validation
- Wallets: Create, manage, and query wallets
- Payouts: Send and track payouts
- Payment Links: Create and manage payment links
- Webhooks: Test webhook endpoints
Debugging Tips
- Check Console: Use Postman console for debugging
- View Headers: Examine response headers for rate limiting info
- Save Responses: Keep successful responses for reference
- Use Environments: Separate sandbox and production configs
Next Steps
- [Make your first API call](./setup-get-api-keys-make-first-call
- [Send your first payout](./your-first-payout
- [Explore webhook testing](../guides/how-to/securely-receive-and-verify-webhooks