# 507 Insufficient Storage

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

**Family:** 5xx Server Error

## Rationale

The server is unable to store the representation needed to complete the request (WebDAV).

## In Plain Terms

I don't have enough storage space left to save what you're trying to upload. My disk is full!

## Description

The HTTP 507 Insufficient Storage status code indicates that the server is unable to store the representation needed to complete the request. The server may be temporarily unable to store the request due to disk space limitations.

## Server Perspective

### Usage
- Return 507 when the operation would create, copy, or persist data but the server currently lacks the storage capacity to finish it
- Use it for temporary storage exhaustion rather than for requests that are inherently too large
- WebDAV operations when the server cannot store the representation needed to complete the request
- File or document uploads when the server has exhausted available disk, memory, or equivalent storage capacity
- Create or copy operations that would succeed if server storage were available

### Implementation
- Log which storage resource is exhausted and whether the failure is expected to be temporary
- If recovery timing is known, consider including retry guidance or Retry-After-like metadata in the response body or headers

### Common Headers
- No status-specific header is required; Retry-After can be useful when the storage shortage is expected to clear soon

### Body
- A body is recommended; describe the storage limitation in safe terms and include machine-readable retry or support metadata when available

### Pitfalls
- Do not use 507 when the request body itself is too large regardless of server capacity; that is 413 Content Too Large
- Do not use 507 for user-plan or authorization rules that are not really storage exhaustion
- Request payload too large (use 413 Content Too Large)
- General server errors (use 500 Internal Server Error)
- Application-level user quota or plan restrictions better represented as a business rule (use 403 Forbidden, 409 Conflict, or 422 Unprocessable Content as appropriate)
- Temporary service issues unrelated to storage exhaustion (use 503 Service Unavailable)

## Client Perspective

### Pitfalls
- Do not assume the resource itself is invalid
- Do not treat 507 as proof that the user must upgrade their plan unless the API says so explicitly

## Examples

### WebDAV file upload with insufficient disk space

Server's disk is full and cannot store the uploaded video file

**Request:**
```
PUT https://api.example.test/files/video.mp4

<binary video payload>
```

**Response:**
```
507 Insufficient Storage
Content-Type: application/json

{
  "error": "insufficient_storage"
}
```

### Document management system at capacity

Document storage system has reached capacity limits

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

<binary document payload>
```

**Response:**
```
507 Insufficient Storage
Content-Type: application/json

{
  "error": "insufficient_storage"
}
```

## Related Codes

- [413 Content Too Large](/docs/413.md)
- [423 Locked](/docs/423.md)
- [503 Service Unavailable](/docs/503.md)

