Auth is a header
Authentication is a header that proves the caller. A Bearer token, an API key header, or a signed request are all just ways to fill that header. The server checks it before it does any work, and answers 401 if it is missing or bad.
Secrets leak from history
A token typed on the command line is stored in shell history and often in logs. Read it from an environment variable or a file. This is not style, it is security: a leaked token is a leaked account.