Overview
| Property | Value |
|---|---|
| Protocol | HTTPS |
| Data format | JSON |
| Auth method | Bearer token (Swarms API key) |
| Versioning | Unversioned (/api/reviews) |
| Idempotency | One review per API key per item — duplicates are rejected with 409 |
model_type value | What it refers to |
|---|---|
agent | An AI agent listed at swarms.world/agents/{id} |
prompt | A system prompt listed at swarms.world/prompts/{id} |
tool | A tool listed at swarms.world/tools/{id} |
Base URL
Authentication
All write operations (POST) require a Swarms Platform API key passed as a Bearer
token in the Authorization header.
- Sign in at swarms.world.
- Navigate to Settings → API Keys.
- Click Generate new key and copy the value shown once.
401.
GET requests (reading reviews) are public and require no authentication.
Endpoints
POST /api/reviews
Submit a 1–5 star rating and written comment for an agent, prompt, or tool. Authentication: Required (Bearer token)Request
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <api_key> | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Constraints | Description |
|---|---|---|---|---|
model_id | string | Yes | Non-empty string | The unique ID of the agent, prompt, or tool being reviewed. Find this in the URL of the listing page (e.g. swarms.world/agent/abc123 → abc123). |
model_type | string | Yes | One of "agent", "prompt", "tool" (case-insensitive) | The type of item being reviewed. |
rating | integer | Yes | Integer between 1 and 5 inclusive | Star rating. 1 = Poor, 2 = Fair, 3 = Good, 4 = Very Good, 5 = Excellent. Decimal values are not accepted. |
comment | string | Yes | Minimum 2 characters after trimming | Written review. Describes your experience with the item. Whitespace is trimmed from both ends before saving. |
Example Request Body
Response
Success — 201 Created
The review was saved. The response body contains the persisted review record.
| Field | Type | Description |
|---|---|---|
success | boolean | Always true on a 201 response. |
review | object | The saved review record (see Review object below). |
review.id | string (UUID) | Unique identifier of the new review. |
review.model_id | string | The ID of the item that was reviewed. |
review.model_type | string | Normalised type string ("agent", "prompt", or "tool"). |
review.rating | integer | The rating that was saved (1–5). |
review.comment | string | The trimmed comment that was saved. |
review.created_at | string (ISO 8601) | UTC timestamp when the review was created. |
Error Responses
| HTTP Status | error field value | When it occurs |
|---|---|---|
400 | "Authorization header with a Bearer token is required" | Authorization header is missing or malformed. |
400 | "Request body must be valid JSON" | Body cannot be parsed as JSON. |
400 | "model_id is required" | model_id is absent or not a string. |
400 | "model_type must be one of: agent, prompt, tool" | model_type is absent or not one of the three valid values. |
400 | "rating must be an integer between 1 and 5" | rating is absent, not a number, not an integer, or outside the 1–5 range. |
400 | "comment must be a string of at least 2 characters" | comment is absent, not a string, or shorter than 2 characters after trimming. |
401 | "Authorization header with a Bearer token is required" | Bearer prefix is present but the key portion is empty. |
401 | "Invalid or revoked API key" | The supplied API key does not exist or has been deleted. |
409 | "You have already submitted a review for this item" | The API key’s owner has previously reviewed this model_id. One review per user per item is enforced. |
500 | "Failed to save review" | Database write failed. Retry the request. |
GET /api/reviews
Fetch all reviews for a given agent, prompt, or tool, along with summary statistics. Authentication: None — this endpoint is public.Request
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | The unique ID of the item whose reviews you want to retrieve. Same format as the model_id used when submitting. |
Example Request
Response
Success — 200 OK
| Field | Type | Description |
|---|---|---|
reviews | array | Ordered list of review objects (newest first). Empty array if no reviews exist. |
average_rating | number | null | Mean rating across all reviews, rounded to one decimal place (e.g. 4.3). null when no reviews exist. |
total | integer | Total number of reviews for this item. |
reviews:
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Unique review identifier. |
model_id | string | ID of the reviewed item. |
model_type | string | Type of the reviewed item ("agent", "prompt", or "tool"). |
rating | integer | Star rating (1–5). |
comment | string | Written review text. |
created_at | string (ISO 8601) | UTC timestamp when the review was submitted. |
users | object | null | Public profile of the reviewer. null if the user account no longer exists. |
users.full_name | string | null | Reviewer’s display name. |
users.username | string | null | Reviewer’s @username on the platform. |
users.avatar_url | string | null | URL to the reviewer’s avatar image. |
Error Responses
| HTTP Status | error field value | When it occurs |
|---|---|---|
400 | "model_id query parameter is required" | The model_id query parameter is missing from the URL. |
500 | "Failed to fetch reviews" | Database read failed. Retry the request. |
Data Models
Review object
ReviewWithUser object (GET response only)
GET response envelope
POST success response
Error response (all error cases)
HTTP Status Codes
| Code | Meaning |
|---|---|
200 | Reviews fetched successfully (GET). |
201 | Review submitted and saved (POST). |
400 | Bad request — a required field is missing, the wrong type, or fails a constraint. |
401 | Unauthorized — API key missing, malformed, or revoked. |
409 | Conflict — the caller’s account has already reviewed this item. |
500 | Internal server error — database read or write failed. |
Error Reference
All error responses share the same shape:| Error message | Code | Fix |
|---|---|---|
Authorization header with a Bearer token is required | 401 | Add Authorization: Bearer <key> to the request headers. |
Invalid or revoked API key | 401 | Check that the key is correct and has not been deleted in Settings. |
Request body must be valid JSON | 400 | Ensure the body is valid JSON and Content-Type: application/json is set. |
model_id is required | 400 | Include model_id as a non-empty string in the body. |
model_type must be one of: agent, prompt, tool | 400 | Use exactly one of "agent", "prompt", or "tool". |
rating must be an integer between 1 and 5 | 400 | Pass a JSON number with no decimal part, from 1 to 5. |
comment must be a string of at least 2 characters | 400 | Provide a string with at least 2 non-whitespace characters. |
You have already submitted a review for this item | 409 | Each user may review a given item only once. This is by design. |
model_id query parameter is required | 400 | Add ?model_id=<id> to the GET request URL. |
Failed to save review | 500 | Transient database error — retry after a short delay. |
Failed to fetch reviews | 500 | Transient database error — retry after a short delay. |
Rules and Constraints
One review per item per user
Each API key is tied to exactly one platform user account. That user may submit only one review per item (model_id). Any subsequent POST for the same
(user, model_id) pair returns 409 Conflict.
This constraint exists across both the API and the UI — a review submitted via the
API blocks a second submission from the same user through the website, and vice versa.
Rating scale
| Value | Label |
|---|---|
1 | Poor |
2 | Fair |
3 | Good |
4 | Very Good |
5 | Excellent |
4.5 returns a 400.
Comment length
- Minimum: 2 characters (after whitespace is trimmed).
- Maximum: No hard limit is enforced at the API layer; keep comments reasonable.
model_type casing
model_type is normalised to lowercase before storage. "Agent", "AGENT", and
"agent" are all accepted and stored as "agent".
Review ordering (GET)
Reviews are always returned newest-first (created_at DESC). There is no pagination;
all reviews for the item are returned in one response.
average_rating precision
average_rating is rounded to one decimal place using round-half-up. A mean of
4.25 is returned as 4.3. When there are no reviews the field is null, not 0.
Code Examples
cURL
Submit a review
Fetch reviews for an item
Python
Handling the duplicate-review case
JavaScript / TypeScript
Handling the 409 Conflict gracefully
Notifications
When a review is saved, the platform automatically sends an email notification to the owner of the reviewed item. This happens asynchronously — it does not delay or affect the API response. The email is not sent when:- The reviewer and the item owner are the same user account.
- The item cannot be found in the database (e.g. invalid
model_id). - The owner’s account has no registered email address.
Changelog
| Date | Change |
|---|---|
| 2026-04-13 | Initial release of POST /api/reviews and GET /api/reviews. |