| Status code | 407 |
|---|---|
| Status text | Proxy Authentication Required |
| Category | 4xx Client Error |
| Response has body | Usually |
| Specification | RFC 9110 |
What does 407 Proxy Authentication Required mean?
A proxy between you and the server wants credentials before it will forward the request. It belongs to the 4xx Client Error class, which means the request contains bad syntax or cannot be fulfilled. Something about the request needs to change.
When do APIs return 407?
On corporate and institutional networks where outbound traffic goes through an authenticating proxy. The response comes from the proxy, not from the API: the request has not reached its destination. It carries a Proxy-Authenticate header naming the scheme the proxy accepts.
How to fix a 407 Proxy Authentication Required
Send the proxy's own credentials in a Proxy-Authorization header; in curl that is -U user:password alongside -x. Do not confuse it with the API's credentials, which go in Authorization as usual. If you did not expect a proxy at all, check the HTTPS_PROXY and HTTP_PROXY environment variables, which most HTTP clients read without being asked.
Reproduce a 407 response
The fastest way to understand a status code is to trigger one and read the full response. Open the
API tester and send a request to https://httpbin.org/status/407 — you will
see the 407 status along with every response header the server sent. Comparing those headers against
a working request is often what reveals the cause.
When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.
Related 4xx status codes
400 Bad Request
The server could not understand the request because it is malformed.
401 Unauthorized
The request lacks valid authentication credentials. Despite the name, this means unauthenticated.
402 Payment Required
The request cannot be processed until payment is made.
403 Forbidden
The server understood the request and knows who you are, but refuses to authorise it.
404 Not Found
The server cannot find the requested resource.
405 Method Not Allowed
The endpoint exists but does not support the HTTP method you used.
407 Proxy Authentication Required FAQ
What is the difference between 407 and 401?
401 comes from the server you were trying to reach and asks for its credentials in an Authorization header. 407 comes from a proxy on the way and asks for the proxy's credentials in a Proxy-Authorization header. With a 407 the request never reached the destination.
How do I pass proxy credentials in curl?
Name the proxy with -x and give its username and password with -U, as in curl -x http://proxy.example.com:3128 -U user:password https://api.example.com/. Lower-case -u is for the destination server, not the proxy.
Why do I get 407 from a script when the browser works?
The browser is signing in to the proxy for you, usually with your operating system login, and the script is not. Give the script the proxy credentials explicitly, or run it somewhere that does not go through the proxy.
See also
- 401 Unauthorized — The request lacks valid authentication credentials. Despite the name, this means unauthenticated.
- 403 Forbidden — The server understood the request and knows who you are, but refuses to authorise it.
References
- RFC 9110, 407 Proxy Authentication Required — The specification that defines this status code.
- MDN: 407 Proxy Authentication Required — MDN's reference page for this status code.