Skip to content
Sarj Code Standards

no-create-verb-in-post-path

POST routes name their collection instead of ending in a create, add or new segment.

Why

The organization uses resource-oriented paths for predictable collection and item APIs. A trailing create, add or new segment repeats the operation in the path. HTTP POST itself supports resource-specific processing and does not require creation semantics.

Fix

Use the collection path for resource creation. Preserve deliberate external RPC contracts with a reasoned exact suppression; review client compatibility before changing a published path.

Examples

Before — flagged A POST route repeats the verb in its path
api.py
from fastapi import APIRouter
router = APIRouter()
@router.post("/tickets/create")
async def create_ticket() -> None:
return None
After — preferred A POST route names its collection
api.py
from fastapi import APIRouter
router = APIRouter()
@router.post("/tickets")
async def create_ticket() -> None:
return None