Skip to main content

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

  1. Open Postman
  2. Click "Import" in the top left
  3. Select the downloaded collection file
  4. Choose "Import" to add to your workspace

Configuring Authentication

Set Up Environment Variables

  1. Create a new environment called "NextAPI Sandbox"
  2. Add these variables:
VariableValueDescription
base_urlhttps://api-sandbox.nextapi.comSandbox API endpoint
api_keysk_test_your_key_hereYour sandbox API key
wallet_idwallet_test_123Test wallet ID

Configure Authorization

  1. Go to the "Authorization" tab in any request
  2. Set Type to "Bearer Token"
  3. 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

  1. Check Console: Use Postman console for debugging
  2. View Headers: Examine response headers for rate limiting info
  3. Save Responses: Keep successful responses for reference
  4. 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