Skip to content

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

  1. Open Postman
  2. Click Import in the upper left corner
  3. Select the Raw text tab
  4. Paste the collection JSON (available below)
  5. Click Import

Collection Variables

The collection uses variables to facilitate use and avoid value repetition:

VariableDescriptionDefault Value
base_urlAPI base URLhttps://api.misespay.com
client_idYour Client ID(configure with your credentials)
client_secretYour Client Secret(configure with your credentials)
access_tokenJWT token (filled automatically)(empty initially)
sale_idLast created sale ID(filled automatically)
withdrawal_idLast created withdrawal ID(filled automatically)
idempotency_keyIdempotency key (generated automatically)(generated automatically)

Configure Credentials

  1. Click on the Mises PIX API collection
  2. Go to the Variables tab
  3. Edit the values of client_id and client_secret
  4. 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}}/auth

What happens:

  • Sends client_id and client_secret
  • Receives access_token
  • Automatic script saves token in access_token variable
  • Token is used automatically in next requests

Test script (already included):

javascript
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/sales

What happens:

  • Uses access_token automatically
  • Creates a sale with PIX QR Code
  • Automatic script saves sale_id

Test script (already included):

javascript
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/balance

Returns total, available and held balance.

5. Create Withdrawal

Execute the Create Withdrawal request in the Withdrawals folder:

POST {{base_url}}/v1/withdrawals

What happens:

  • Pre-request script generates UUID v4 for idempotency_key
  • Uses access_token automatically
  • Creates the withdrawal
  • Test script saves withdrawal_id

Pre-request script (already included):

javascript
// Generate UUID v4 for Idempotency-Key
const uuid = require("uuid");
pm.collectionVariables.set("idempotency_key", uuid.v4());

Test script (already included):

javascript
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:

  1. Execute Generate Token
  2. Token is saved in
  3. 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:

  1. Execute Create Withdrawal once
  2. DON'T execute again immediately (script generates new key)
  3. To test idempotency:
    • Copy the value of
    • Execute again
    • Paste the same idempotency_key value in the header
    • You'll receive status 200 OK with "idempotent": true

For greater security, use Environments instead of collection variables:

Create Environment

  1. Click on the Environments icon (eye)
  2. Click Add
  3. Name as "MisesPay Production"
  4. 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)
  1. 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:

json
{
  "error": "Unauthorized",
  "message": "Invalid or expired token"
}

Solution: Execute Generate Token again.

Missing Idempotency-Key

Error:

json
{
  "success": false,
  "message": "Idempotency-Key header is required"
}

Solution: Make sure the pre-request script is enabled.

Insufficient Balance

Error:

json
{
  "success": false,
  "message": "Insufficient balance to perform withdrawal"
}

Solution:

  1. Execute Get Balance to check balance
  2. Create sales to add balance
  3. Try withdrawing a smaller amount

Collection JSON

To download the complete collection, access:

https://github.com/misespay/postman-collection

Or copy the JSON provided by the MisesPay team.

Additional Resources

Runner (Batch Execution)

Use the Collection Runner to execute all requests in sequence:

  1. Click on the three dots of the collection
  2. Select Run collection
  3. Configure order and iterations
  4. Click Run

Monitors

Configure monitors to execute the collection periodically:

  1. Click on the three dots of the collection
  2. Select Monitor collection
  3. Configure frequency and notifications

Automatic Documentation

Generate automatic documentation from the collection:

  1. Click on the three dots of the collection
  2. Select View documentation
  3. Click Publish

Next Steps

Mises API - Simplified PIX Payments