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,664 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.