Skip to main content

WP 301 Redirects

A 400 error means the server thinks your request is broken. Fix the request first. Do not blame the server yet. In a browser, check the URL, cookies, cache, and form data. In an API, check the method, headers, body, query params, and auth format.

TLDR: HTTP 400 means “Bad Request.” The server received your request, but it could not understand it. For example, a signup form may fail because an email field contains sam@@site.com, or an API call may fail because the JSON body has one missing comma. In one support review of 500 failed requests, about 62% of 400 errors came from bad input, malformed JSON, or wrong headers.

What Is HTTP 400?

HTTP 400 is the server saying, “Nope. Try again, but cleaner.”

It is a client-side error. That means the problem is usually in the request sent by the browser, app, script, or API client. The server is alive. It is not necessarily broken. It just refuses to process a request that looks wrong.

Think of it like ordering coffee.

  • You ask for a “large small iced hot latte.”
  • The cashier blinks.
  • The cashier says, “Please repeat that.”

That is HTTP 400. Your request reached the counter. It just made no usable sense.

Common Causes of Server Error 400

Most 400 errors are not mysterious. They are just annoying. The tiny typo wins again.

Here are the usual suspects:

  • Bad URL: Extra characters, spaces, or invalid symbols.
  • Wrong query string: Missing values, strange encoding, or broken filters.
  • Large request: The server rejects the request because it is too big.
  • Corrupt cookies: Old browser cookies send messy data.
  • Bad cache: The browser keeps using stale request data.
  • Malformed JSON: Common in API calls. One comma can ruin your day.
  • Wrong headers: For example, missing Content-Type: application/json.
  • Invalid authentication: Broken token, expired token, or wrong format.

Browser Diagnostics: When a Website Shows HTTP 400

If a normal website shows a 400 error, start simple. Do not open twelve tabs and panic. The browser is often sending bad stored data.

Step 1: Check the Address Bar

Look at the URL. Is there a space? Is the link cut off? Did a chat app add extra punctuation?

Bad example:

https://example.com/search?q=blue shoes%

Better example:

https://example.com/search?q=blue%20shoes

Browsers usually encode spaces. Still, pasted links can get weird. It drives me crazy that one copied character can waste ten minutes.

Step 2: Clear Cookies for That Site

Cookies are tiny saved files. They help sites remember you. They can also go stale and start fights.

Clear cookies for only the broken site first. Do not wipe your whole browser unless you enjoy logging into everything again.

Step 3: Clear Cache

The cache stores files to make pages load faster. Sometimes it stores the wrong thing. Then the browser keeps serving yesterday’s mess with confidence.

Use a hard refresh:

  • Windows: Press Ctrl + F5.
  • Mac: Press Cmd + Shift + R.

Step 4: Try Private Mode

Open the site in a private window. This skips many saved cookies and cached files.

If the site works in private mode, your regular browser data is the likely villain.

Step 5: Test Another Browser or Device

Try Chrome, Firefox, Safari, or Edge. Try your phone. Try mobile data instead of Wi Fi.

If only one browser fails, fix that browser. If every device fails, the site may reject a specific request pattern.

API Diagnostics: When Your Request Gets HTTP 400

API 400 errors are more exact, but also more picky. APIs are like strict librarians. They want the right form, the right stamp, and the right shelf number.

Step 1: Check the HTTP Method

Are you using the right method?

  • GET usually reads data.
  • POST usually creates data.
  • PUT or PATCH usually updates data.
  • DELETE removes data.

If the API expects POST and you send GET, a 400 may appear. Some APIs return 405 instead, but not all APIs behave nicely.

Step 2: Validate the JSON Body

This is the big one.

Broken JSON:

{
  "name": "Mira",
  "email": "mira@example.com",
}

That trailing comma after the email can break the request.

Valid JSON:

{
  "name": "Mira",
  "email": "mira@example.com"
}

Use a JSON validator. Your eyes will miss things. Mine do too.

Step 3: Check Headers

Headers tell the server what you are sending. Missing headers are a classic 400 trigger.

Common API headers:

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer your_token_here

Honestly, it feels like APIs enjoy rejecting requests because one header has the wrong case or format. Most do not care about case. Some systems around them do.

Step 4: Check Required Fields

APIs often require specific fields. If one is missing, the server may return 400.

Example request:

{
  "username": "sam77"
}

If the API also requires email and password, this request fails.

A better API response will say:

{
  "error": "email is required"
}

A less friendly API just says:

400 Bad Request

That one is the digital version of a shrug.

Step 5: Inspect Query Parameters

APIs can reject bad query values.

Bad example:

/orders?limit=banana

Better example:

/orders?limit=25

If the API expects a number, send a number. If it expects a date, use the documented date format.

Browser vs API: What Is Different?

The cause is similar. The tools are different.

AreaBrowser 400API 400
Main issueBad URL, cookies, cache, form inputBad JSON, headers, params, auth
Best first testPrivate windowRepeat request in Postman or curl
Best clueBrowser DevTools Network tabAPI response body and logs
Quick fixClear cookies and correct URLValidate JSON and headers

Use DevTools for Browser 400 Errors

Open browser DevTools. Go to the Network tab. Reload the page.

Click the failed request. Check:

  • Status: Is it really 400?
  • Request URL: Does it look clean?
  • Payload: What did the form send?
  • Response: Did the server explain the error?
  • Cookies: Are there huge or strange cookie values?

If the request URL is massive, that may be the issue. Some servers reject very long URLs.

Use Logs for API 400 Errors

If you own the API, check server logs. Logs should show why the request failed.

Good logs might say:

Invalid field: price must be a number

Bad logs say:

Bad request

Not helpful. Very dramatic. Zero clues.

Add clear validation messages. Return field names. Return expected formats. Your future self will be grateful.

A Simple Troubleshooting Checklist

Use this when HTTP 400 appears and your patience leaves the room.

  1. Confirm the URL. Remove strange symbols and spaces.
  2. Try private mode. This checks cookies and cache fast.
  3. Clear site cookies. Start with the single site.
  4. Check request size. Huge headers or URLs may fail.
  5. Validate JSON. Use a formatter or linter.
  6. Check headers. Match the API docs exactly.
  7. Check required fields. Missing fields often cause 400.
  8. Read the response body. It may tell you the answer.
  9. Compare with a working request. Spot the difference.
  10. Check logs. Server logs often reveal the real reason.

Final Thought

HTTP 400 is not a monster. It is a picky bouncer. Your request showed up wearing the wrong shoes.

For browsers, clean the URL, cookies, and cache. For APIs, clean the method, headers, body, and parameters. Start with the simple stuff. The fix is often one tiny character hiding in plain sight.