Appearance
Routes ​
Overview ​
The Backend API registers its HTTP routes from four route files, plus one route defined in code. App\Providers\RouteServiceProvider::boot() decides the URL prefix and middleware group for each file. Broadcast channels and closure console commands live in two more files under routes/.
| File | Mounted at | Middleware group | Auth guard | Routes | Clients | Page |
|---|---|---|---|---|---|---|
routes/api.php | /api (all routes under /api/v1) | api | auth:api (Passport, users) on the signed-in half; auth.user-or-external on auth/verify | 268 | Collage Admin | Admin API |
routes/dam-api.php | /dam (all routes under /dam/v1) | api | auth:dam-api (Passport, dealer_users) plus dam-api | 90 | Brand Portal | Portal API |
routes/external-api.php | /external (all routes under /external/v1) | api | auth:external-api (Passport, external_app) plus external-api | 12 | Customer integrations | External API |
routes/web.php | / | web | adminSession on /admin and /dam-db-backup (operator session) | 115 | Internal super-admin panel, status pages | Web |
RouteServiceProvider | /health | none | None | 1 | Monitors, load balancers | Web |
routes/channels.php | /broadcasting/auth | auth:api,dam-api | api or dam-api, pinned per channel | 6 channels | Collage Admin, Brand Portal | Web |
routes/console.php | Artisan | - | - | 1 command | CLI | Web |
routes/web2.php | Not loaded | - | - | 0 | - | Web |
Route counts are route definitions in the file (comments excluded). By method: api.php has 173 POST, 84 GET, 5 DELETE, 4 PATCH, 1 PUT; dam-api.php has 55 POST, 35 GET; external-api.php has 11 POST, 1 GET; web.php has 66 POST, 49 GET. Four api.php routes and three web.php routes are inline closures; every other route points to a controller method. See Controllers.
How a request reaches a controller ​
php
// app/Providers/RouteServiceProvider.php (boot)
Route::get('/health', [HealthController::class, 'index']);
Route::middleware('api')->prefix('api')->group(base_path('routes/api.php'));
Route::middleware('web')->group(base_path('routes/web.php'));
Route::prefix('dam')->middleware('api')->namespace($this->namespace)->group(base_path('routes/dam-api.php'));
Route::prefix('external')->middleware('api')->namespace($this->namespace)->group(base_path('routes/external-api.php'));The order of middleware on any API route is:
- Global middleware from
App\Http\Kernel::$middleware:TrustProxies,HandleCors,CheckForMaintenanceMode,PreventRequestsDuringMaintenance,ValidatePostSize,TrimStrings,ConvertEmptyStringsToNull. - The
apigroup:LogApiRequests,throttle:apiandSubstituteBindings. Theapirate limiter is 600 requests per minute, keyed by the user id or, when signed out, the IP. - Route-group middleware from the file: guards (
auth:api,auth:dam-api,auth:external-api), workspace and portal checks (checkUserWithWS,dam-api,external-api,check.external), an extrathrottle:600,1, and the ETag pairsetEtag/IfNoneMatchEtag.
web.php routes get the web group instead (cookies, session, ShareErrorsFromSession, VerifyCsrfToken, SubstituteBindings). All aliases are defined in App\Http\Kernel::$routeMiddleware; see Middleware.
How grouping works in the route files ​
The files use plain Laravel groups, nested two to four levels deep:
Route::prefix('v1')->group(...)at the top of each API file gives every path itsv1segment.Route::middleware([...])->group(...)orRoute::group(['prefix' => ..., 'middleware' => [...]], ...)adds guards and checks. Prefix and middleware add up as groups nest. For example,routes/api.phpputsdigital-assetsinsideauth:api, soPOST /api/v1/digital-assets/category/addrunsapi,throttle:600,1,auth:api,checkUserWithWS,setEtag,IfNoneMatchEtag.Route::prefix('...')->group(...)groups by feature (instance,category,collection,tile, ...). The route pages use these groups as their sections.Route::controller(X::class)->group(...)is used inexternal-api.phpandweb.php, so routes inside name only the method.- Only
web.phpnames routes (->name('subscription.plans.list')and similar), for its Blade views. The API files use no route names and no resource routes; ids arrive as path segments ({collectionId}) or, more often, request fields.
Code names differ from UI names. In paths and controllers, category is a folder, collection is a Collage, instance is a Brand Portal and dealer user is a portal user.
Conventions shared by the API files ​
- Almost every endpoint is
GETorPOST, including updates and deletes. A few newer routes usePUT,PATCHandDELETE(ACL, tiles, Collage delete, asset version remove, passkey remove, portal settings). - The workspace travels in the request as
url_workspace_idorworkspace_id(the workspace url_slug), not in the path.checkUserWithWSvalidatesurl_workspace_idfor Admin routes; Portal routes resolve the portal indam-api. - Responses use the
App\RestResource\RestResponseenvelope:status,code,message,data, anderrorfor validation failures. The External API page lists the helpers and their HTTP codes.
Known problems found while mapping routes ​
- Three routes point to methods that do not exist:
POST /api/v1/subscription/update-subscription-date,POST /dam/v1/digital/recent-upload-urlandPOST /admin/subscription/users-status. - The
GET /api/v1/filepreviews/...closures run Artisan commands without auth. - Five
web.php/adminroutes skip theadminSessioncheck (login and Stripe/customer redirects). See Web.