PRODUCTION SCENARIO
A developer moving an app onto the Anthropic Messages API passes system instructions as the first object inside the
messages array: messages: [{ role: "system", content: "You are a helpful assistant" }]. The call fails with HTTP 400.What is the correct way to supply system instructions?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Move them into the top-level `system` parameter and open `messages` with a user turn
The Messages API takes system instructions in a top-level
system parameter, and a system message carrying content cannot be the first entry in messages at all. The mid-conversation system message that some models accept is for instructions that begin partway through a session, not for a prompt that applies from the very start, so moving the object down the array is not the documented fix. There is no developer role on this API; that role belongs to another vendor's. Sending them as a user turn with an assistant prefill fails a second way, since Claude 4.6 and later models reject a prefilled last assistant message.
Official Source: https://platform.claude.com/docs/en/api/messages ↗