API design

Hand-drawn block of alternating terracotta and umber wedges fitted across a vertical seam, between two patchworks of cream, sand, umber and moss hatching that lean in opposite directions.

An application programming interface (API) is the set of features one piece of software offers for others to call, together with the rules and meaning of their use (Piccioni et al., 2013). Controlled experiments show that specific design choices change how quickly programmers find, understand and correctly use an interface, in the tasks tested (Ellis et al., 2007; Bogner et al., 2023). Studies of change show that interfaces break often but break fewer clients than a comparison of versions suggests (Ochoa et al., 2022a). Three questions remain disputed: how far experiments on snippets predict real use, how faithfully providers follow versioning rules, and how common API security flaws are in deployed systems.

Kinds of API

The term covers several kinds of interface, and researchers have no standard definition of it. One mapping study searched for “library”, “component”, “framework” and “SDK” (software development kit) alongside “API” for that reason (Cummaudo et al., 2022).

Library APIs expose functions and classes that a program calls inside its own process. Platform APIs expose the facilities of an operating system or runtime. POSIX, for example, defines an operating-system interface so that source code can move between systems (IEEE & The Open Group, 2024). Android’s Java framework APIs give apps access to some of the platform’s native libraries (Android Developers, 2024).

Web and network APIs are called across a network, and they come in several styles. REST is distinguished by a uniform interface between components (Fielding, 2000). gRPC describes a service by the methods that can be called remotely, with their parameters and results (gRPC, n.d.). A GraphQL request is shaped like the data it asks for (GraphQL Specification Project, 2025), and SOAP defines an XML message that can travel over different protocols (World Wide Web Consortium, 2007). How these styles compare is the subject of Web APIs; interfaces built on published events are covered in Event-driven architecture.

Classifications of APIs overlap because they answer different questions about the same interface. A European Commission report rates an API’s level of access separately from how closely it follows REST (Santoro et al., 2019). A second report notes that “public API” can mean an API run by the public sector or one open to anyone on the web (Vaccari et al., 2020). The Software Engineering Institute treats message timing, synchronous or asynchronous, as yet another design choice (Gomez & Vesey, 2024).

Surveys of how widely each web style is used ask different questions of different samples. DZone’s 2022 survey asked what share of each style existed in respondents’ organizations and found GraphQL present in 35.6% of them (DZone, 2022). Its 2023 survey found 45% reporting at least some GraphQL (DZone, 2023). Postman’s 2025 vendor survey reported REST at 93%, webhooks at 50%, WebSockets at 35% and GraphQL at 33% (Postman, 2025).

How programmers learn an API Weak evidence: few or small studies support this

Documentation is a major obstacle when programmers learn a new API. In a survey and interview study of more than 440 Microsoft developers, some of the most severe obstacles concerned documentation and other learning resources (Robillard & DeLine, 2011).

Programmers first seek an overview of what an API is for, then follow one of two strategies. In interviews and a follow-up survey, developers described learning through concepts or learning through code (Meng et al., 2018). When the same researchers observed developers on an unfamiliar API, some explored it before starting the first task while others began at once (Meng et al., 2019). A separate think-aloud study identified twenty kinds of questions programmers ask while learning an API, five of them hardest to answer (Duala-Ekoko & Robillard, 2012).

Usage examples helped on the harder tasks of one experiment. In a study with the WordPress REST API, the group given examples succeeded more often on the two most complex tasks (Sohan et al., 2017). The p-value of 0.0003 means a difference this large would be very unlikely if examples made no difference. Learning from worked examples in general is covered in Learning from examples.

How documentation is organized also matters. In a 20-person lab study, programmers given documentation organized by the state of an object answered state questions in 46% of the time taken by programmers using standard Javadoc (Sunshine et al., 2014).

What usability experiments show

Experiments on API usability measure how fast and how correctly programmers complete set tasks with one design or another. Most are small, with 12 to 108 participants and a few tasks each (Ellis et al., 2007; Dey et al., 2026).

Creating objects Weak evidence: few or small studies support this

Small experiments favour plain constructors over factory methods, but not on every task. A factory method is a function that creates and returns an object, used instead of calling the class’s constructor directly. In a 12-person study, the median time to create an object was 7 minutes 10 seconds with a factory and 1 minute 20 seconds with a constructor (Ellis et al., 2007). A second task in the same study showed no statistically significant difference (p = 0.169) (Ellis et al., 2007).

Requiring values when an object is created did not make programmers err less. In a study of 30 programmers, constructors with required parameters did not prevent errors as expected, and the “create-set-call” pattern was more usable (Stylos & Clarke, 2007). In that pattern a programmer creates an empty object, sets its properties, then calls its methods. The same authors note the trade-off: required values enforce invariants, rules the object must always satisfy, at the cost of flexibility (Stylos & Clarke, 2007).

Design guidance still keeps a place for factories. The W3C’s design principles for the web platform name one valid use: creating an object that must be tied to a parent object, as in document.createXXX() (W3C Technical Architecture Group, 2026).

Discoverability Weak evidence: few or small studies support this

Where a method sits affects how quickly programmers find it. Participants were 2.4 to 11.2 times faster at combining objects when the class they were likely to explore first included a method referring to the class they needed (Stylos & Myers, 2008).

Tools can make hard-to-find methods visible, but only to programmers who use them. A code-completion plugin that suggested factory and helper methods raised success on two unfamiliar Java tasks to 15 of 16 attempts, against 8 of 16 with standard Eclipse (Santos & Myers, 2017). Participants who explored the Javadoc and rarely asked for completion missed most of the relevant suggestions (Santos & Myers, 2017).

Naming and web API design rules

Two experiments by separate groups found that following naming and design rules made web APIs easier to understand. In one, violating 11 of 12 tested REST design rules significantly lowered performance on comprehension tasks (Bogner et al., 2023). The rules covered matters such as status codes 200, 401 and 415 (Bogner et al., 2023). The exception was path length: a long hierarchical path and a short one did not differ significantly (Bogner et al., 2023).

The second experiment, with 108 participants, compared 14 pairs of API snippets that followed or broke linguistic patterns, conventions for naming endpoints and parameters (Dey et al., 2026). All 14 snippets that followed the patterns were understood better (Dey et al., 2026). Participants judged images of rendered OpenAPI documentation rather than a working API (Dey et al., 2026).

Most published design rules have not been tested this way. The authors of the first experiment describe empirical evidence for the effectiveness of most rules as lacking (Bogner et al., 2023). In an earlier survey of expert opinion, eight experts rated 28 of 82 rules as highly important, 17 as medium and 37 as low (Kotstein & Bogner, 2021).

Naming and bugs Weak evidence: few or small studies support this

Whether poorly named library methods cause bugs is unsettled. Linguistic antipatterns are names that suggest something other than what a method does. In Maven projects, the odds of a bug-inducing commit were 1.29 times higher when a project first used methods flagged for such antipatterns (Aghajani et al., 2018). The same authors’ manual review found no strong evidence that the antipatterns themselves made bugs more likely (Aghajani et al., 2018).

Misusing an API is a common source of bugs. An automated analysis of GitHub bug fixes classified 51.7% of over a million edit operations as API misuses (Li et al., 2021a). Misuse of encryption libraries has its own article, Verifying code that uses encryption.

Evaluating API usability

Learnability is the quality API usability studies measure most, and testing with developers is their most common method. A mapping review of 47 studies found that 49% studied learnability (Rauf et al., 2019), and that usability testing and controlled experiments were the most used methods (Rauf et al., 2019). The general methods are described in Usability evaluation.

Expert inspection and observation of developers find different problems. In a case study of a framework API, a developer workshop revealed problems at run time that expert inspection against usability heuristics had not shown (Grill et al., 2012). In a study of a sleep medicine API, knowing who would use the API and for what helped decide which usability problems mattered most (Mosqueira-Rey et al., 2018).

Request logs can point to hard-to-use web API endpoints without recruiting participants. In one case study, a classifier trained on logs predicted whether an endpoint had a high or low error rate with 72.25% accuracy (Koçi et al., 2020). A follow-up found that logs of the same API differed across deployments and formats, which limited what analyses they supported (Koçi et al., 2021).

How API designers work Weak evidence: few or small studies support this

API designers learn their craft mostly on the job. In interviews with 24 professionals in seven companies, designers mostly learned through practice, and the authors identified design reviews as a chance to learn (Murphy et al., 2018).

Practitioners adopt published design guidelines selectively. Ten REST API designers followed some guidelines widely and rejected others as inconsistent with good practice (Coblenz et al., 2023). Eleven of sixteen practitioners in another interview study named a guideline’s size as their biggest concern when adopting it (Peldszus et al., 2026).

Large providers write their own guidelines, and tools can check them automatically. Google’s guidance organizes an API as a hierarchy of named resources, using a few standard methods where possible and custom methods where those do not fit (Google, 2019b). One rule checker was tested on over 2,300 public API descriptions (Bogner et al., 2024). Writing the interface description before the code is discussed in Spec-driven development.

Evolution, versioning and breaking changes

An API change can break the interface without breaking most of the programs that use it. Studies therefore separate two measures: whether a new version is compatible with the old one, and whether clients actually fail. Semantic versioning is the convention that a version number’s first part changes when a release breaks compatibility. Its specification requires software to declare a public API, and calls for a new major version whenever a change to that API is backward incompatible (Preston-Werner, n.d.).

Libraries and packages

Estimates of how often library releases break compatibility differ between studies. An early study of the Maven repository found that about a third of all releases contained a binary incompatibility (Raemaekers et al., 2017). A larger replication found that 83.4% of upgrades followed semantic versioning, yet 20.1% of releases not labelled major still broke compatibility (Ochoa et al., 2022a). An experiment that upgraded Maven dependencies automatically found breaks affecting the client in 11.58% of updates. Of those breaks, 41.58% came with an update that was not a major version (Jayasuriya et al., 2025).

Far fewer clients break than releases. In that replication, breaking changes between adjacent releases affected 7.9% of the clients analysed (Ochoa et al., 2022a). In the npm ecosystem, 11.7% of sampled client packages experienced a breaking change in a dependency (Venturini et al., 2023). When clients fixed the break before the provider did, or without its help, the median recovery took 134 days (Venturini et al., 2023). Java’s own compatibility record is covered in Java.

Behavioural and transitive breakage

A change can break a client in three ways, each found at a different time. Source incompatibilities show up as compilation errors, binary ones as linkage errors when the program loads, and behavioural ones as a program that runs but does something unexpected (Jayasuriya et al., 2025).

Behavioural breaks pass every compiler check, and version numbers rarely announce them. In a Maven study, behavioural changes broke client tests in 2.30% of dependency updates, and about two-thirds of the versions responsible were minor or patch releases. The estimate depends on how much of the library the client’s own tests exercise (Jayasuriya et al., 2024).

Some breaks reach a client through libraries it never chose. In the Maven upgrade experiment, changes in transitive dependencies, the dependencies of a project’s dependencies, caused 20.36% of the breaks that affected clients (Jayasuriya et al., 2025). Which version a client receives depends on its package manager’s rules. Maven picks the version declared nearest to the project in the dependency tree, and advises declaring every library the code uses directly (Apache Maven, n.d.b).

Resolution rules can also load a version older than the code expects. In a thesis sample of Maven projects, only 7 of 35 runtime errors from version conflicts came from loading a newer library; the rest involved an older version (Mihăilă, 2025). Updates often arrive without a person approving them: in a random sample of npm update flows, 90.09% reached dependents immediately without human intervention (Pinckney et al., 2023).

Finding breaks before release

Tests written by a library’s clients catch some breaks before release, but not all. Running the tests of other dependent projects detected six of ten npm updates known to break clients (Mujahid et al., 2020). Borrowing downstream tests in Java found 19 confirmed incompatibilities that were previously unknown (Chen et al., 2020c). Recorded snapshots of how clients call a library caught deliberately introduced changes that the clients’ test assertions missed (Monce et al., 2025).

Platform APIs

Platform APIs can change behaviour without changing their signatures. In a sample of 562 Android methods whose code changed while their signature and documentation stayed the same, 363 contained changes in meaning (Liu et al., 2021a). Apps also lag behind the platform. In an Android sample, about 28% of API references in apps were outdated, with a median lag of 16 months (McDonnell et al., 2013).

Web APIs

Web APIs follow semantic versioning less consistently than their version labels suggest. In 3,075 web APIs with documented histories, 25% consistently followed the rules when clients check messages strictly (Serbout & Pautasso, 2024b). The share rose to 46% under the assumption of tolerant readers, clients that ignore fields they do not recognize (Serbout & Pautasso, 2024b).

Changes cost client developers work, even when they add to an API rather than remove from it. In a study of four web API providers and ten open-source clients, provider changes forced work on client developers (Espinha et al., 2014). In commits from 24 client applications, newly added methods were linked with more client code changes, files and developers (Wang et al., 2018).

A comparison of interface descriptions misses changes in the running service. Across 17 versions of Azure networking APIs, testing found five regressions in the specifications and nine in the services themselves (Godefroid et al., 2020). In tests of a sample of public REST APIs, 63% of failures were inconsistencies between responses and specifications (Martin-Lopez et al., 2022).

Hyrum’s law and the robustness principle Weak evidence: few or small studies support this

Practitioners argue that users come to depend on any behaviour they can see, documented or not. Drawing on his experience of infrastructure migrations, Hyrum Wright stated it as a law: with enough users, all observable behaviours will be depended on by somebody (Wright, n.d.).

The robustness principle, which advises accepting inputs permissively, draws a related critique. An Internet Architecture Board document argues that tolerating errors lets them become entrenched, forcing other implementations to tolerate them too (Thomson & Schinazi, 2023).

Providers handle this differently depending on whether they can edit their clients’ code. A Google engineer describes a migration as transparent only if it preserves responses, state changes and latency for all existing traffic (Adharapurapu, n.d.). Inside Google’s shared codebase, library authors instead applied changes to client code directly, which reduced one category of build failure (Wright, 2020).

Versioning and deprecation

Web APIs signal versions in more than one way. In one corpus of OpenAPI descriptions, 22% placed a version identifier in the URL path (Serbout & Pautasso, 2024a). GitHub instead asks callers to name the version in a request header (GitHub, n.d.a).

Standard HTTP headers announce when an interface will go away. A Deprecation header tells clients when a resource is deprecated (Dalal & Wilde, 2025), and a Sunset header says when a URI is likely to stop responding (Wilde, 2019).

Keeping old versions running has a cost. In interviews about microservice APIs, practitioners reported that carrying several versions can add to code and API size and complexity (Lercher et al., 2024).

Reporting errors

An error report serves two readers: a program that must decide what to do, and a person who must understand what went wrong. Interface standards give each its own field. RFC 9457, the format for problem details in HTTP APIs, makes a type URI the primary identifier of a problem. It tells clients not to parse the human-readable detail (Nottingham et al., 2023). Node.js gives the same split a stability promise: an error’s code changes only between major versions, while its message may change in any version (Node.js, n.d.a).

Coarse error categories lead callers to retry the wrong failures. In Hadoop, one broad exception class grouped permission failures, which should not be retried, with transient errors. Even a correct list of retryable errors can go stale as applications and libraries change (Stoica et al., 2024). Retry bugs and retry policy are covered in Failure handling in distributed systems.

Wording of diagnostics Contested: studies disagree on this

Studies disagree on whether rewording diagnostics helps people fix errors. In a six-task study of novice C programmers, handwritten explanations beat stock compiler messages in four tasks, and explanations written by GPT-4 in only one (Santos & Becker, 2024). In an introductory Java course, enhanced syntax error messages had no significant effect (Denny et al., 2014). The evidence on compiler messages is covered in Compilers.

Deadlines, retries and paging beyond web APIs

The contract questions that web APIs raise about time limits, repeated requests and paging also arise in libraries, databases and batch jobs, where documentation defines the mechanisms. Go’s standard context type carries deadlines and cancellation signals across API boundaries and between processes (The Go Authors, n.d.b).

Paging through a database is only predictable when the order and the snapshot are defined. PostgreSQL warns that LIMIT returns an unpredictable subset of rows unless ORDER BY puts them in a unique order (PostgreSQL Global Development Group, n.d.b). At the Read Committed isolation level, two queries in one transaction can see different data if another transaction commits between them (PostgreSQL Global Development Group, n.d.d). A cursor, a server-side position in a result, cannot be used outside the transaction that created it unless it is declared WITH HOLD, which keeps it after a successful commit (PostgreSQL Global Development Group, n.d.a).

Batch jobs need a definition of when two runs are the same run. Spring Batch defines a job instance as the job plus its identifying parameters (Spring, n.d.b). When processing and progress records are saved in separate transactions, a failure between the two can make the step run again and process the same items twice (Spring, n.d.a).

Command-line interfaces as contracts

A command-line program that scripts call is an API, with its commands, flags, exit codes and output as the contract. The rules for it come from standards and guides rather than experiments. POSIX fixes parts of the syntax, such as the first -- argument marking the end of options (IEEE & The Open Group, 2018). The GNU coding standards ask every program to support --version and --help (Free Software Foundation, n.d.).

The practitioner guidelines separate what a script reads from what a person reads. The Command Line Interface Guidelines recommend exit status zero for success and nonzero for failure. They send machine-readable results to standard output and log messages and errors to standard error (Prasad et al., n.d.). They also advise never requiring an interactive prompt, so that every input can be passed as a flag or argument (Prasad et al., n.d.).

Output that scripts parse needs its own stability promise. The same guidelines suggest a --plain or --json mode for scripts, and a warning at run time with a migration path before any break (Prasad et al., n.d.). Git makes such a promise for git status: its version 1 “porcelain” format will not change incompatibly across Git versions or user settings (Git, n.d.).

Two studies of users point to limits of defaults and plain-text output. In a dataset of command aliases from GitHub, 14.48% of customizations overrode a tool’s defaults (Schröder & Cito, 2021). Screen reader users in a qualitative study named manual pages, terminal tables and long command output as recurring obstacles (Sampath et al., 2021).

File formats

A file format is a contract between the program that writes a file and every program that reads it later, including newer versions and other tools. Formats state what a reader does with data it does not recognize, and they choose differently.

FormatUnknown data a reader may pass overUnknown data that stops the reader
SQLite (SQLite, n.d.)A newer write version: the file opens read-onlyA newer read version: the file cannot be read or written
PNG (W3C, 2025)Unknown ancillary chunks are ignoredAn unknown critical chunk is fatal to extracting the image
Parquet (Apache Parquet, n.d.)Optional features an older reader can skipFeatures that make the data unreadable to older software

Version labels alone can mislead. Parquet’s documentation warns that writers set the format version to 1 or 2 without a consistent link to the features they use (Apache Parquet, n.d.). Old feature sets also persist. In a sample of about 300 public Parquet files, most used only the minimum features of Parquet version 1, though their writing software dated from after 2020 (Zeng et al., 2025b).

Opening a file is not the same as preserving it. PNG requires an editor that changes critical chunks to drop the unknown chunks marked unsafe to copy (W3C, 2025). The Python library openpyxl warns that shapes are lost when an existing spreadsheet is opened and saved under the same name (openpyxl, n.d.).

Programs that read the same format can still disagree on what it means. Impala stores one kind of Parquet timestamp with a different timezone offset from Hive and Spark (Apache Spark, n.d.). Spark’s maintainers report that large numbers of existing Parquet files written by Arrow with one time annotation could not be imported into Spark (KC, 2026). An evaluation of office document formats found no alternative implementation of ODF or OOXML fully compatible with the dominant one (Shah & Kesan, 2008).

Security Weak evidence: few or small studies support this

OWASP’s ranking of API security risks rests on expert judgement rather than measured prevalence. The project determined the prevalence ratings of its 2023 API Security Top 10 by consensus among its project team (OWASP API Security Project team, 2023b). One category, broken object property level authorization, merges the 2019 categories of excessive data exposure and mass assignment (OWASP API Security Project team, 2023c). Injection and cross-site request forgery are covered in Web security.

Public bug bounty data count the flaws that researchers report and programs disclose. In 1,056 public bug bounty reports, 158 (14.96%) concerned information disclosure (Opie & Zhang, n.d.).

Measuring prevalence also needs a count of the APIs at risk, and that count varies with the method. Cloudflare’s traffic-based inventory found a median of 33% more public-facing endpoints than its customers’ own lists (Cloudflare, 2024). In web security measurements more broadly, sampling only top-ranked domains biased estimates, sometimes upward and sometimes downward (Zhang et al., 2026ai).

Interfaces designed for AI agents raise their own questions, covered in Tools for AI agents and Websites and AI agents.

Further reading

  • Bogner, Kotstein and Pfaff’s experiment tests whether REST design rules make web APIs easier to understand, and reviews the evidence behind such rules (Bogner et al., 2023).
  • Ellis, Stylos and Myers compared factories with constructors in an early controlled study of API usability (Ellis et al., 2007).
  • Rauf, Troubitsyna and Porres map 47 API usability studies, what they measured and which methods they used (Rauf et al., 2019).
  • Ochoa and colleagues’ Maven study separates releases that break compatibility from clients that actually break (Ochoa et al., 2022a).
  • Jayasuriya and colleagues’ upgrade experiment on Maven separates source, binary and behavioural breaks and measures how many reach clients through transitive dependencies (Jayasuriya et al., 2025).
  • OWASP’s methodology page explains how the API Security Top 10 was compiled, including its use of expert consensus (OWASP API Security Project team, 2023b).

Known gaps

What this article cannot tell you yet.

  1. The REST design rules and naming patterns were tested only on documentation snippets; their effect on developers integrating with a live API or maintaining a client was not researched.
  2. A direct replication of the early object-creation experiments (factory, constructor parameters, method placement) was not found.
  3. How the benefit of usage examples changes as tasks become less similar to the examples was not researched.
  4. How often changes flagged in web API descriptions cause failures in deployed clients, and how long those clients take to recover, was not researched.
  5. Whether selecting a web API version by URL path or by request header leads to better client outcomes was not researched.
  6. Silent behaviour changes in platform APIs were researched for Android only, not for POSIX or Windows.
  7. No study measuring confirmed API-specific authorization flaws across a representative sample of deployed APIs was found.
  8. How often changes to command-line tools break the scripts that call them, and whether following command-line guidelines reduces such breaks, was not researched.
  9. Whether reviewing an interface’s compatibility promises before it is built reduces client breakage was not researched.
  10. The rules for error identifiers, unknown data in file formats, deadlines and paging rest on standards and project documentation; their effect on failures in practice was not researched.
  11. The field study of learning obstacles at Microsoft, the interview study of documentation preferences and the qualitative study of REST practitioners were available only as abstracts.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 98 references