Is there a way to determine scope of a gitlab token via API or grapthql or other means apart from console?

We have an usecase to check if the token used in the pipeline has required permissions to be used in later stages of pipeline.