Passing system instructions to the Anthropic Messages API

CCDV-F Applications & Integration Easy Question 30 of 105

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?

Show answer and explanation

DMove 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.

Source: platform.claude.com/docs/en/api/messages

Anonymous, no account needed. Your tally stays in this browser.

Next question Start 5 timed questions Browse all 105 original CCDV-F practice questions