FOSS Resources

What Is an API?

An API is a documented interface that lets software request data or capabilities from another system under agreed rules.

An API, or application programming interface, is a documented way for one piece of software to ask another for data, actions, or capabilities. It defines expected inputs, outputs, errors, and access rules.

The interface is not the whole service. A weather app, plugin, command-line tool, or website integration may call an API, but the API is the contract it uses to communicate with the system behind it.

Interface, caller, and provider

The caller is the software making the request. The provider is the software, service, library, operating system, or device exposing capabilities through the interface.

An interface names what can be requested and how. For a web API, that might include endpoints, methods, parameters, request bodies, response formats, status codes, authentication, and rate limits. For a library API, it may include functions, classes, inputs, return values, and exceptions.

Good API documentation explains both shape and behavior: what to send, what comes back, which errors are possible, and what changes might break existing callers.

Requests and responses

A request asks for something. It might ask a service to return data, create a record, upload a file, start a job, or change a setting.

A response tells the caller what happened. It may include requested data, an identifier, an error code, a retry hint, pagination details, or a message explaining why the request was rejected.

This request-response model is common in web APIs, but APIs are broader. A program can call an operating-system API to open a file, a plugin API to extend an app, or a library API to transform data.

Common API types

API typeTypical callerContract formatExample interactionCommon risk
Web APIApp, website, automation scriptHTTP methods, URLs, schemas, docsRequest issue data from a hosted serviceAuthentication or response changes
Library APIProgram using a dependencyFunction names, types, docsParse a file with a library callVersion changes or undocumented behavior
Operating-system APIDesktop or system softwareSystem calls, SDK docsAsk the OS to open a window or filePlatform-specific assumptions
Hardware or device APIDriver, app, or control softwareProtocol docs or SDKRead device status or send commandsPermissions and compatibility
Plugin APIExtension or integrationHost app documentationAdd a feature to an existing toolHost version drift

REST, OpenAPI, and SDKs

REST is an architectural style commonly used for web APIs. Many REST APIs use HTTP methods and resource-oriented URLs, but not every API is REST and not every REST-like service is documented equally well.

OpenAPI is a specification for describing HTTP APIs in a machine-readable way. It can help generate documentation, clients, tests, and validation, but a specification still needs accurate behavior behind it.

An SDK wraps an API for a language or platform. It can make calls easier, but it is not the same as the API itself. When something fails, the cause might be the SDK, the underlying API, credentials, network access, or input data.

Endpoints, methods, and data formats

Web API documentation often names endpoints, such as a URL path for users, repositories, files, jobs, or search results. A method describes the kind of action being requested, such as reading, creating, updating, or deleting.

Parameters narrow the request. They may appear in the URL, query string, headers, or request body. Response formats such as JSON or XML define how the returned data is structured.

Small details matter. A missing required parameter, wrong content type, unexpected date format, or unsupported field can turn a valid idea into a failed request.

Authentication, permissions, and limits

Many APIs require authentication so the provider knows who is calling. Tokens, keys, OAuth flows, sessions, and certificates are common patterns.

Permission scopes restrict what the caller can do. A token that can read public data is different from one that can delete records, publish releases, or access private repositories.

Limits protect the provider and shape application behavior. Rate limits, quotas, pagination, file-size limits, and timeout rules can affect whether an integration works reliably.

Versioning and breaking changes

APIs change over time. A provider may add fields, deprecate endpoints, change authentication requirements, or publish a new version with different behavior.

Additive changes are often easier for callers to handle. Removing fields, changing meanings, altering error formats, or modifying rate-limit rules can break integrations even when the endpoint still exists.

Before relying on an API, check whether versioning, deprecation notices, changelogs, and migration guides exist. A stable-looking URL is not enough if the provider does not explain how compatibility is handled.

Webhooks and callbacks

Some integrations do not only ask for data. A webhook lets a provider notify another system when something happens, such as a new issue, completed build, payment event, or release.

Webhooks reverse part of the relationship. The caller becomes a receiver for event data, and the receiving system must validate the event, handle retries, and avoid assuming every delivery arrives once and in order.

This pattern is useful for automation, but it adds operational concerns: endpoint availability, secrets, duplicate events, payload validation, and failure logging.

Failure modes readers should recognize

Wrong endpoints, missing parameters, invalid credentials, insufficient permissions, changed response fields, version mismatches, expired tokens, and rate limits are common API problems.

Errors should be handled deliberately. A good caller checks status, reads error details, retries only when appropriate, and avoids treating every failure as a permanent problem.

Documentation quality matters because APIs are contracts for people as well as software. If the docs do not explain authentication, errors, versioning, and examples, integration risk rises.

Documentation signals to look for

Reliable API docs usually explain the object model, authentication, permission scopes, examples, error responses, pagination, rate limits, versioning, and change history.

Machine-readable descriptions such as OpenAPI can support generated clients and validation, but they do not replace prose. Developers still need to know which fields are required, which responses are partial, and which behavior is stable.

Examples should be current and minimal. A long sample that hides credentials, ignores errors, or omits pagination can create fragile integrations.

Library APIs and plugin APIs

Not every API uses a network. A library API lets code call functions, classes, or modules inside a dependency. A plugin API lets extensions interact with a host application.

These interfaces can be more stable than internal project code, because users build against them. They can also become harder to change because compatibility promises accumulate over time.

Open-source projects should be clear about what is public API and what is internal implementation. A function visible in source is not always a supported integration point.

API keys and secret handling

Credentials identify callers and authorize access. An API key, token, or OAuth grant can allow reads, writes, administrative actions, or access to private data depending on scope.

Secrets should not be committed to source repositories, embedded in public examples, or exposed in client-side code unless the provider explicitly designs them for that use. The safest pattern depends on the platform and threat model, so follow the provider's current security documentation.

For readers evaluating an integration, the key question is not only how to obtain credentials. It is where those credentials will live, who can rotate them, and what damage is possible if they leak.

Pagination, filtering, and partial results

APIs that return lists often split results across pages. A caller that reads only the first page may silently miss records.

Filtering and sorting rules also shape results. Some APIs filter on the server, some expect the client to filter returned data, and some use cursors that cannot be guessed from a page number.

Integration code should treat pagination as part of the contract. If the documentation does not explain list limits and continuation behavior, the workflow may fail only after the dataset grows.

Testing an integration safely

A small test request can confirm authentication, data shape, and error handling before a workflow depends on the API. The test should use limited permissions and non-destructive actions when possible.

Mock responses and contract tests can help open-source projects keep API clients stable. They are not substitutes for checking real provider behavior when authentication, rate limits, and network failures matter.

Good tests cover expected success, denied access, malformed input, not-found responses, rate limits, and changed data. Those cases reveal whether the integration fails clearly or corrupts downstream work.

Why APIs matter in open source

Open-source projects use APIs to integrate with services, expose plugin points, automate releases, test behavior, and let other software build on top of them.

Stable APIs can make a project easier to adopt because users know what integrations can depend on. Breaking changes can be reasonable, but they need release notes, versioning, migration guidance, and tests that reflect expected behavior.

Public APIs also create maintenance obligations. Once users rely on an interface, undocumented changes can break scripts, plugins, package workflows, or downstream projects.

Planning an API-dependent workflow

Start by naming the business or project action: retrieve release data, open an issue, upload an artifact, sync records, trigger a build, or fetch metadata.

Then map the API path. Identify which system owns the data, which credentials are required, which permissions are minimal, how errors return, how often calls are allowed, and what happens when the provider is unavailable.

For important workflows, design for failure from the beginning. Store enough logs to diagnose problems, retry only safe operations, and avoid hard-coding assumptions that the provider's documentation does not guarantee.

Questions before relying on an API

Check what the API exposes, which actions are allowed, how authentication works, what data formats are returned, how errors are represented, and whether versioning or deprecation policy is documented.

For important workflows, look for examples, schema files, test environments, changelogs, rate-limit behavior, and support for the programming language or tool you intend to use.

API examples are simplified here because real interfaces vary widely. The durable decision is to identify the contract, the system behind it, the access rules, and the failure behavior before building around it.