New in 2.4: Test runs you can trust See what's new →

Download a verifiable byte pattern that supports HTTP Range requests

GETHEADhttps://api.testingapis.com/api/files/range/{n}

The byte at offset i is i % 256, so any slice can be checked. Single ranges such as bytes=0-99, bytes=500- and bytes=-10 return 206; unsatisfiable ranges return 416, and multiple ranges are ignored (full 200). A fixed ETag and Last-Modified make If-None-Match, If-Modified-Since and If-Range work. HEAD returns headers only.

Parameters 2

NameTypeDescription
nrequiredpath · integer (int32)Total size in bytes, 1–10485760 (10 MB).
Rangeheader · stringByte range, e.g. bytes=0-99. Returns 206, or 416 when unsatisfiable.

Responses

200
The full body.
206
The requested range.
304
Not modified (a conditional request matched).
400
n is outside 1–10485760.
416
The range is not satisfiable.

Example

Request
curl -X GET "https://api.testingapis.com/api/files/range/100" \
  -H "Range: bytes=0-9"
Run in Studio
Response206 Partial Content
Content-Type: application/octet-stream
ETag: "range-100"
Last-Modified: Tue, 01 Jul 2025 00:00:00 GMT
Content-Range: bytes 0-9/100

<binary body: 10 bytes, application/octet-stream>

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/files/range/100", {
  headers: {
    "Range": "bytes=0-9",
  },
});
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "GET",
    "https://api.testingapis.com/api/files/range/100",
    headers={
        "Range": "bytes=0-9",
    },
    allow_redirects=False,
)
print(response.status_code, response.text)
Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
            .followRedirects(HttpClient.Redirect.NEVER)
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.testingapis.com/api/files/range/100"))
            .header("Range", "bytes=0-9")
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}