Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Putting the Pieces Together · Lesson 6 of 9

Assembling the Full Request

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

🤖
Same three pieces as Level 1 — just watch them all click together this time. 🧩

Put the last two lessons together with what you already know, and assembling a request is really just answering three questions in order: which endpoint matches the task, what API key authenticates the request, and what payload actually carries the prompt and settings. Every AI API call, no matter the provider, is built from answering those same three questions.

Here's a slightly richer example than Level 1's: imagine building a feature that turns a customer complaint into a one-sentence summary for a support dashboard. The endpoint is the provider's text-generation address. The API key authenticates your account. The payload carries the complaint text and a setting capping how long the summary can be.

Conceptual request — turning a complaint into a one-sentence summary:

endpoint:  ".../generate-text"
api_key:   "sk-••••••••••••"
payload:   {
             prompt: "Summarize this customer complaint in one sentence.",
             input_text: "Delivery was three days late; no response to emails.",
             max_output_length: 40
           }

response:  {
             output: "The delivery was three days late and the customer never got a response.",
             tokens_used: 27
           }
One coherent example: the endpoint decides where it goes, the key decides who it's from, the payload decides what's actually being asked.
Quick check

When assembling an API request, what three things do you need to decide, in order?

Fill in the blank

In a request, the ____ carries the actual prompt text along with any settings.

True or false

Assembling an AI API request looks fundamentally different depending on which provider you use.

Chapter quiz

Putting the Pieces Together

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

Quick check

What determines the shape of payload a request expects and the shape of response it returns?

True or false

Different endpoints from the same provider can expect completely different payload shapes.

Fill in the blank

Picking the right ____ is the first decision in assembling a request, since it determines what payload shape is expected.

Quick check

Where does the API key sit relative to the payload in a request?

True or false

An invalid API key is rejected before the payload is ever read.

Fill in the blank

The API key is checked ____ of whatever the payload actually contains.

Quick check

Assembling a full AI API request comes down to answering which three questions?

True or false

The underlying shape of an API request — endpoint, key, payload — stays consistent across different providers, even though exact field names vary.

Fill in the blank

In a request, the ____ is where the actual prompt text and settings live.

Quick check

Why might sending a text-generation payload to an image-generation endpoint fail?

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 →