4xx Client ErrorRFC 9110
410Gone
Resource permanently deleted and will not return.
What it means
The resource previously existed but has been permanently deleted and will not be available again. Unlike 404, the 410 tells clients and search engines that the resource is gone for good and they should remove it from their indexes.
When to use it
- ✓Resource was permanently deleted
- ✓API version has been permanently retired
- ✓User account was permanently deleted
- ✓You want search engines to deindex the URL
Code Examples
Express — deleted resource
javascript
app.get('/posts/:id', async (req, res) => {
const post = await db.posts.findById(req.params.id, {
includeDeleted: true,
});
if (!post) return res.status(404).json({ error: 'Not found' });
if (post.deletedAt) return res.status(410).json({
error: 'Gone',
message: 'This post has been permanently deleted',
});
res.json(post);
});