Best way to check wether a project name is available with the API?

The question is in the title : What’s the best way to check wether a project name is available with the API?

Right now I compute the namespaced project name (user/project form) and try to get it with the API. A 404 means that the name is available.

But as I’m checking it from another application, I should apply the same slug function to the real project name to be consistent with GitLab’s. In other words, I must be sure my sluggified project name used in the availability check will be the same as GitLab when creating the project, and I don’t know if it’s the case or how it can be done.