Sample files for API testing

Payloads and attachments for testing REST endpoints that receive, return or transform files.

APIs move files in three ways: as multipart form data, as a raw binary body, or encoded as base64 inside JSON. Each has its own limits and its own failure modes, and a thorough test suite sends the same file through every path the API supports.

Sample JSON and XML files double as request bodies and as mock responses, so they are useful on both sides of an integration.

Recommended files

FileSizeWhy this oneDownload
Sample users JSON (array of 50 objects)sample-users.json14.3 KB14,668 bytesA typical response body for mocksDownload JSON
100 KB JSON samplesample-json-100kb.json100 KB102,400 bytesExactly on a 100 KB body limitDownload JSON
1 MB JSON samplesample-json-1mb.json1 MB1,048,576 bytesOver most default JSON limitsDownload JSON
100 KB PDF samplesample-pdf-100kb.pdf100 KB102,400 bytesSmall binary attachmentDownload PDF
Nested JSON with every value typesample-nested-config.json829 B829 bytesEvery JSON value type in one fileDownload JSON

Checklist

  1. Send a known-good request

    Post a small file and check the status code, the response body and that the stored bytes match the checksum of what you sent.

  2. Check the declared content type

    Send a file with the wrong Content-Type header and confirm the API validates content rather than trusting the header.

  3. Exceed the body limit

    Send a payload over the documented limit and expect 413, with an error body in the API's normal format.

  4. Send malformed data

    Truncate a JSON file and confirm the API answers 400 rather than 500.

  5. Download what you uploaded

    Fetch the file back and compare SHA-256 checksums to prove nothing was altered.

Guides

Related use cases

Frequently asked questions

How do I send a sample file with curl?
For multipart form data use curl -F "file=@sample-pdf-100kb.pdf" followed by the URL. For a raw body use --data-binary @sample-pdf-100kb.pdf with a Content-Type header.
Why is my base64 upload rejected when the file is under the limit?
Base64 makes data a third larger. A 5 MB file is about 6.7 MB as a base64 string, and the limit applies to the encoded body.

Test plan architecture and assertion matrix for sample files for api testing

A thorough api testing workflow separates positive functional verification (confirming well-formed inputs succeed and preserve their SHA-256 checksum) from negative boundary verification (confirming oversized, truncated, or mislabelled inputs fail with structured diagnostic codes).

Test case IDScenario in api testingInput fixtureExpected system outcome
TC-API--01Baseline small payload acceptance1 KB – 100 KB valid fixture from FormatsHTTP 200/201; stored byte count and SHA-256 match /checksums.txt
TC-API--02Gateway / reverse-proxy ceiling check1 MB, 10 MB, and 20 MB sized fixtures from SizesExact threshold enforced; oversize payload returns HTTP 413 Payload Too Large
TC-API--03Extension vs. magic-byte mismatchwrong-extension-png-as-jpg.jpg from Broken FilesValidator detects 89 50 4E 47 PNG header and rejects spoofed .jpg extension
TC-API--04Truncated stream / unexpected EOFTruncated PDF or JPEG from Broken FilesParser catches missing trailer/EOI marker and returns HTTP 422 without leaking stack traces

Automating api testing in CI/CD pipelines

To keep automated runs deterministic and fast, commit your small sub-100 KB fixtures directly to your repository and synthesize larger 10 MB to 1 GB stress fixtures on demand using our in-browser generator or the reproducible local commands on Methodology. When testing tabular or relational data pipelines during api testing, pair binary container checks with our 100-row and 1,000-row synthetic datasets so you can assert exact row counts and column aggregations after ingestion.