Introduction
The SFLUV API is a RESTful API that powers the SFLUV local currency platform. Built on Go with chi router, it provides endpoints for multi-role governance, workflow management, merchant operations, and token interactions on Berachain.Base URL
All API requests should be made to:Architecture
The SFLUV API operates with three PostgreSQL databases:- app - Users, roles, workflows, votes, credentials, affiliates
- bot - Faucet events, redemption codes, W9 submissions
- ponder - Indexed blockchain transfers and approval events
Request Format
All requests must include proper headers:Example Request
Response Format
All responses are returned in JSON format with appropriate HTTP status codes.Success Response
HTTP Status Codes
The API uses standard HTTP status codes:| Status Code | Meaning |
|---|---|
200 | OK - Request succeeded |
201 | Created - Resource successfully created |
400 | Bad Request - Invalid request data |
401 | Unauthorized - Invalid or missing authentication |
403 | Forbidden - Authenticated but insufficient permissions |
404 | Not Found - Resource doesn’t exist |
500 | Internal Server Error - Server-side error |
Error Handling
When an error occurs, the API returns an appropriate HTTP status code. Most errors return just the status code without a body.Common Error Responses
403 Forbidden - No Authentication
Returned when theAccess-Token header is missing or invalid:
403 Forbidden - Insufficient Permissions
Returned when the user doesn’t have the required role:curl -X GET https://api.sfluv.app/admin/users \
404 Not Found
Returned when a resource doesn’t exist:400 Bad Request
Returned when request data is malformed:500 Internal Server Error
Returned when a server-side error occurs:Role-Based Access Control
The API implements role-based access control with these roles:- Admin - Full system access, bypasses all role checks
- Merchant - Can create locations and accept payments
- Proposer - Can create workflow proposals and templates
- Improver - Can claim and complete workflow steps
- Voter - Can vote on workflow proposals
- Issuer - Can grant/revoke credentials
- Supervisor - Can oversee workflow operations
- Affiliate - Can create events and manage payouts
Middleware Guards
Routes are protected with middleware functions:withAuth()- Requires valid authenticationwithAdmin()- Requires admin role (or valid X-Admin-Key)withProposer()- Requires proposer rolewithImprover()- Requires improver rolewithVoter()- Requires voter rolewithIssuer()- Requires issuer rolewithSupervisor()- Requires supervisor rolewithAffiliate()- Requires affiliate role
API Categories
The API is organized into these main categories:User Management
/users- User CRUD operations/admin/users- Admin user management
Workflow System
/proposers/*- Workflow creation and templates/improvers/*- Workflow step claiming and completion/voters/*- Workflow voting/supervisors/*- Workflow oversight/workflows/*- Public workflow access
Credentials
/issuers/*- Credential issuance and revocation/credentials/types- Credential type management
Locations & Merchants
/locations- Location management/admin/locations- Location approval
Wallets
/wallets- Wallet management
Affiliates
/affiliates/*- Affiliate operations/events- Event management
Financial Operations
/redeem- Code redemption/unwrap- Token unwrapping/w9/*- Tax compliance
Blockchain Data
/ponder/*- Transaction subscriptions/transactions- Transaction history
Rate Limiting
Currently, the API does not enforce rate limiting. However, please be mindful of request frequency to ensure system stability.CORS Policy
The API allows cross-origin requests from all origins (*) with these allowed headers:
AcceptAuthorizationContent-TypeX-CSRF-TokenAccess-TokenX-Admin-Key
Next Steps
Authentication
Learn how to authenticate with Privy JWT tokens
API Reference
Explore all available endpoints