CCDV-F Applications & Integration MEDIUM
PRODUCTION SCENARIO
You are building a diagram inspection tool that submits PNG architecture diagrams to Claude. You want to pass the image data directly in the API call without uploading to an external image host.

What is the correct structure for an image content block in the Messages API?

Answering here is anonymous. Nothing is saved unless you sign in.

Show answer and explanation

Answer: A content block with `type: "image"`, `source: { type: "base64", media_type: "image/png", data: "<base64_encoded_string>" }`.

Anthropic's Messages API supports images via base64 encoding inside an image content block. The source object specifies type: "base64", the exact MIME type (e.g. image/png, image/jpeg), and the base64-encoded binary string.
Free

Keep practicing CCDV-F

105 original CCDV-F practice questions, each with an explanation and a source link. No account needed.

Start free practice set → Timed, explained, free