liveBook · Manning

Contract

As explained in Crack Any Codebase with AI

An external API is an interface exposed by a separately operated system for client software to access its operations or data.

An API is a boundary that lets client software use operations or data exposed by another system. An external API belongs to a separately operated service, such as Stripe, SendGrid, or Twilio, rather than a process your team runs. section 9.1 section 8.3.1

Identify an API by asking where it runs, who calls it, and what evidence exposes the connection:

  • Classify the connection as a call to vendor code on a vendor's machine; treat Stripe, SendGrid, and Twilio as external API nodes. section 9.1
  • Search environment files for provider credentials such as STRIPE_SECRET_KEY, SENDGRID_API_KEY, or OAuth client IDs. section 9.2
  • Confirm the integration in application code: an SDK import and client setup prove that the application actually calls the service. section 9.2
  • Separate public APIs from internal APIs: public interfaces promise stability to outside integrators, while internal interfaces can be refactored by their owning team. section 8.3.1
  • Check whether the call is synchronous or asynchronous; synchronous calls expose vendor latency directly, while asynchronous messages may fail without the user noticing. section 9.1

Tracing a payment API

A payments module imports Stripe, creates a client from STRIPE_SECRET_KEY, and calls stripe.charges.create with an amount and currency. The service is not listed in docker-compose.yml because Stripe runs outside the application. Its public call belongs on the architecture graph, where its latency, availability, authentication, and retry behavior can be investigated. section 9.2 section 9.1

Listing 2.2 Calling an LLM from code via its API.
from openai import OpenAI
client = OpenAI()                                                            
  #A
 
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "What is 2+2?"}]
)
print(response.choices[0].message.content)

Use the node-and-edge classification to distinguish an external API call from programs your team runs, rented infrastructure, and client software. section 9.1

How Crack Any Codebase with AI covers it

How deep it goes
Explains API discovery through environment files, SDK code, graph edges, authentication, and versioning, but stops short of protocol internals.
Examples
Uses LLM API calls, Cal.com's public REST API, and Stripe, SendGrid, Google Calendar, and Twilio integrations.
What it assumes
Assumes basic codebase reading and service concepts while teaching how to distinguish owned services, rented infrastructure, and external APIs.
What you can do after
Diagnose/debug with it by inventorying API dependencies, locating their evidence, and tracing one request across each connected service.
How it connects
Connects APIs to service graphs, authentication, versioning, SDKs, environment variables, synchronous calls, and infrastructure as code.

Also explained in

Compare how 58 books explain contract →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Crack Any Codebase with AI. The section links point to the parts of the book it draws on.