Understand the inputs and outputs of an API call
An API lets your application work with a model through code. Before implementing it, understand what goes in and what comes back.
Explain what a model call needs as input and how an application should handle the result.
01Before you begin
Basic familiarity with HTTP and JSON helps. This is a concept exercise: no API key or paid call is needed.
02Try it together
Describe your application in plain language. List inputs, expected outputs, and failure behavior. Verify the current interface and pricing in the official docs when implementing.
Task: turn meeting notes into action items. Input: note text provided by the user. Output: task, owner, and deadline. Mark missing information as “to be confirmed”. On failure: show an error and allow a retry. Do not treat a failed call as an empty task list.
Make this example fit your own task. Start simple, then adjust.
03How do you know it worked?
Are the inputs sufficient? Can the application use the output structure? Are missing data and failed requests handled differently?
04Now it’s your turn.
Write an input-output contract for a small tool you want to build. Include two possible error cases.
When you’re done, take a moment to check:
Official reference: Claude Help Center ↗