The Avelero API provides programmatic access to Digital Product Passport (DPP) management, brand configuration, product catalog operations, and integrations. The API uses a hybrid architecture combining tRPC for private endpoints and REST for public access.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Avelero/avelero/llms.txt
Use this file to discover all available pages before exploring further.
Architecture overview
Avelero’s API is built with two distinct layers:Private API (tRPC)
Type-safe procedures for authenticated brand management, catalog operations, and product administration. All private endpoints require authentication and brand context.
Technology stack
The API server is built with:- Hono - Fast web framework for HTTP routing
- tRPC - End-to-end type-safe RPC framework
- Supabase - Authentication and storage backend
- Drizzle ORM - Type-safe database queries
- SuperJSON - Enhanced JSON serialization with Date, Map, Set support
- WebSockets - Real-time progress updates for bulk operations
Base URLs
- Development
- Production
The API runs on port 4100 in development, not the standard port 3000.
API design principles
Type safety
The tRPC layer provides end-to-end type safety from server to client. All inputs are validated with Zod schemas, and outputs are automatically typed.apps/app/src/trpc/client.tsx
Request batching
The tRPC client automatically batches multiple concurrent requests into a single HTTP call, reducing network overhead.apps/app/src/trpc/client.tsx
Context-aware procedures
Every tRPC procedure receives a fully hydrated context containing:- Authenticated Supabase client - Bound to the request’s JWT token
- Elevated admin client - For privileged operations (storage, user management)
- User object - Authenticated user details or null
- Brand context - Active brand ID and role (owner/member)
- Database connection - Drizzle instance for transactional queries
- Data loaders - Request-scoped batching and caching
- Geo context - IP address and location hints
apps/api/src/trpc/init.ts:37 for the complete context definition.
Middleware layers
The API enforces security through composable middleware:API router structure
The API is organized into domain-specific routers, each handling a distinct area of functionality:| Router | Description | Authentication |
|---|---|---|
user | User profile, invites, brand management (list/create/leave) | Protected |
brand | Brand lifecycle, members, invites, theme, collections | Protected |
catalog | Brand catalog entities (attributes, materials, manufacturers) | Protected |
taxonomy | Global read-only taxonomy data | Protected |
products | Products, variants, attributes | Protected |
bulk | Bulk import/export operations | Protected |
composite | Performance-optimized composite endpoints | Protected |
summary | Aggregated statistics | Protected |
integrations | Integration connections (Shopify), sync, mappings | Protected |
notifications | User-specific in-app notifications | Protected |
internal | Server-to-server endpoints (WebSocket progress updates) | API key |
dppPublic | Public DPP access by UPID or barcode | Public |
apps/api/src/trpc/routers/_app.ts:44 for the complete router definition.
Public REST endpoints
The following endpoints are accessible without authentication:Health check
Integration health
OAuth routes
Integration OAuth flows use raw HTTP endpoints (not tRPC) because OAuth providers redirect directly to them:GET /integrations/shopify/install- Initiate Shopify OAuthGET /integrations/shopify/callback- Handle Shopify OAuth callback
apps/api/src/index.ts:86 for OAuth route implementation.
WebSocket endpoints
The API provides real-time progress updates for long-running operations via WebSockets.Import progress
apps/api/src/lib/websocket-manager.ts for WebSocket implementation.
CORS configuration
The API enforces strict CORS policies with configurable origins:apps/api/src/index.ts:24
ALLOWED_API_ORIGINS environment variable (comma-separated list with optional wildcards).
Error handling
The API uses tRPC’s error system with standardized error codes:UNAUTHORIZED- Missing or invalid authenticationFORBIDDEN- Insufficient permissions for the requested operationBAD_REQUEST- Invalid input parameters or missing brand contextNOT_FOUND- Requested resource does not existINTERNAL_SERVER_ERROR- Unexpected server errors
Next steps
Authentication
Learn how to authenticate API requests with JWT tokens
Products API
Explore the products API endpoints