What does HTTP status code 301 mean?
The 301 Moved Permanently status code indicates that the target resource has been permanently moved to a new URI specified in the Location header.
When to use it in APIs
Use when restructuring API paths (e.g., moving /v1/leads to /v2/leads permanently). However, be aware that many HTTP clients will change post requests to GET requests when following a 301.
How it compares to other codes
- 308 Permanent Redirect: The modern replacement that guarantees the HTTP method (e.g. POST) remains unchanged during redirect.
- 302 Found: A temporary redirect.