Overview
This endpoint supports creating ratings of multiple types:
- Helpful - Binary thumbs up/down ratings
- Star - 1-5 (or custom scale) star ratings
- NPS - Net Promoter Score ratings (0-10)
For simple helpful ratings, you can also use the legacy endpoint.
Authentication
Path Parameters
The unique identifier of the project. You can find this in the dashboard under project settings.
Body Parameters
Rating Object (required)
The rating object contains the type and value. Structure varies by type:
{
"rating": {
"type": "helpful",
"value": true
}
}
| Field | Type | Description |
|---|
type | "helpful" | Rating type identifier |
value | boolean | true for helpful, false for not helpful |
{
"rating": {
"type": "star",
"value": 4,
"max_stars": 5
}
}
| Field | Type | Description |
|---|
type | "star" | Rating type identifier |
value | integer | Star value (1 to max_stars) |
max_stars | integer | Maximum stars (1-10, default: 5) |
{
"rating": {
"type": "nps",
"value": 9
}
}
| Field | Type | Description |
|---|
type | "nps" | Rating type identifier |
value | integer | NPS score (0-10) |
NPS Categories:
- 9-10: Promoters
- 7-8: Passives
- 0-6: Detractors
Context Object (optional)
URL path where the rating relates to (e.g., /docs/getting-started).
Application version to track ratings against specific releases (e.g., 2.1.0).
User identifier who submitted the rating.
Optional key-value pairs for custom data.
Response
Unique identifier for the created rating.
The project this rating belongs to.
The type of rating: helpful, star, or nps.
The rating value object (structure varies by type).
The URL path specified in the context (if provided).
Application version specified in the context (if provided).
User identifier specified in the context (if provided).
Custom metadata specified in the context (if provided).
ISO 8601 timestamp when the rating was created.
Whether the rating has been archived (always false for newly created ratings).
Use Cases
- Product Reviews: Collect star ratings from customers
- Customer Satisfaction: Track NPS scores over time
- Documentation: Measure page helpfulness
- Feature Feedback: Let users rate specific features
- Survey Integration: Import ratings from external survey tools
curl -X POST "https://seggwat.com/api/v1/projects/550e8400-e29b-41d4-a716-446655440000/ratings/typed" \
-H "X-API-Key: oat_xxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"rating": {
"type": "helpful",
"value": true
},
"context": {
"path": "/docs/getting-started"
}
}'
{
"id": "507f1f77bcf86cd799439013",
"project_id": "550e8400-e29b-41d4-a716-446655440000",
"rating_type": "helpful",
"value": {
"type": "helpful",
"value": true
},
"path": "/docs/getting-started",
"created_at": "2024-01-16T14:25:00Z",
"archived": false
}
Validation Rules
| Type | Value Range | Notes |
|---|
| Helpful | true or false | Boolean only |
| Star | 1 to max_stars | max_stars defaults to 5, max is 10 |
| NPS | 0 to 10 | Integer only |