API Tutorials
Working with AI and automation APIs: authentication, requests, function calling, streaming and webhooks.
Learning series
Articles in API Tutorials (page 1 of 5)
- Webhook Security for AI Automations: Signatures, Replay Protection and Safe Payloads — A webhook is a public door into your automation, and most tutorials leave it unlocked. This guide maps threats to controls: authentication options and their strength, correct HMAC verification, replay protection, secrets, and what changes when the payload feeds a language model.
- Idempotent AI Automation: How to Stop Duplicates, Retries and Replays from Doing Damage — A retry creates two CRM records and two welcome emails, and nothing was technically a bug. Idempotency is the design idea that prevents it. This guide covers where duplicates come from and the concrete patterns, code and tests that make workflows safe to repeat.
- When an AI Agent Has Too Many Tools: Fixing Tool-Selection Ambiguity — Give an agent three different ways to look up a customer -- by email, by ID, by name search -- and it will pick a different one each time for reasons that have nothing to do with which is actually best.
- When an AI Agent Calls a Tool That Doesn't Exist — A looping agent at least calls a real tool over and over. A more disorienting failure is an agent confidently invoking a function name that was never in its tool list at all.
- n8n Stripe Node: Automating Payment Events Without Custom Webhook Code — Stripe fires a webhook for nearly everything that happens to a payment -- succeeded, failed, disputed, refunded. The n8n Stripe node and Stripe Trigger turn those events into automation without you writing and securing a custom webhook endpoint by hand.
- Building Your First AI Agent with the GPT-6 Astra API: A Step-by-Step Developer Guide — A hands-on walkthrough of building a tool-calling research agent with GPT-6 Astra, covering tool definitions, the reasoning loop, structured output, error handling, and where human checkpoints belong.
- GPT-6 Astra API: A Complete Developer's Guide to Pricing, Context, and Integration — A practical breakdown of the GPT-6 Astra API's context window, pricing, and tool-calling behavior for developers deciding whether to migrate an existing GPT-5.6 Sol integration.
- Shopify AI Automation: Connecting Your Store to n8n, Chatbots, and AI Agents — Shopify Magic handles a handful of built-in AI features inside the admin. Everything past that -- an order-status chatbot, AI-written product descriptions at scale, inventory alerts that actually think -- has to be wired up yourself, through Shopify's webhooks and Admin API rather than a settings toggle.
- n8n Respond to Webhook vs the Webhook Node: Building Synchronous APIs Without Silent 200s — The Webhook node decides when to answer; the Respond to Webhook node decides what to answer. The four response modes, the node's options, why a forgotten branch returns 200 rather than silence, and how to reply early for slow work.
- Observability for Gemini API Apps: Logging, Tracing, and Monitoring LLM Calls — Cost monitoring tells you what you spent. Observability tells you why a specific request was slow, what a multi-tool agent actually decided, and why one user got a bad answer. Here is what to log, trace, and alert on in production.
- Gemini API Long-Running Operations: The Async Polling Pattern Explained — File uploads, Batch API jobs, and File Search indexing all use the same underlying pattern: kick off an operation, poll until it is done. This guide unifies what earlier posts each covered individually into one reusable pattern.
- Testing and Mocking the Gemini API in CI/CD Pipelines — Running real Gemini API calls in every CI run is slow, costly, and non-deterministic. Here is how to structure tests that mock the client for unit tests, use recorded fixtures for integration tests, and reserve real calls for a small, deliberate smoke-test suite.
- Building a Content Moderation Pipeline with the Gemini API — Safety settings control what Gemini will and will not generate. A moderation pipeline is a different problem: using Gemini to classify content other users submitted. Here is how to build one correctly, including what to log and how to handle appeals.
- Gemini CLI: Google's Open-Source Terminal Coding Agent — Gemini CLI brings a full reason-and-act coding agent into your terminal, free, open source, with the highest free rate limits in the industry at launch. Here is what it actually does and how it differs from calling the Gemini API yourself.
- Connecting the Gemini API to n8n and Zapier: No-Code Automation Guide — Not every Gemini integration needs a codebase. n8n ships a native Google Gemini node, and Zapier can call the API directly -- here is how to wire up both for a real automated workflow, and when a no-code tool stops being the right layer.
- Building a Discord Bot with the Gemini API — A working Gemini-powered Discord bot is a few dozen lines of Python: one event handler, one Gemini call, one reply. Here is the complete pattern, including the conversation-memory and streaming details a naive version misses.
- Gemini Embeddings with a Vector Database: Building a RAG Pipeline End-to-End — The Embedding API guide covers generating vectors. This one covers the rest of a real RAG pipeline: storing those vectors in pgvector, indexing them, and querying them -- including the dimension limit that catches most first attempts.
- Using the Gemini API with the Vercel AI SDK — The Vercel AI SDK gives Gemini a framework-native interface for Next.js and React apps -- generateText, streamText, generateObject, and tool calling, all working with Gemini models through one provider package.
- Migrating from OpenAI to the Gemini API: A Practical Guide — Google ships a real OpenAI-compatible endpoint for the Gemini API, so an existing OpenAI integration can point at Gemini by changing a base URL. Here is what works out of the box, what needs a real code change, and what to check before you ship.
- Evaluating and Comparing Gemini Models: A Practical Framework — With a dozen-plus Gemini models spanning Flash, Pro, and Lite variants, picking one by reading spec sheets is not enough. Here is how to actually compare them -- AI Studio Compare Mode for quick checks, and a DIY harness for production decisions.
- Gemini Nano and Chrome Built-in AI: On-Device AI Explained — Not every Gemini feature runs in the cloud. Gemini Nano runs directly on-device inside Chrome and Android, powering built-in AI APIs with no API key, no network call, and no per-token bill -- a genuinely different product from the rest of this series.
- Firebase AI Logic: Calling Gemini Directly from Mobile and Web Apps — Every other post in this series assumes a backend holding your API key. Firebase AI Logic is the one documented way to call Gemini safely straight from an Android, iOS, Flutter, or web client -- no backend proxy required.
- Building Multi-Tool Agents with the Gemini API — Function calling, code execution, grounding, and File Search each work well alone. An agent is what happens when a model decides, turn by turn, which of them to reach for. Here is how to build one, manually and with Google ADK.
- Using the Gemini API with LangChain: A Practical Integration Guide — LangChain is one of the most common ways developers wire Gemini into larger applications -- chains, agents, retrievers. Here is how langchain-google-genai actually works, and how it relates to the official google-genai SDK.