According to your question, you expose an api protected by Azure, and then you need to request an access token using the client id and client secret to access the api.
First, you must create another application as a client application, then use this client application to access the api application, and you need to grant application permissions to the client application. It is recommended that you use the client credential flow.
Next, you need to define application permissions by editing the api application manifest. This is a example.
Then, grant application permissions to the client application.

The next two steps are done using the client application:
1.First, you need to obtain the administrator's consent:
GET https://login.microsoftonline.com/{tenant}/adminconsent?
client_id=6731de76-14a6-49ae-97bc-6eba6914391e
&state=12345
&redirect_uri=http://localhost/myapp/permissions

2.Request an access token using client id and client secret:
POST /{tenant}/oauth2/v2.0/token HTTP/1.1 //Line breaks for clarity
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
client_id=535fb089-9ff3-47b6-9bfb-4f1264799865
&scope=api://your-app-id/.default
&client_secret=qWgdYAmab0YSkuL1qKv5bPX
&grant_type=client_credentials

Try using the token to access your API.