How to create a API with Customer SQL

I would like to write my customer SQL to getting data instead of using the predefined API Doc.

Is it possible?