I'm trying to use the Claude Sonnet 4 API via AWS Bedrock and keep running into an error. Here's the CURL request I'm using:
```
curl -X POST
-H "Authorization: Bearer "
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 4096,
"system": "sample system instructions",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "hi"
}
]
}
]
}'
"https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-5-sonnet-20241022-v2:0/converse"
```
The response I'm getting is:
```
{
"Message": "Unexpected field type"
}
```
I confirmed that the API key is valid since it works with the Nova Lite API. Any ideas on what might be going wrong?
1 Answer
You might want to simplify the `content` field. Instead of having it as an array with type and text elements, try using just a string. Change your content to: `"content": "hi"`. That should fix the "Unexpected field type" error you're experiencing.
Make sure you check the official AWS documentation for the latest format needed for messages. Sometimes the requirements can change!

Tried that, but I'm still getting the same error message.