# 411 Length Required

> https://http-status.org/docs/411

**Family:** 4xx Client Error

## Rationale

Server refuses to accept the request without a defined Content-Length.

## In Plain Terms

You're trying to send me something, but you didn't tell me how big it is. I need to know the size before I can accept it.

## Description

The HTTP 411 Length Required status code indicates that the server refuses to accept the request without a defined Content-Length header.

## Server Perspective

### Usage
- Return 411 when the endpoint requires a known body length in advance
- Use it when chunked or streaming request semantics are not accepted for that operation
- Server requires Content-Length for processing
- Upload endpoints that need size validation
- Streaming requests without proper headers
- Security policies requiring content length

### Implementation
- Explain that Content-Length is required
- Document whether chunked transfer encoding is supported as an alternative

### Common Headers
- Content-Length

### Body
- Optionally include a concise error explaining that an accepted Content-Length or transfer mode is required.

### Pitfalls
- Do not require Content-Length when your server already supports the transfer mode being used
- Do not use 411 for requests that do not meaningfully send a body
- Chunked transfer encoding is supported
- GET requests (no body expected)
- Content size is properly specified

## Client Perspective

### Pitfalls
- Do not assume the problem is payload size; the problem is missing accepted length metadata

## Examples

### File upload without Content-Length

Server requires Content-Length header to process the upload

**Request:**
```
POST https://api.example.test/api/upload
```

**Response:**
```
411 Length Required
Content-Type: application/json

{
  "error": "content_length_required"
}
```

## Related Codes

- [400 Bad Request](/docs/400.md)
- [413 Content Too Large](/docs/413.md)

