Skip to content

Length Required

URI: https://docs.ankatech.co/errors/length-required
HTTP Status: 411 Length Required

When you see this

You sent a token request with a transfer-coded body — Transfer-Encoding: chunked — and the Auth API refused it before reading a byte. The endpoint bounds the size of the body it will accept, and a chunked body declares no size, so there is nothing to bound.

The refusal applies to POST /api/v3/auth/token only. It is raised by the filter that also enforces the size bound, so the two refusals sit together: an oversized declared length is 413, an undeclared length is this 411.

RFC 9110 §15.5.12 defines 411 for exactly this: the server declines to accept the request without a defined Content-Length. An RFC 6749 token request is a small application/x-www-form-urlencoded body, so every conforming client declares its length and nothing legitimate is refused.

Common Causes

  • An HTTP client streaming the form body instead of buffering it, which makes it send Transfer-Encoding: chunked.
  • A proxy or a debugging tool re-encoding the request on the way through.
  • A hand-built request that sets Transfer-Encoding explicitly.

Response Example

{
  "type": "https://docs.ankatech.co/errors/length-required",
  "title": "Length Required",
  "status": 411,
  "detail": "The request must declare a Content-Length. This endpoint does not accept a chunked request body.",
  "instance": "/api/v3/auth/token",
  "timestamp": 1730000000
}

Content-Type: application/problem+json — the response follows RFC 9457 Problem Details. The Auth API carries no correlation member in the body: correlate through the X-Correlation-Id response header instead. See Error Index & Overview.

How to Resolve

  1. Send the form body with a Content-Length header. Most clients do this automatically when the body is a string or a byte array rather than a stream.
  2. Do not set Transfer-Encoding by hand on this endpoint.
  3. If a proxy is adding it, buffer the request before it reaches the proxy.

For full schema definitions, examples, and interactive testing, see the Developer Hub Reference.