Practical examples of POST request with JSON in Postman: 3 core examples and more
Let’s start with the three core examples of POST request with JSON in Postman: 3 examples that cover most day‑to‑day API work:
- Creating a resource (user sign‑up)
- Logging in and getting a token
- Creating an order with nested JSON
Then we’ll extend those to 6–8 real examples with variations like query parameters, headers, dynamic values, and tests.
Example 1: User sign‑up – basic JSON POST
This is the hello world of POST requests with JSON in Postman. You’re sending a JSON body to create a new user.
Request setup in Postman
- Method:
POST - URL:
https://api.example.com/v1/users - Headers:
Content-Type: application/json
- Body (raw → JSON):
{
"email": "alex@example.com",
"password": "P@ssw0rd123",
"firstName": "Alex",
"lastName": "Kim"
}
``
This is the simplest example of POST request with JSON in Postman: a flat JSON object, one header, and a predictable response. A typical response might look like:
```json
{
"id": "u_9f23b1",
"email": "alex@example.com",
"firstName": "Alex",
"lastName": "Kim",
"createdAt": "2025-01-15T18:32:10Z"
}
Why this matters in 2024–2025
Even as APIs move toward more advanced patterns (GraphQL, gRPC, event‑driven designs), JSON over HTTP POST is still the workhorse of web and mobile backends. Public documentation from organizations like the U.S. government’s API program shows the same pattern over and over: HTTP POST plus JSON payloads for creating resources. You can see this style in the U.S. Census Bureau’s API docs at https://www.census.gov/data/developers/data-sets.html.
In Postman, this first example of POST request with JSON in Postman becomes your template. You’ll reuse the structure—URL, headers, raw JSON body—for almost every API you test.
Example 2: Login with JSON and environment variables
The second of our three primary examples of POST request with JSON in Postman adds a twist: you send credentials in JSON, receive a token, and store it as a variable for later requests.
Step 1: Login request
- Method:
POST - URL:
https://api.example.com/v1/auth/login - Headers:
Content-Type: application/json
- Body:
{
"email": "{{user_email}}",
"password": "{{user_password}}"
}
Here, {{user_email}} and {{user_password}} are Postman environment variables. Set them in your environment so you’re not hard‑coding credentials in every request.
Sample response
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600,
"refreshToken": "r_12a3bc..."
}
Step 2: Postman test to capture the token
In the Tests tab:
pm.test("Login succeeded", function () {
pm.response.to.have.status(200);
});
const jsonData = pm.response.json();
if (jsonData.accessToken) {
pm.environment.set("access_token", jsonData.accessToken);
}
Now any later request can use:
Authorization: Bearer {{access_token}}
This turns a simple example of POST request with JSON in Postman into a small workflow. You’re not just sending JSON; you’re chaining requests together, which is how real integration and regression tests are built.
If you want to compare this pattern with production‑grade security recommendations, the OWASP API Security Project at https://owasp.org/www-project-api-security/ is worth a read. It explains why storing tokens safely and avoiding credential reuse matters when you automate sequences like this in Postman.
Example 3: Creating an order with nested JSON
The third of the core examples of POST request with JSON in Postman: 3 examples focuses on nested structures—arrays and objects inside objects. This is where many people start making syntax mistakes.
Request setup
- Method:
POST - URL:
https://api.example.com/v1/orders - Headers:
Content-Type: application/jsonAuthorization: Bearer {{access_token}}
- Body:
{
"customerId": "u_9f23b1",
"items": [
{
"productId": "p_101",
"quantity": 2,
"price": 19.99
},
{
"productId": "p_202",
"quantity": 1,
"price": 49.5
}
],
"shippingAddress": {
"line1": "123 Market Street",
"city": "San Francisco",
"state": "CA",
"postalCode": "94103",
"country": "US"
},
"notes": "Leave at front desk."
}
This example of POST request with JSON in Postman mirrors how e‑commerce and logistics APIs typically work: a top‑level object, an array of line items, and a nested address object.
Common mistakes this example helps you catch
- Missing commas between objects in the
itemsarray - Using single quotes instead of double quotes
- Forgetting to quote property names
Postman’s built‑in JSON formatter helps, but actually building and sending nested payloads is the fastest way to train your eye.
Beyond the core 3: more real examples of POST request with JSON in Postman
Those three cover the basics. To make this guide truly useful in 2024–2025, let’s expand to several more real examples of POST request with JSON in Postman that reflect current trends: pagination, filters, partial updates, and working with public APIs.
Filtered search with JSON body
Some APIs accept search filters via POST instead of query parameters, especially when the filters are complex.
- Method:
POST - URL:
https://api.example.com/v1/products/search - Body:
{
"query": "wireless headphones",
"priceRange": {
"min": 50,
"max": 200
},
"sort": {
"field": "rating",
"direction": "desc"
},
"pagination": {
"page": 1,
"pageSize": 20
}
}
This example of POST request with JSON in Postman shows how to represent filters, sorting, and pagination in a single JSON payload. You’ll see patterns like this in modern search and analytics APIs.
JSON POST with query parameters and headers
Real APIs rarely stick to only a body. You’ll often combine query parameters, headers, and JSON.
Imagine a reporting endpoint that takes a date range in the body, a region as a query parameter, and expects a version header:
- Method:
POST - URL:
https://api.example.com/v1/reports/sales?region=us-west - Headers:
Content-Type: application/jsonX-API-Version: 2025-01-01
- Body:
{
"startDate": "2025-01-01",
"endDate": "2025-01-31",
"includeRefunds": false
}
In Postman, this is a good test of whether you’re comfortable juggling all three parts of the request. It’s another solid example of POST request with JSON in Postman that you can adapt for internal analytics services.
JSON POST using dynamic data in Pre‑request Scripts
Testing the same static JSON over and over isn’t realistic. A more advanced example of POST request with JSON in Postman uses scripts to generate data on the fly.
In the Pre‑request Script tab:
const randomId = Math.floor(Math.random() * 1000000);
pm.environment.set("test_email", `user_${randomId}@example.com`);
pm.environment.set("test_username", `user_${randomId}`);
Body:
{
"email": "{{test_email}}",
"username": "{{test_username}}",
"role": "tester"
}
Every time you hit Send in Postman, you get a slightly different JSON body. That’s how you uncover bugs around uniqueness constraints, rate limits, and data validation.
Partial update with JSON (PATCH via POST tunnel)
Some legacy systems don’t support PATCH and instead use a POST endpoint that behaves like PATCH. You send only the fields you want to update.
- Method:
POST - URL:
https://api.example.com/v1/users/u_9f23b1/update - Body:
{
"firstName": "Alexander",
"marketingOptIn": true
}
This is a realistic example of POST request with JSON in Postman that models partial updates. You’re not sending the entire user object, only the changed fields. When you work with older enterprise APIs, this pattern shows up a lot.
Using public APIs as practice targets
If you don’t have a private backend to test against, you can still practice these examples of POST request with JSON in Postman using public APIs and sandboxes.
A few ideas:
- Many open data APIs from U.S. agencies document their patterns at https://api.data.gov/. While a lot of them use GET, the structure and headers they describe are directly transferable to POST with JSON.
- University research APIs, like some hosted under the Harvard domain at https://dataverse.harvard.edu/, show how academic data services structure JSON payloads and authentication.
Even if you can’t POST arbitrary data to all of these, reading their schemas and examples will make your own Postman collections better structured and easier to maintain.
Adding tests to your JSON POST requests
An article about examples of POST request with JSON in Postman shouldn’t stop at the request itself. The real value comes from assertions.
For the order‑creation example, you might add tests like:
pm.test("Status code is 201", function () {
pm.response.to.have.status(201);
});
pm.test("Order has an ID and items", function () {
const data = pm.response.json();
pm.expect(data.id).to.be.a("string");
pm.expect(data.items).to.be.an("array");
pm.expect(data.items.length).to.be.above(0);
});
Now your example of POST request with JSON in Postman doubles as an automated regression test. You can run it in Postman’s Collection Runner or in CI using Newman.
As APIs become more central to healthcare, finance, and public services, this kind of repeatable testing is becoming standard practice. For instance, health APIs that interact with clinical data (think FHIR‑based systems used by organizations referenced by the NIH at https://www.nlm.nih.gov/healthit.html) rely heavily on JSON POSTs and automated test suites to avoid breaking downstream systems.
Common pitfalls when sending JSON POSTs in Postman
As you work through these examples of POST request with JSON in Postman, you’ll run into a few recurring issues:
- Wrong body type: You selected
x-www-form-urlencodedinstead ofraw → JSON. The server never sees valid JSON. - Missing
Content-Type: Some servers will try to guess; others will reject the request. Always setContent-Type: application/json. - Extra commas or trailing commas: Valid in some JavaScript contexts, invalid in JSON. Postman will highlight them, but they still trip people up.
- String vs number confusion: Sending
"quantity": "2"instead of"quantity": 2can cause subtle bugs if the backend is strict about types. - Environment vs global variables: Using
{{token}}from the wrong scope and wondering why your authenticated example of POST request with JSON in Postman suddenly fails.
Treat each error as feedback. The more of these you hit while experimenting, the smoother your real‑world API debugging becomes.
FAQ: examples of POST request with JSON in Postman
Q1. Can you give a simple example of POST request with JSON in Postman for beginners?
Yes. The user sign‑up request at the top of this article is the simplest example of POST request with JSON in Postman: set method to POST, choose raw → JSON in the Body tab, add Content-Type: application/json, and send a flat JSON object like { "email": "user@example.com", "password": "Test1234" }.
Q2. How many real examples should I keep in a Postman collection when learning?
Keep at least three core requests—sign‑up, login, and a nested JSON create (like an order)—because those cover most patterns. Then add a few more examples of POST request with JSON in Postman: a filtered search, a partial update, and a request that uses dynamic variables. That mix gives you both depth and variety.
Q3. Are there public APIs with good examples of JSON POST bodies?
Yes. While many government and academic APIs focus on GET, their documentation often includes JSON schemas and sample payloads that mirror POST bodies. The U.S. open data hub at https://api.data.gov/ and research platforms like Harvard Dataverse offer solid references you can adapt into Postman.
Q4. Do I always need tests for my JSON POST examples?
You can start without them, but adding even one or two status‑code and schema checks turns each example of POST request with JSON in Postman into a reusable test. That pays off as soon as your API changes or you plug your collection into CI pipelines.
Q5. Is it okay to send passwords and tokens as plain JSON in Postman?
For local testing over HTTPS, yes, that’s standard practice. In shared environments, avoid hard‑coding secrets in bodies. Use Postman environments, secure variables, and follow security guidance from sources like OWASP’s API Security Project. That way, your examples of POST request with JSON in Postman don’t accidentally leak sensitive data when shared with your team.
If you work through the examples of POST request with JSON in Postman: 3 examples at the top plus the extended scenarios here, you’ll cover 90% of what you’ll face in everyday API testing—without relying on guesswork or copy‑pasting from random snippets.
Related Topics
Examples of load testing with Postman: 3 practical examples you can actually use
The best examples of API testing with Postman: practical examples for real teams
Practical examples of examples of debugging API requests in Postman
Practical examples of POST request with JSON in Postman: 3 core examples and more
Practical examples of examples of using Postman to test a RESTful API
Examples of Chaining Requests in Postman: 3 Practical Patterns You’ll Actually Use
Explore More Testing APIs with Postman
Discover more examples and insights in this category.
View All Testing APIs with Postman