Steps
- Set header Content-Type: application/json
- Build JSON with a library (json.dumps / JSON.stringify) instead of string concatenation
- Make sure title and html are present and non-empty
- 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.
