Update API project documentation

This commit is contained in:
Isabelle Nachbaur 2026-05-30 22:26:53 +02:00
parent ba14acccd8
commit e274f2626b

55
API.md
View File

@ -111,6 +111,14 @@ Query parameters:
Response: list of creator cards including follow state and avatar URL.
### Public Profile
```http
GET /api/v1/profiles/{creatorId}
```
Used by public creator profiles. The response contains display name, slug, bio, avatar URL, average rating and subscriber count.
### Update Profile
```http
@ -144,6 +152,8 @@ GET /api/v1/prompts?sortBy=date&ascending=false&limit=50&search=cat
Used by Marketplace. Supports sorting, search and category filtering.
Response items include prompt title, description, creator id, creator name, creator avatar, example image, price, like/save counts and access state.
### Feed
```http
@ -177,6 +187,23 @@ Request:
Response: created prompt. The frontend redirects to `/post-detail?id={id}`.
### Own Prompts
```http
GET /api/v1/prompts/mine
```
Used by My Profile to show prompts created by the logged-in user.
### Update Prompt
```http
PUT /api/v1/prompts/{id}
Content-Type: application/json
```
Request body uses the same editable fields as prompt creation. Used by the edit prompt flow.
### Prompt Detail
```http
@ -193,6 +220,20 @@ Response includes:
- example output
- example image
- rating data
- like/save state and counts
Paid prompts return no detail content for users without access.
### Likes and Saves
```http
PUT /api/v1/prompts/{id}/likes
DELETE /api/v1/prompts/{id}/likes
PUT /api/v1/prompts/{id}/saves
DELETE /api/v1/prompts/{id}/saves
```
Used by Dashboard, prompt detail and profile tabs to store user interactions.
### Reviews
@ -240,8 +281,20 @@ Default categories are created automatically when the backend starts.
### Follow or Subscribe to Creator
```http
GET /api/v1/subscriptions/{creatorId}
PUT /api/v1/subscriptions/{creatorId}
DELETE /api/v1/subscriptions/{creatorId}
```
Used by Community to follow or unfollow creators.
Used by Community and public profiles to read follow state, follow creators or unfollow creators.
## Error Handling
Common response codes used by the frontend:
- `200 OK`: request succeeded
- `400 Bad Request`: validation error or invalid request data
- `401 Unauthorized`: user is not logged in and should be redirected to login
- `404 Not Found`: requested prompt, profile or subscription was not found
The frontend handles failed requests with visible error states or redirects to login for unauthorized users.