Laravel API Route – 404

  laravel, laravel-api, laravel-routing, url-routing

I’m building an API to support an external application. I have added several routes to it with no problem, but suddenly, when I add a new route (acars/delay), I get a 404 error when trying to hit with a POST request. Here is my api.php file:

Route::post('acars/deactivate', '[email protected]');

Route::post('acars/ofp', '[email protected]');

Route::post('acars/create', '[email protected]');

Route::post('acars/pirep', '[email protected]');

Route::post('acars/mx', '[email protected]');

Route::post('acars/delay', '[email protected]'); // <-- THIS IS THE BROKEN ROUTE

Controller method:

public function delay(Request $request) {
    $acars = AcarsFlight::findOrFail($request->acars_flight_id);
    $delay = AcarsDelay::create([
    return $delay;

The other routes work fine, but acars/delay returns a 404 in Postman every time. My php artisan route:list output looks like this:

Output of php artisan route:list

There are no wildcards causing conflicts. I have tried clearing my route cache multiple times, restarting the server, etc. I have also tried moving the broken route to different positions in the api.php file, but no luck. The only thing I can think of is that I recently upgraded the application from Laravel 6 to 8. I read the upgrade guides for v7 and v8, and the only thing I found was that in starting v7, unique route names are required, a requirement I believe I have met. I have verified about a thousand times that I’m using the right URL. Copying+pasting the URL into the browser gives me the extected 405 error.

Source: Laravel

Leave a Reply