API Reference

Base URL: https://siamsmartweb.com

Authentication

Most endpoints require Authorization: Bearer <your-key>. Generate an API key from your dashboard after signing up.

POST/api/validate

Validate AI-generated code against live docs for your stack.

Auth: API key or session JWT

Request Body

{ "code": "string", "files": { "package.json": "string", ... }, "task": "string", "skill_name": "string", "session_token": "string" }

Response

{ "data": { "valid": bool, "issues": [{ "line": num, "column": num, "message": "string", "severity": "error|warning" }], "summary": "string", "checked_libraries": ["string"] }, "usage": { "credits_used": num, "credits_remaining": num } }

Example

curl -X POST https://siamsmartweb.com/api/validate \
  -H "Authorization: Bearer ca_liv...EY" \
  -H "Content-Type: application/json" \
  -d '{"code":"<code>","files":{"package.json":"{}"}}'

400 (invalid body), 401 (bad auth), 413 (payload >5MB), 429 (rate limit: 60/min)

code must be a non-empty string. files must be an object with string values. files.package.json is used for dependency detection.

POST/api/detect-stack

Analyze package.json to detect the technology stack.

Auth: API key or session JWT

Request Body

{ "files": { "package.json": "string" } }

Response

{ "data": { "libraries": ["Next.js"], "versions": { "next": "16.2.9" }, "frameworks": ["nextjs"], "total_deps": number } }

Example

curl -X POST https://siamsmartweb.com/api/detect-stack \
  -H "Authorization: Bearer ca_liv...EY" \
  -H "Content-Type: application/json" \
  -d '{"files":{"package.json":"<content>"}}'

400 (invalid body), 401 (bad auth), 413 (payload >100KB)

Only files.package.json is used. Other file keys are ignored.

GET/api/usage

Check remaining credits, daily usage, and recent API calls.

Auth: API key or session JWT

Response

{ "data": { "credits_remaining": 200, "credits_total": 200, "plan": "free", "used_this_month": 0, "daily_usage": [{ "date": "2026-06-11", "validations": 5, "credits_used": 5 }], "recent": [{ "created_at": "ISO8601", "issues_count": 2, "warnings_count": 1, "valid": true }], "recent_api_calls": [{ "endpoint": "/api/validate", "skill_name": "code-validation", "credits_cost": 1, "created_at": "ISO8601" }] } }

Example

curl https://siamsmartweb.com/api/usage -H "Authorization: Bearer ca_liv...

401 (bad auth)

POST/api/skills/resolve

Resolve skills with dependency tree, compile prompts, return session token.

Auth: API key or session JWT

Request Body

{ "skills": ["code-validation"], "context": { "project_name": "my-app" } }

Response

{ "data": { "name": "code-validation", "resolved_skills": ["code-validation"], "prompt": "string", "session_token": "uuid", "expires_at": "ISO8601", "recommended_skills": [{ "name": "...", "reason": "..." }] } }

Example

curl -X POST https://siamsmartweb.com/api/skills/resolve \
  -H "Authorization: Bearer ca_liv...EY" \
  -H "Content-Type: application/json" \
  -d '{"skills":["code-validation"]}'

400 (invalid skills/context), 401 (bad auth), 413 (payload >500KB)

Context keys must be alphanumeric with dots/dashes/underscores. Values injected as {{context.key}} in prompts.

GET/api/docs

List all libraries indexed in the docs cache.

Auth: None

Response

{ "data": [{ "library": "Next.js", "version": "16.2.9" }] }

Example

curl https://siamsmartweb.com/api/docs
GET/api/docs/check-stale

Check which indexed libraries have newer versions on npm.

Auth: None

Response

{ "data": [{ "library": "Tailwind CSS", "cached_version": "4.3.0", "npm_latest": "4.4.0", "stale": true, "error": null }] }

Example

curl https://siamsmartweb.com/api/docs/check-stale
POST/api/account/export

Export all account data (GDPR Access / Portability Right).

Auth: Session JWT only

Response

{ "data": { "account": { "id":"uuid","email":"...","plan":"free","credits_remaining":200,"credits_total":200,"email_confirmed":true,"created_at":"ISO8601" }, "api_keys": [...], "validation_logs": [...], "exported_at": "ISO8601" } }

Example

curl -X POST https://siamsmartweb.com/api/account/export \
  -H "Authorization: Bearer <sessi...

Returns machine-readable JSON. Use for data portability.

POST/api/account/delete

Permanently delete account and all data (GDPR Deletion Right).

Auth: Session JWT only

Response

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

Example

curl -X POST https://siamsmartweb.com/api/account/delete \
  -H "Authorization: Bearer <sessi...

Irreversible. Deletes auth user, API keys, validation logs, users row.

POST/api/account/update

Update account profile (GDPR Correction Right).

Auth: Session JWT only

Request Body

{ "name": "New Name" }

Response

{ "data": { "updated": true, "fields": ["name"] } }

Example

curl -X POST https://siamsmartweb.com/api/account/update \
  -H "Authorization: Bearer *** \
  -H "Content-Type: application/json" \
  -d '{"name":"New Name"}'

400 (no valid fields), 401 (bad auth)