Which HTTP status code would you receive if you send a Claude API request with an invalid API key?
Select an answer to reveal the explanation.
Short Explanation
You’ll get 401 Unauthorized because an invalid API key means the request isn’t authenticated. It’s the status for failed authentication, not for missing resources or permission problems.
Full Explanation
HTTP 401 Unauthorized is returned when authentication fails — the API key is missing, invalid, or expired. This is the correct response for authentication failures. HTTP 403 Forbidden would indicate the credentials are valid but the account doesn't have permission for the requested resource. HTTP 404 indicates the requested resource doesn't exist. HTTP 500 indicates a server-side error unrelated to authentication. Understanding these status codes is fundamental for debugging API integrations. The 404 Not Found option is for missing resources. The 403 Forbidden option is for authorization failures on valid credentials. The 500 Internal Server Error option is for server errors.