> For the complete documentation index, see [llms.txt](https://docs.blog-api.codewithsadee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blog-api.codewithsadee.com/references/likes.md).

# Likes

Liking/Unliking operations

## Like Blog Post

> Adds a like to a specific blog post. Increments likes count.

```json
{"openapi":"3.0.3","info":{"title":"Blog API","version":"1.0.0"},"tags":[{"name":"Likes","description":"Liking/Unliking operations"}],"servers":[{"url":"https://blog-api.codewithsadee.com/api/v1","description":"API v1 Base Path"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT Access Token obtained via login/register/refresh"}},"parameters":{"BlogIdParam":{"in":"path","name":"blogId","schema":{"type":"string","format":"objectid"},"required":true,"description":"ID of the blog post."}},"schemas":{"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Application-specific error code"},"message":{"type":"string","description":"Human-readable error message"}},"required":["code","message"]}},"responses":{"Unauthorized":{"description":"Authentication information is missing or invalid (e.g., missing/expired token).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"The specified resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"An unexpected error occurred on the server.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/likes/blog/{blogId}":{"post":{"tags":["Likes"],"summary":"Like Blog Post","description":"Adds a like to a specific blog post. Increments likes count.","operationId":"likeBlog","parameters":[{"$ref":"#/components/parameters/BlogIdParam"}],"responses":{"200":{"description":"Blog liked successfully. Returns new likes count.","content":{"application/json":{"schema":{"type":"object","properties":{"likesCount":{"type":"integer"}}}}}},"400":{"description":"User has already liked this blog.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```

## Unlike Blog Post

> Removes a like from a specific blog post. Decrements likes count.

```json
{"openapi":"3.0.3","info":{"title":"Blog API","version":"1.0.0"},"tags":[{"name":"Likes","description":"Liking/Unliking operations"}],"servers":[{"url":"https://blog-api.codewithsadee.com/api/v1","description":"API v1 Base Path"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT Access Token obtained via login/register/refresh"}},"parameters":{"BlogIdParam":{"in":"path","name":"blogId","schema":{"type":"string","format":"objectid"},"required":true,"description":"ID of the blog post."}},"responses":{"NoContent":{"description":"Request successful, no response body."},"Unauthorized":{"description":"Authentication information is missing or invalid (e.g., missing/expired token).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"The specified resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"An unexpected error occurred on the server.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Application-specific error code"},"message":{"type":"string","description":"Human-readable error message"}},"required":["code","message"]}}},"paths":{"/likes/blog/{blogId}":{"delete":{"tags":["Likes"],"summary":"Unlike Blog Post","description":"Removes a like from a specific blog post. Decrements likes count.","operationId":"unlikeBlog","parameters":[{"$ref":"#/components/parameters/BlogIdParam"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"description":"User has not liked this blog previously.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.blog-api.codewithsadee.com/references/likes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
