---
title: "Returns `n` bytes of deterministic content with range-request support."
url: "https://developer.rucho.org/apis/rucho/versions/5bdf1bcb-8db4-40f1-a293-72c7198e26c8/operations/range_handler"
---

> Full API specification: https://developer.rucho.org/apis/rucho/versions/5bdf1bcb-8db4-40f1-a293-72c7198e26c8.md

# Returns `n` bytes of deterministic content with range-request support.

`GET` `/range/{n}`

Operation ID: `range_handler`

Without a `Range` header: `200 OK`, full body, `Accept-Ranges: bytes`. With a satisfiable `Range`: `206 Partial Content` + `Content-Range`. With an unsatisfiable `Range`: `416 Range Not Satisfiable` + `Content-Range: bytes */n`. `n` is capped at `MAX_BYTES_RESPONSE_SIZE` (10 MiB); larger values return 400.

## Path parameters

- `n` (integer, required) - Total number of bytes the resource represents (max 10485760)

## Responses

- `200` - Full body (no Range header)
- `206` - Partial body for a satisfiable Range
- `400` - n exceeds MAX_BYTES_RESPONSE_SIZE
- `416` - Range not satisfiable

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: rucho
  version: 1.6.0
servers:
  - url: https://rucho.org
    description: Production (EKS us-east-2, behind Kong)
paths:
  /range/{n}:
    get:
      tags:
        - crate::routes::range
      summary: Returns `n` bytes of deterministic content with range-request support.
      description: >-
        Without a `Range` header: `200 OK`, full body, `Accept-Ranges: bytes`.

        With a satisfiable `Range`: `206 Partial Content` + `Content-Range`.

        With an unsatisfiable `Range`: `416 Range Not Satisfiable` +
        `Content-Range: bytes */n`.

        `n` is capped at `MAX_BYTES_RESPONSE_SIZE` (10 MiB); larger values
        return 400.
      operationId: range_handler
      parameters:
        - name: n
          in: path
          description: Total number of bytes the resource represents (max 10485760)
          required: true
          schema:
            type: integer
            minimum: 0
      responses:
        "200":
          description: Full body (no Range header)
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        "206":
          description: Partial body for a satisfiable Range
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        "400":
          description: n exceeds MAX_BYTES_RESPONSE_SIZE
        "416":
          description: Range not satisfiable
```
