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 and Infographic
401 Unauthorized is the standard for 'I don't know who you are' — you haven't authenticated properly. 403 is 'I know who you are, but you can't have this.'
Full explanation below image
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. Option A (404) is for missing resources. Option C (403) is for authorization failures on valid credentials. Option D (500) is for server errors.