Delete an article
Delete an article you own and verify that the API removes it.
Delete an article you own by sending its slug with a Token authorization header. A successful deletion returns 204 No Content; a follow-up read confirms that the article is no longer available.
Before you begin
You need an authenticated token for the article's author and the article's slug. The examples use the public demo API at https://api.realworld.show/api; replace YOUR_TOKEN and ARTICLE_SLUG with values from your own account. Review authentication and token usage for the required header format.
403 Forbidden.Endpoint contract
Deletes an article owned by the authenticated user and returns no content.
/articles/{slug}Token header for the article's author.
Slug of the article to delete.
curl --request DELETE \ --url https://api.realworld.show/api/articles/building-a-conduit-client \ --header 'Authorization: Token demo-jwt-token'
{}Delete and verify
Run the request with the article slug in the path and the author's token in the Authorization header.
curl --request DELETE \
--url "https://api.realworld.show/api/articles/ARTICLE_SLUG" \
--header "Authorization: Token YOUR_TOKEN"The API returns 204 No Content with an empty response body.
Request the same slug to verify that the resource is absent.
curl --request GET \
--url "https://api.realworld.show/api/articles/ARTICLE_SLUG"The API returns 404 Not Found with an error envelope similar to:
{
"errors": {
"article": ["not found"]
}
}The 404 check is the observable confirmation that the slug no longer resolves; do not retry the delete after that response. If the initial delete returns 403, the article still exists because the token belongs to a different user. Obtain a token for the article's author and repeat the request only after confirming the slug identifies the intended article.
If the request is missing a token, retry with the author's token. If the token belongs to another user, use the owning account or leave the article unchanged.
The API returns 401 Unauthorized when the token is missing and 403 Forbidden when the authenticated user does not own the article. The forbidden response identifies the resource with an error such as errors.article[0] == "forbidden".
Verify the result
204 and a subsequent GET /articles/{slug} returns 404 with errors.article[0] set to not found.An unknown slug also returns 404. A malformed request can return 422 with the standard error envelope. Do not treat an empty 204 response as JSON; there is no response body to parse.
If the follow-up request returns an article instead of 404, the delete did not target the intended slug or the request was not completed with the owning token. Check the path value and authorization header, then verify the article before retrying.
Next steps
To keep an article and change its content, use update an article. To retrieve an article before deciding whether to remove it, see read an article by slug.