API Reference

PosStar exposes a RESTful API at /api/v1. All endpoints require JWT authentication unless marked as public.

Base URL

# Cloud hosted
https://api.posstar.net/api/v1

# Self-hosted
http://localhost:4000/api/v1

Authentication

All authenticated requests must include a Bearer token in the Authorization header:

Authorization: Bearer <your-jwt-token>

Quick Reference

Response Format

All API responses follow this structure:

// Success response
{
  "id": "uuid-here",
  "name": "Product Name",
  "price": 1999,
  "created_at": "2025-05-18T12:00:00Z"
}

// List response
[
  { "id": "...", "name": "..." },
  { "id": "...", "name": "..." }
]

// Error response
{
  "statusCode": 400,
  "message": "Validation failed",
  "error": "Bad Request"
}

Swagger / OpenAPI

Interactive API documentation is available at /api/docs on your PosStar instance. This Swagger UI lets you test endpoints directly from the browser.