API Design and Management

Designing interfaces that are intuitive, stable, secure and easy to evolve.

APIs are contracts. Once other teams, partners or customers depend on them, every change carries a cost. Good API design makes interfaces easy to understand and hard to misuse, and makes it possible to evolve them without breaking the people who rely on them.

With AI agents increasingly calling APIs as tools, clear naming, consistent behaviour and good documentation matter more than ever.

Choosing a style

Each style suits different needs; many organisations use more than one.

REST
Resource-oriented, stateless, using standard HTTP methods. The default for most public and internal APIs.
GraphQL
Clients ask for exactly the data they need through a single endpoint. Useful for varied front-end needs.
gRPC
Efficient, strongly typed calls between services, well suited to internal, high-volume communication.
Events
Asynchronous messages through a broker, decoupling producers from consumers.

Design first

Write the API specification (OpenAPI for REST, a schema for GraphQL, protobuf for gRPC) before writing code, and review it with the people who will use it. A shared specification lets teams work in parallel, generates documentation and clients, and allows contract tests that catch breaking changes automatically.

Consistency and evolution

Agree organisation-wide conventions for naming, errors, pagination, filtering and dates, and apply them everywhere. Evolve APIs by adding, not changing: new optional fields and new endpoints are safe; removing or renaming things is not. When breaking changes are unavoidable, version the API and give consumers a clear deprecation timeline.

Security and gateways

Every API needs authentication and authorisation, input validation against the schema, rate limiting and audit logging for important actions. API gateways centralise many of these concerns, along with routing and analytics. Never expose sensitive fields in errors or logs.

APIs for AI agents

AI agents use APIs through tool definitions, often via the Model Context Protocol. Clear operation names, precise descriptions, predictable errors and safe defaults help agents use them correctly. Scope agent access tightly and require confirmation for destructive operations.

Documentation and developer experience

An API is only as good as its documentation. Publish reference documentation generated from the specification, plus short guides for common tasks, working examples and a sandbox where developers can try calls safely.

Measure developer experience directly: how long it takes a new consumer to make a first successful call, and what questions they ask. Every repeated question is a gap in the documentation or the design.

Internal versus public APIs

Internal APIs can evolve faster because you know every consumer and can coordinate changes. Public and partner APIs need more stability, longer deprecation periods, stricter versioning and stronger security. Decide early which kind each API is, because moving from internal to public later usually means redesigning it.

How to put it into practice

  1. Publish API conventions for naming, errors, pagination and versioning.
  2. Adopt design-first: specification reviewed before implementation.
  3. Generate documentation and client libraries from the specification.
  4. Add contract tests to catch breaking changes in CI.
  5. Put external APIs behind a gateway with authentication and rate limits.
  6. Write clear descriptions for APIs that AI agents will call as tools.

Common mistakes

  • Breaking existing consumers with "small" changes.
  • Inconsistent conventions across teams, so every API feels different.
  • Exposing internal data models directly as the API.
  • Documentation that drifts out of date with the code.

How to measure progress

  • Breaking changes released without a version change (aim for zero).
  • Time for a new consumer to make a first successful call.
  • Error rates and latency per endpoint.
  • Share of APIs with a reviewed specification and contract tests.

Go further