SolvedAPI & Developers

API returns 401 although I generated a key

Asked by Ryan MitchellJul 11, 2026
I am trying to script monitor creation. I looked for an API key section in settings and could not find one, so I tried using my account password with basic auth and got 401. What is the correct way to authenticate against the API?
Accepted answer from MonoDuty Support
Deniz ArslanMonoDuty Support EngineerJul 14, 2026
Exactly. The flow is: 1. Post your email and password to the login endpoint. The response contains a token field. 2. Send that value on every subsequent request as an Authorization header with the Bearer prefix. 3. When you are finished, you can call the logout endpoint, which revokes only the token you used, not your other sessions. A few practical notes for scripting: The auth endpoints are rate limited to 10 requests per minute per IP, and that budget is shared across register, login, password reset and Google sign-in. So authenticate once at the start of your script and reuse the token, rather than logging in per request. A loop that logs in each iteration will hit the limit quickly. Store the token as a secret in your CI system, never in the repository. If it leaks, resetting the account password revokes every token for that account. And since the token is tied to a user, that user's role determines what the script can do. Creating monitors requires organization owner or admin, so a script running as a plain member will get authorization errors rather than 401.
Was this helpful?62 of 64 found this helpful

3 replies

Deniz ArslanMonoDuty Support EngineerJul 12, 2026

Hi Ryan, you did not miss a settings page, there is no separate API key concept. Authentication uses the token you receive when you sign in, sent as a bearer token. Basic auth is not supported, which is why you got a 401.

Ryan MitchellJul 13, 2026

So I log in from the script and reuse the token it returns?

Ryan MitchellJul 14, 2026

Working now. The tip about the shared auth rate limit saved me a debugging session.