API test generator
Paste or drop your data here, or open a file.
New to Bracely?
Everything stays in your browser.
Output appears here
Paste or open your data in the input box. It never leaves your browser.
API Test Generator
Paste a response you got back from an API, and the cURL command that asked for it, and copy a test that sends the same request and checks the status and every field. Ids, timestamps and tokens, which change on every call, get a type check instead of an exact one, so the test doesn't break on the next run.
Example: a Pytest test for an order
The response and the cURL command that got it. The id and the time are checked by type, since they change from order to order; the rest exactly:
The response
{
"id": "ORD-20419",
"status": "paid",
"total": 4248.5,
"placedAt": "2026-10-08T14:32:00Z",
"items": [
{
"sku": "KB-01",
"qty": 1
}
]
}The request (cURL)
curl https://api.example.com/v1/orders/ORD-20419 -H 'Authorization: Bearer YOUR_TOKEN'Output
import requests
def test_get_orders():
res = requests.get("https://api.example.com/v1/orders/ORD-20419", headers={"Authorization": "Bearer YOUR_TOKEN"}, timeout=10)
assert res.status_code == 200
body = res.json()
assert isinstance(body["id"], str)
assert body["status"] == "paid"
assert body["total"] == 4248.5
assert isinstance(body["placedAt"], str)
assert len(body["items"]) == 1
assert body["items"][0]["sku"] == "KB-01"
assert body["items"][0]["qty"] == 1
How do I use the API test generator?
- Paste the JSON response in the first box.
- Paste the request as a cURL command (Copy as cURL in DevTools) or an address in the second box.
- Pick the framework and the status to expect, and copy the test.
What does the API test generator do?
- Jest, Playwright, Pytest, RestAssured, k6 and Postman
- The request's method, headers and body from cURL
- Exact values where they're stable, types where they change
When to use the API test generator
The quickest way to test an endpoint is to call it once, look at a good response, and pin it down: this status, these fields, these values. Doing that by hand means typing an assertion for every field. Here you paste the response and the request, and copy a test in the framework your project already uses.
Every value gets a check. Values that are the same on every call, like a status, a name or a price, are checked exactly; values that change, like ids, UUIDs, timestamps and long tokens, are checked by type, so the test survives the next run. Lists are checked by their length and their first item. Up to 40 checks are written, and the test says how many were left out. Check: every value exactly or Check: only the types switch the whole test to one kind. RestAssured compares decimals as float, because that's how it reads JSON numbers by default.
Frequently asked questions
- Where does the request come from?
- From the second box: a cURL command (in Chrome or Firefox DevTools, right-click the request, Copy as cURL), a method and address such as POST https://api.example.com/orders, or just an address for a GET. Without one, the test uses a placeholder address to replace.
- Does it put my token in the test?
- If it's in the cURL command, yes, as a header. Replace it with an environment variable before you commit the test: process.env.API_TOKEN in Jest, os.environ in Pytest.
- Is my data uploaded?
- No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.
More JSON tools
Bracely has 104 JSON tools in one page. Related ones:
- cURL to k6
- Postman test script generator
- JSON to TypeScript
- JSON Schema Generator
- JSON to Go
- JSON to Java
- JSON to C#
- JSON to Python
- JSON to Kotlin
- JSON to Swift
- JSON to Dart
- JSON to Rust
- JSON to PHP
- JSON to Zod
- YAML to JSON
- CSV to JSON
- JSON hash
- Edge-case test data
- TypeScript formatter
- Code screenshot
- JSON Formatter
- JSON Validator
- JSON Viewer
- JSON Repair
- JSON Diff
- JSON to YAML
- JSON to CSV
- jq Playground
Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.1 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram