Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Reading the Response · Lesson 9 of 9

When Success Isn't the Whole Story

A free lesson from Swipe AI · Building With AI APIs, level 2 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
A request going through isn't a guarantee the answer inside is actually useful. 🚧

A request can succeed — no error, no rejection, the provider accepted it and sent something back — and still not give you what you actually needed. The response might come back with an empty output field, a result that doesn't match what you asked for, or content your code wasn't expecting at all.

This is exactly why checking the response before using it matters, even when the request technically worked. Good code validates: is the expected field actually present? Is it empty? Does it look like a reasonable answer, or something clearly off? Skipping that check means bugs show up as bad output shown to a real user, not as an obvious crash.

A request that "succeeds" but still needs a second look:

response: {
            output: "",
            tokens_used: 2,
            finish_reason: "complete"
          }

No error was returned — but output is empty. Code that skips checking this would show nothing (or crash) instead of catching the problem.
Technically successful and still not usable — this is exactly what a validation check is for.
Quick check

Why does a successful request still need its response checked before use?

Fill in the blank

Good code checks a response's content — is the field present, is it empty, does it look reasonable — ____ using it.

True or false

If an API request succeeds with no error, the content it returns is guaranteed to be exactly what your code expected.

Chapter quiz

Reading the Response

10 questions · pass with 60% — just like in the app.

Quick check

Why is treating the entire response object as "the answer" a mistake?

True or false

An API response typically bundles the actual answer together with other metadata, like token usage.

Fill in the blank

The response field name that holds the actual answer ____ between different providers.

Quick check

What should you check before relying on a response field name in your code?

True or false

A request can technically succeed and still return an empty or unexpected result.

Fill in the blank

Good code checks a response for problems ____ using its content.

Quick check

What does it mean when an API request "succeeds" but the expected field is empty?

True or false

Skipping response validation means problems are more likely to show up as bad output shown to a real user, rather than an obvious crash.

Fill in the blank

A response bundling the real answer together with details like token counts is an example of ____ data.

Quick check

Which of these is a genuine reason to validate a response before using it?

Keep your streak going in Swipe AI

Swipe through every level of Building With AI APIs on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →