Say you’re building an e-commerce side project. You call your login API, and it returns something like this:
{
"status": "success",
"code": 1000,
"data": {
"user_id": "U12345",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expire_time": "2025-06-01T12:00:00Z"
},
"message": "Login successful"
}
Now, before you trust this API, you need to check:
user_id + token → usable result.That’s what assertions are for — they automatically validate your APIs so you don’t have to eyeball JSON responses every time.
In Postman, you add assertions in the [Tests] tab, using JavaScript.

pm.test("HTTP 200", () => {
pm.response.to.have.status(200);
});
pm.test("Business code 1000", () => {
const json = pm.response.json();
pm.expect(json.code).to.eql(1000);
});
pm.test("Under 500ms", () => {
pm.expect(pm.response.responseTime).to.be.below(500);
});
pm.test("Contains user_id + token", () => {
const json = pm.response.json();
pm.expect(json.data).to.include.keys("user_id", "token");
});
pm.test("Content-Type JSON", () => {
pm.response.to.have.header("Content-Type", "application/json");
});
After running, you’ll see results at the bottom of Postman.

If you don’t feel like coding, EchoAPI gives you two no-code options.
Click “AI Generate Assertions”, and EchoAPI analyzes the response + builds checks for you (status code, fields, types, etc.).

If something’s missing, just tell it:
👉 “Add a check for non-empty token”.
With EchoAPI, you can create assertions in 3 clicks:





When you run tests, results show visually:
✅ Green = passed, ❌ Red = failed with error details.


👉 For indie hackers, this means less time debugging APIs, more time shipping features.