Developer utility

SampleFile API

Free, open REST API for test files. No auth. No rate limits. No signup. Returns SHA256-verified files by format, category, or use case.

4 Endpoints
No auth Public access
CORS Enabled on all endpoints
SHA256 Every file verified

Base URL: https://samplefile.com

All endpoints return JSON with Access-Control-Allow-Origin: *. Files are served directly from https://samplefile.com/static/samples/ with no redirect. Use the API in CI pipelines, test fixtures, automation scripts, and integration tests.

Endpoint

Random File

GET /samples/api/random

Returns a random file from the library as a JSON object. Use query params to narrow by format, category, or use case.

Query Parameters

Parameter Type Example Description
format string pdf File extension to filter by (e.g. mp4, pdf, csv, zip).
category string video Category to filter by (video, audio, document, image, archive, data, code, ...).
use_case string upload-testing Use case slug: upload-testing, parser-regression, or performance-benchmark.

Response Fields

Field Description
name Filename including extension.
size_bytes File size in bytes.
size_human Human-readable size (e.g. "4.2 MB").
mime_type MIME type string (e.g. "video/mp4").
sha256 SHA-256 checksum for integrity verification.
category Category name.
ftype Format/extension identifier.
download_url Direct download URL.
format_url Format browse page URL.
manifest_url JSON manifest URL for the full file list.

Examples

Random PDF

curl -s "https://samplefile.com/samples/api/random?format=pdf"

Random MP4 (≤10 MB via /api/files)

curl -s "https://samplefile.com/samples/api/random?format=mp4"

For upload testing

curl -s "https://samplefile.com/samples/api/random?format=csv&use_case=upload-testing"

Python

import requests
meta = requests.get("https://samplefile.com/samples/api/random?format=pdf").json()
resp = requests.get(meta["download_url"])
with open(meta["name"], "wb") as f: f.write(resp.content)

Node / fetch

const meta = await fetch("https://samplefile.com/samples/api/random?format=pdf").then(r => r.json());
const file = await fetch(meta.download_url);
const buf = await file.arrayBuffer();
Endpoint

File List

GET /samples/api/files

Returns a filtered list of files. Supports format, category, use case, and size range filters.

Query Parameters

Parameter Type Example Description
format string mp4 File extension to filter by.
category string video Category name.
use_case string parser-regression Use case slug.
min_size_mb number 1 Minimum file size in megabytes.
max_size_mb number 10 Maximum file size in megabytes.
limit integer 20 Max results to return (default 100, max 500).

Response Fields

Field Description
count Number of files returned.
files Array of file objects with name, size_bytes, size_human, mime_type, sha256, category, ftype, download_url.

Examples

All MP4 files

curl -s "https://samplefile.com/samples/api/files?format=mp4"

CSVs between 1 and 10 MB

curl -s "https://samplefile.com/samples/api/files?format=csv&min_size_mb=1&max_size_mb=10"

Upload-testing fixtures

curl -s "https://samplefile.com/samples/api/files?use_case=upload-testing&limit=20"

Python — iterate all PDF files

import requests
files = requests.get("https://samplefile.com/samples/api/files?format=pdf").json()["files"]
for f in files:
    print(f["name"], f["size_human"], f["sha256"])
Endpoint

Format Manifest

GET /samples/{category}/{format}/manifest.json

Returns a full manifest for a specific format with all files, checksums, and download URLs. Stable and cache-friendly.

Query Parameters

Parameter Type Example Description
category path video Category name (part of the URL path).
format path mp4 Format/extension (part of the URL path).

Response Fields

Field Description
category Category name.
format Format identifier.
generated_at ISO 8601 timestamp.
methodology List of validation methods used for this format.
files Array of file objects with name, sha256, mime_type, size_bytes, size_human, download_url.

Examples

MP4 manifest

curl -s "https://samplefile.com/samples/video/mp4/manifest.json"

PDF manifest

curl -s "https://samplefile.com/samples/document/pdf/manifest.json"

Verify all checksums (shell)

curl -s "https://samplefile.com/samples/video/mp4/manifest.json" \
  | jq -r '.files[] | .sha256 + "  " + .name' > SHA256SUMS
shasum -a 256 -c SHA256SUMS

Python — verify integrity

import hashlib, requests
manifest = requests.get("https://samplefile.com/samples/document/pdf/manifest.json").json()
for f in manifest["files"]:
    data = requests.get(f["download_url"]).content
    assert hashlib.sha256(data).hexdigest() == f["sha256"], f"Mismatch: {f['name']}"
Endpoint

Formats Index

GET /samples/api/formats.json

Returns the full list of available formats with file counts and page URLs. Supports optional filters.

Query Parameters

Parameter Type Example Description
format string csv Filter to a specific format.
category string data Filter to a specific category.
use_case string upload-testing Filter to formats with use-case coverage.

Response Fields

Field Description
[] (array) Each item has category, ftype, file_count, url, and manifest_url.

Examples

All formats

curl -s "https://samplefile.com/samples/api/formats.json"

Data-category formats

curl -s "https://samplefile.com/samples/api/formats.json?category=data"

jq — list names only

curl -s "https://samplefile.com/samples/api/formats.json" | jq '.[].ftype'
Integrations

Use in Test Frameworks

Playwright

Download a fixture in beforeAll and use it across tests.

import { test, expect } from '@playwright/test';
import fetch from 'node-fetch';
import fs from 'fs';

test.beforeAll(async () => {
  const meta = await fetch(
    'https://samplefile.com/samples/api/random?format=pdf'
  ).then(r => r.json());
  const buf = await fetch(meta.download_url).then(r => r.arrayBuffer());
  fs.writeFileSync('fixture.pdf', Buffer.from(buf));
});

test('upload accepts PDF', async ({ page }) => {
  await page.goto('/upload');
  await page.setInputFiles('input[type=file]', 'fixture.pdf');
  await expect(page.locator('.upload-success')).toBeVisible();
});

Cypress

Fetch a fixture in a custom command and intercept uploads.

// cypress/support/commands.js
Cypress.Commands.add('fetchSampleFile', (format) => {
  return cy.request(
    'https://samplefile.com/samples/api/random?format=' + format
  ).then(resp => {
    return cy.request({
      url: resp.body.download_url,
      encoding: 'binary',
    }).then(file => ({
      name: resp.body.name,
      content: file.body,
      mimeType: resp.body.mime_type,
    }));
  });
});

// In test:
cy.fetchSampleFile('csv').then(({ name, content, mimeType }) => {
  cy.get('input[type=file]').selectFile({
    contents: Cypress.Buffer.from(content, 'binary'),
    fileName: name,
    mimeType,
  });
});

pytest / requests

Parametrize upload tests with real files from the API.

import pytest, requests, hashlib

API = 'https://samplefile.com/samples/api'

@pytest.fixture
def sample_pdf(tmp_path):
    meta = requests.get(f'{API}/random?format=pdf').json()
    data = requests.get(meta['download_url']).content
    assert hashlib.sha256(data).hexdigest() == meta['sha256']
    p = tmp_path / meta['name']
    p.write_bytes(data)
    return p

def test_pdf_upload(sample_pdf, upload_client):
    with open(sample_pdf, 'rb') as f:
        r = upload_client.post('/upload', files={'file': f})
    assert r.status_code == 200

Postman / Insomnia

Dynamic variables for always-fresh test files in your collection.

// Pre-request script (Postman)
const resp = await pm.sendRequest(
  'https://samplefile.com/samples/api/random?format=pdf'
);
const meta = resp.json();
pm.environment.set('sample_file_url', meta.download_url);
pm.environment.set('sample_file_name', meta.name);
pm.environment.set('sample_sha256', meta.sha256);

// Then in your request body, reference:
//   
Reference

Available Use Cases

use_case paramDescription
upload-testingFiles suited for testing upload endpoints, multipart forms, and file acceptance policies.
parser-regressionFiles for validating parsers, extractors, and format readers across software versions.
performance-benchmarkLarger files for throughput, latency, and scalability benchmarks.

Available Categories

video audio document image archive data code font ebook log subtitle certificate three-d
Missing a format?

If you need a format or use case that isn't covered, use the request form and it'll be added to the library.

Request a format