API inventory and contracts
What an API contract describes
An application programming interface (API) is an agreed way for software to request an operation or information from another component. A contract describes accepted inputs, expected outputs and errors. A security inventory adds the owner, environment, audience, authentication, permissions, version and retirement date. For a fictional bookstore, the catalog is public but order details are private.
Map operations, not just URLs
In a REST-style HTTP API, GET /v2/books may return public titles while POST /v2/orders creates an order for an authenticated customer. The method is part of the contract. GraphQL commonly exposes many operations through one endpoint; inventory the permitted operations and fields too. RPC exposes named procedures, which also need input and permission contracts. These are styles, not interchangeable security protocols.
Track versions and dependencies
Suppose the order team owns /v2/orders but an old /v1/orders remains deployed for a partner. The inventory must record both, even if the old version no longer appears in the current client. Record who consumes each version, how it is protected and when it can be retired. Record upstream services and their data assumptions; validate their responses instead of assuming a partner is always trustworthy.
Common mistakes
An API specification is not proof that the deployed service follows it. A gateway inventory can miss internal services or direct paths. Compare approved deployment records, route definitions and contracts in a controlled review; investigate discrepancies with owners. Do not discover endpoints by testing public services. A documented obsolete endpoint still needs protection until it is safely removed.
Practice: build an inventory
For a fictional library, list GET /v1/titles, POST /v2/loans and an internal renewal RPC. Assign owners, audience, version, authentication and allowed actions; mark missing information unknown. Explain why an undocumented operation must be investigated, not automatically removed.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
API inventory and contracts — knowledge check
Apply API security principles to fictional scenarios.
What does an API inventory add to a contract?
Why record a method as well as a path?
What should happen to a still-used older version?
What must a GraphQL inventory include?
A partner returns a response. What is the appropriate next step?