You get a 404 if you do not enter an id because Go will only see /api/text/get/{id} and not /api/text/get/ . It will see these two as two seperate paths. If you want to make a not found, you need to also handle /api/text/get/ .