Postman Collection
Complete guide to using the official Mises API collection in Postman.
Download Collection
The official Mises API collection is available in JSON format and can be imported directly into Postman.
Import to Postman
- Open Postman
- Click Import in the upper left corner
- Select the Raw text tab
- Paste the collection JSON (available below)
- Click Import
Collection Variables
The collection uses variables to facilitate use and avoid value repetition:
| Variable | Description | Default Value |
|---|---|---|
base_url | API base URL | https://api.misespay.com |
client_id | Your Client ID | (configure with your credentials) |
client_secret | Your Client Secret | (configure with your credentials) |
access_token | JWT token (filled automatically) | (empty initially) |
sale_id | Last created sale ID | (filled automatically) |
withdrawal_id | Last created withdrawal ID | (filled automatically) |
idempotency_key | Idempotency key (generated automatically) | (generated automatically) |
Configure Credentials
- Click on the Mises PIX API collection
- Go to the Variables tab
- Edit the values of
client_idandclient_secret - Click Save
SECURITY
Never share your collection with credentials filled in. Use Postman environment variables for sensitive data.
Usage Flow
1. Authentication
Execute the Generate Token request in the Authentication folder:
POST {{base_url}}/authWhat happens:
- Sends
client_idandclient_secret - Receives
access_token - Automatic script saves token in
access_tokenvariable - Token is used automatically in next requests
Test script (already included):
if (pm.response.code === 200) {
var jsonData = pm.response.json();
pm.collectionVariables.set("access_token", jsonData.access_token);
pm.test("Token saved successfully", function () {
pm.expect(jsonData.access_token).to.not.be.empty;
});
}2. Create PIX Sale
Execute the Create PIX Sale request in the Sales folder:
POST {{base_url}}/v1/salesWhat happens:
- Uses
access_tokenautomatically - Creates a sale with PIX QR Code
- Automatic script saves
sale_id
Test script (already included):
if (pm.response.code === 201) {
var jsonData = pm.response.json();
pm.collectionVariables.set("sale_id", jsonData.id);
pm.test("Sale created successfully", function () {
pm.expect(jsonData.id).to.not.be.empty;
pm.expect(jsonData.qrcode_text).to.not.be.empty;
});
}3. Get Sale
Execute the Get Sale by ID request in the Sales folder:
GET {{base_url}}/v1/sales/{{sale_id}}Automatically uses the sale_id from the previously created sale.
4. Query Balance
Execute the Get Balance request in the Balance folder:
GET {{base_url}}/v1/balanceReturns total, available and held balance.
5. Create Withdrawal
Execute the Create Withdrawal request in the Withdrawals folder:
POST {{base_url}}/v1/withdrawalsWhat happens:
- Pre-request script generates UUID v4 for
idempotency_key - Uses
access_tokenautomatically - Creates the withdrawal
- Test script saves
withdrawal_id
Pre-request script (already included):
// Generate UUID v4 for Idempotency-Key
const uuid = require("uuid");
pm.collectionVariables.set("idempotency_key", uuid.v4());Test script (already included):
pm.test("Status code is 201 or 200", function () {
pm.expect(pm.response.code).to.be.oneOf([200, 201]);
});
pm.test("Response has withdrawal_id", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.data).to.have.property("withdrawal_id");
pm.collectionVariables.set("withdrawal_id", jsonData.data.withdrawal_id);
});Automatic Authentication
The collection is configured with Bearer Token at collection level:
Authorization: Bearer {{access_token}}This means that all requests (except /auth) automatically use the token.
How it works:
- Execute Generate Token
- Token is saved in
- All next requests use this token automatically
Automatic Scripts
Automatic Tests
Each request has tests that validate:
- Correct status code
- Required fields present
- Values saved in variables
Execute and see results in the Test Results tab.
Pre-requests
Some requests execute scripts before sending:
- Create Withdrawal: Generates unique
idempotency_key
Response Examples
Each request includes response examples for:
- ✅ Success
- ❌ Common errors
See in the Examples tab of each request.
Testing Idempotency
To test idempotency in withdrawals:
- Execute Create Withdrawal once
- DON'T execute again immediately (script generates new key)
- To test idempotency:
- Copy the value of
- Execute again
- Paste the same
idempotency_keyvalue in the header - You'll receive status
200 OKwith"idempotent": true
- Copy the value of
Environment Variables (Recommended)
For greater security, use Environments instead of collection variables:
Create Environment
- Click on the Environments icon (eye)
- Click Add
- Name as "MisesPay Production"
- Add the variables:
base_url: https://api.misespay.com
client_id: your_client_id_here
client_secret: your_client_secret_here
access_token: (leave empty)- Select the environment before using
Advantages
- ✅ Credentials not saved in collection
- ✅ Easy to switch between environments (dev/prod)
- ✅ Share collection without exposing credentials
Troubleshooting
Expired Token
Error:
{
"error": "Unauthorized",
"message": "Invalid or expired token"
}Solution: Execute Generate Token again.
Missing Idempotency-Key
Error:
{
"success": false,
"message": "Idempotency-Key header is required"
}Solution: Make sure the pre-request script is enabled.
Insufficient Balance
Error:
{
"success": false,
"message": "Insufficient balance to perform withdrawal"
}Solution:
- Execute Get Balance to check balance
- Create sales to add balance
- Try withdrawing a smaller amount
Collection JSON
To download the complete collection, access:
https://github.com/misespay/postman-collectionOr copy the JSON provided by the MisesPay team.
Additional Resources
Runner (Batch Execution)
Use the Collection Runner to execute all requests in sequence:
- Click on the three dots of the collection
- Select Run collection
- Configure order and iterations
- Click Run
Monitors
Configure monitors to execute the collection periodically:
- Click on the three dots of the collection
- Select Monitor collection
- Configure frequency and notifications
Automatic Documentation
Generate automatic documentation from the collection:
- Click on the three dots of the collection
- Select View documentation
- Click Publish
Next Steps
- Authentication - Understand authentication
- Withdrawals - Withdrawals documentation
- Idempotency - Understand idempotency
