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
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
}When assembling an API request, what three things do you need to decide, in order?
In a request, the ____ carries the actual prompt text along with any settings.
Assembling an AI API request looks fundamentally different depending on which provider you use.
Putting the Pieces Together
10 questions · pass with 60% — just like in the app.
What determines the shape of payload a request expects and the shape of response it returns?
Different endpoints from the same provider can expect completely different payload shapes.
Picking the right ____ is the first decision in assembling a request, since it determines what payload shape is expected.
Where does the API key sit relative to the payload in a request?
An invalid API key is rejected before the payload is ever read.
The API key is checked ____ of whatever the payload actually contains.
Assembling a full AI API request comes down to answering which three questions?
The underlying shape of an API request — endpoint, key, payload — stays consistent across different providers, even though exact field names vary.
In a request, the ____ is where the actual prompt text and settings live.
Why might sending a text-generation payload to an image-generation endpoint fail?
Free ai tools
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 →