Amba

Reviews

Moderate user reviews — stats, list, approve / reject, delete.

Reviews live on reviewable_items (the thing being reviewed) and reviews (user-submitted). Aggregations are done server-side with COUNT(*) FILTER so stats never pull whole tables into Node.

Source: apps/api/src/routes/admin/reviews.ts.

Endpoints

MethodPathDescription
GET/admin/projects/:projectId/reviews/statsTotal, avg rating, pending count, 1-5 distribution.
GET/admin/projects/:projectId/reviewsPaginated reviews with user + item info; optional ?is_approved=true|false.
GET/admin/projects/:projectId/reviews/exportStream reviews as CSV/NDJSON.
PATCH/admin/projects/:projectId/reviews/:reviewIdFlip is_approved.
DELETE/admin/projects/:projectId/reviews/:reviewIdHard-delete.
GET/admin/projects/:projectId/reviews/itemsPaginated list of reviewable items ordered by avg rating.

GET /admin/projects/:projectId/reviews/stats

Response 200

{
  "data": {
    "total_reviews": 1234,
    "average_rating": 4.32,
    "pending_approval": 15,
    "rating_distribution": { "1": 10, "2": 20, "3": 100, "4": 400, "5": 704 }
  }
}

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/reviews/stats
developer auth
curl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/reviews/stats'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/reviews/stats' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

GET /admin/projects/:projectId/reviews

Query

ParamDefaultDescription
limit50
offset0
is_approved"true" or "false".

Response 200

{
  "data": [
    {
      "id": "…",
      "app_user_id": "…",
      "reviewable_item_id": "…",
      "rating": 5,
      "body": "…",
      "is_approved": true,
      "app_users": { "id": "…", "display_name": "…", "avatar_url": "…" },
      "reviewable_items": { "item_type": "product", "item_id": "…" }
    }
  ],
  "total": 1234,
  "offset": 0,
  "limit": 50
}

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/reviews
developer auth
curl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/reviews'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/reviews' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

PATCH /admin/projects/:projectId/reviews/:reviewId

Request

FieldTypeRequired
is_approvedbooleanyes

Errors

  • 404 NOT_FOUND.

Try it:

PATCH/admin/projects/%7B%7BprojectId%7D%7D/reviews/%7B%7BreviewId%7D%7D
developer auth
curl -X PATCH 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/reviews/%7B%7BreviewId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X PATCH '${BASE_URL}/admin/projects/{projectId}/reviews/{reviewId}' \
  -H 'Authorization: Bearer ${DEV_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

DELETE /admin/projects/:projectId/reviews/:reviewId

{ "data": { "deleted": true } }

Try it:

DELETE/admin/projects/%7B%7BprojectId%7D%7D/reviews/%7B%7BreviewId%7D%7D
developer auth
curl -X DELETE 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/reviews/%7B%7BreviewId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X DELETE '${BASE_URL}/admin/projects/{projectId}/reviews/{reviewId}' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

GET /admin/projects/:projectId/reviews/export

Stream reviews as CSV (default) or NDJSON. Streamed via a postgres.js cursor with batch size 500.

Query

ParamTypeDefaultDescription
formatcsv | ndjsoncsvOutput format.
sinceISO-8601Optional lower bound on created_at.
rating_minint (1-5)1Minimum star rating.
rating_maxint (1-5)5Maximum star rating.

Response 200

Content-Type: text/csv; charset=utf-8 or application/x-ndjson; charset=utf-8. Columns: id, reviewable_item_id, app_user_id, rating, title, body, is_approved, created_at, updated_at.

Errors

  • 400 INVALID_SINCEsince is not a parseable ISO-8601 timestamp.
  • 400 INVALID_RATING_MIN / INVALID_RATING_MAX — outside 1-5.

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/reviews/export
developer auth
curl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/reviews/export'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/reviews/export' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

GET /admin/projects/:projectId/reviews/items

Reviewable items ordered by avg_rating DESC.

Query

ParamDefault
limit50
offset0

Response 200

{
  "data": [
    { "id": "…", "item_type": "product", "item_id": "…", "avg_rating": 4.3, "review_count": 123 }
  ],
  "total": 42,
  "offset": 0,
  "limit": 50
}

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/reviews/items
developer auth
curl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/reviews/items'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/reviews/items' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'