Skip to content

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/.

FileMounted atMiddleware groupAuth guardRoutesClientsPage
routes/api.php/api (all routes under /api/v1)apiauth:api (Passport, users) on the signed-in half; auth.user-or-external on auth/verify268Collage AdminAdmin API
routes/dam-api.php/dam (all routes under /dam/v1)apiauth:dam-api (Passport, dealer_users) plus dam-api90Brand PortalPortal API
routes/external-api.php/external (all routes under /external/v1)apiauth:external-api (Passport, external_app) plus external-api12Customer integrationsExternal API
routes/web.php/webadminSession on /admin and /dam-db-backup (operator session)115Internal super-admin panel, status pagesWeb
RouteServiceProvider/healthnoneNone1Monitors, load balancersWeb
routes/channels.php/broadcasting/authauth:api,dam-apiapi or dam-api, pinned per channel6 channelsCollage Admin, Brand PortalWeb
routes/console.phpArtisan--1 commandCLIWeb
routes/web2.phpNot 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:

  1. Global middleware from App\Http\Kernel::$middleware: TrustProxies, HandleCors, CheckForMaintenanceMode, PreventRequestsDuringMaintenance, ValidatePostSize, TrimStrings, ConvertEmptyStringsToNull.
  2. The api group: LogApiRequests, throttle:api and SubstituteBindings. The api rate limiter is 600 requests per minute, keyed by the user id or, when signed out, the IP.
  3. 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 extra throttle:600,1, and the ETag pair setEtag / 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 its v1 segment.
  • Route::middleware([...])->group(...) or Route::group(['prefix' => ..., 'middleware' => [...]], ...) adds guards and checks. Prefix and middleware add up as groups nest. For example, routes/api.php puts digital-assets inside auth:api, so POST /api/v1/digital-assets/category/add runs api, 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 in external-api.php and web.php, so routes inside name only the method.
  • Only web.php names 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 GET or POST, including updates and deletes. A few newer routes use PUT, PATCH and DELETE (ACL, tiles, Collage delete, asset version remove, passkey remove, portal settings).
  • The workspace travels in the request as url_workspace_id or workspace_id (the workspace url_slug), not in the path. checkUserWithWS validates url_workspace_id for Admin routes; Portal routes resolve the portal in dam-api.
  • Responses use the App\RestResource\RestResponse envelope: status, code, message, data, and error for 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-url and POST /admin/subscription/users-status.
  • The GET /api/v1/filepreviews/... closures run Artisan commands without auth.
  • Five web.php /admin routes skip the adminSession check (login and Stripe/customer redirects). See Web.