Developer guide

Fix Blogger API 400 Bad Request

A 400 error means the request body could not be understood. It is almost always a JSON formatting problem, not an account problem.

Steps

  1. Set header Content-Type: application/json
  2. Build JSON with a library (json.dumps / JSON.stringify) instead of string concatenation
  3. Make sure title and html are present and non-empty
  4. Escape double quotes inside HTML, or use single quotes in attributes

Example (python)

import json, requests
body = {"title": "My post", "html": '<p class="x">Safe "quotes"</p>', "is_draft": True}
requests.post("https://blogjh.lovable.app/api/public/v1/posts", headers={"Authorization": "Bearer bpk_live_YOUR_KEY"}, json=body)

FAQ

Why does it work in Postman but not my script?

Your script probably builds JSON by hand. Use json= or JSON.stringify.

More guides