Why did my API call return 400?
Download MarkdownBecause validation is strict on purpose. Rather than guess at what you meant, the API refuses the request with { "error": "bad_request" }.
Because validation is strict on purpose. Rather than guess at what you meant, the API refuses the request with { "error": "bad_request" }.
The usual causes are an id that is not a well-formed uuid, a limit or offset outside its allowed range, an unknown value for an enumerated filter, a text value over its length cap, or a body that is not a valid JSON object.
Two behaviors save you most of the guesswork: an empty string is treated exactly like leaving the parameter off, and a query parameter the endpoint does not recognize is ignored rather than rejected. So fix the one argument that failed and retry once. Never retry the same call unchanged.
Related Articles
- What can the CloseMagnet API do?It reads almost everything in your account, and what it writes is deliberately narrow. Its endpoints span 17 domains and the large majority are read-only. The ones that write do one of these things:
- How do I create an API credential?Only the account owner can mint one, and it happens at Settings -> API.
- What is the difference between my account API token and a scoped credential?Your account API token was minted automatically when the account was created. It sits pinned as the first row in Settings -> API with the type "Automatic", carries a fixed set of scopes, can be revealed again at any time, and can
- How do I rotate or revoke a credential?It depends which kind you have, and only the account owner can do either one.