02.2 ° Service 02 / API · Design

API design.
From resource model to specification.

We take on the API design for your interfaces, model resources and endpoints, define data models, error models, and versioning, and describe the result as a specification in OpenAPI or RAML. For an energy utility, a lottery company, and a publishing company, we designed interfaces as a contract first, before implementation began.

Tagline Resources · Data model · Error model · Versioning · OpenAPI
° dl / service-02.2
° Fundamentals · API design

What API design is and what it defines.

API design means drafting an application programming interface before it is implemented. This section clarifies the term, shows which decisions belong to the design, positions OpenAPI as the format for the result, and describes what a careful design achieves in projects.

API design answers the question of what an interface looks like from the outside. The design determines which resources it offers, which operations are used to call it, which data it accepts and returns, and how it responds to errors. The result is a specification, a contract between those who provide the API and those who use it. Why this contract is created before the code is explained in the section “What is API First?” on the API Services page. This page is about the work on the design itself.

What an API design defines

Designing a REST API involves several decisions that have to fit together. The resource model determines which business objects the API offers and under which paths. For every operation, it is settled which HTTP method it uses and which status codes it responds with. Data models describe requests and responses, and an error model describes the response when something goes wrong. Added to this are the access mechanism and the rules under which the interface may change later.

OpenAPI, the design as a machine-readable specification

The OpenAPI Specification defines a standard, programming-language-agnostic description for HTTP APIs. An OpenAPI document is written in YAML or JSON and contains paths, operations, parameters, data schemas, and security mechanisms. Recurring building blocks are defined once in the components section and referenced from there. Because the document is machine-readable, tools can generate documentation and code from it and derive tests. In our projects, we have described interfaces in RAML and in OpenAPI.

API First and why a careful design matters

An agreed contract allows several parties to work at the same time. In the integration of SugarCRM and SAP R/3 for a publishing company, the API design was our responsibility. RAML fragments and business types defined what a customer or an order looks like across all interfaces, and the client, the service provider, and dataliquid worked against the same contracts. For the tariff comparison calculator of an energy utility, every interface was first designed as a RAML specification. An agency built the user interface of the calculator, and it obtains the finished comparison through a REST API.


° Platform · Building blocks

What API design involves

Six building blocks of a design, from the resource model to the reviewed specification.

°Specification
OpenAPI
The interface as a machine-readable contract with paths, operations, parameters, data models, and security mechanisms in one document.
OpenAPI · RAML · JSON Schema · YAML
°Resources

Modeling resources and endpoints

We derive the resources from the business processes and define which endpoints, HTTP methods, and status codes belong to them.

°Data model

Business objects as shared types

A customer, an order, or a tariff is described once as a data type and referenced in every operation. This way, an object looks the same in all interfaces.

°Error model
RFC 9457
Problem Details for HTTP APIs is a uniform error format with type, title, status, and detail that every endpoint uses in the same way.
°Versioning

Making change predictable

The design defines what counts as a compatible change, how a new version is identified, and how an older version is retired with advance notice.

°Verification
Review
Before implementation starts, we review the specification with those involved against the requirements, against the agreed rules, and on the basis of example responses.
° Design decisions · ADR

How we record decisions in API design.

Versioning, error format, and naming apply to all interfaces in a landscape. We record such decisions as an Architecture Decision Record, with context, decision, consequences, and the alternatives considered. The example shows the structure using a typical decision on the error format.

ADR · API design
Uniform error format based on RFC 9457
Accepted Example

Several teams design APIs for the same system landscape. So far, each interface reports errors in its own structure, and applications that call several APIs parse each structure separately. A shared error model is to apply to new interfaces.

All new APIs return errors as Problem Details according to RFC 9457 with the media type application/problem+json. The fields type, title, status, detail, and instance are used as the RFC defines them.

Additional domain-specific information, such as the list of invalid input fields, is added as extension fields and described once as a shared schema.

  • The error schema is available as a reusable building block and is referenced in every specification.
  • The style guide lists the problem types and the associated status codes.
  • Existing APIs keep their format and switch with their next major version.

A custom error format can be tailored exactly to the domain but has to be described and maintained in-house. Not chosen because the RFC already defines the required fields.

HTTP status codes only are sufficient for simple interfaces. Not chosen because applications need machine-readable details for input errors.

° Starting points

API design in practice, with six typical starting points.

Six situations in which a design calls for decisions, and how we approach them. The technical statements are based on the published standards.

01

The existing system dictates the structure  · Resource model

The data resides in systems whose structures follow the company's internal view. An app or a portal needs part of it, and in a different form.

Our approach. We model resources from the perspective of the applications that use the API. For a lottery company, the APIs enrich, filter, and transform the backend data until apps and the online shop can process it directly.

02

Naming and methods are still open  · Conventions

Without a shared rule, several teams each answer questions such as singular or plural in the path and PUT or PATCH for a change on their own.

Our approach. A style guide settles the naming once. For the methods, HTTP semantics apply, under which PUT creates a resource or fully replaces its state and is idempotent, while PATCH transfers a partial change. Our article on status codes shows which response fits which case.

03

Errors need a dependable structure  · Error model

Applications that call an API process errors programmatically. For that, they need a structure alongside the status code that is the same at every endpoint.

Our approach. We describe the error model once as a schema and use it in every operation. RFC 9457 defines Problem Details for this purpose, with the media type application/problem+json.

04

The API changes during ongoing operation  · Versioning

New requirements meet applications that rely on the existing behavior.

Our approach. The design distinguishes compatible from incompatible changes and defines how a new major version is identified. OpenAPI marks deprecated operations with deprecated. The HTTP header fields Deprecation (RFC 9745) and Sunset (RFC 8594) tell callers that a resource is deprecated and from when it is expected to stop responding.

05

The access mechanism belongs in the contract  · Security

The operations are settled, and what remains open is who may call them with which permissions.

Our approach. OpenAPI provides security schemes for this, including for OAuth 2.0 and OpenID Connect, which can be assigned per operation. The contract then states which call requires which permission. We secured the APIs of a lottery company with OAuth 2.

06

Several parties develop at the same time  · Collaboration

Business teams, your own team, and service providers work on the same interface and need to work from the same version.

Our approach. The agreed specification is the shared point of reference. At a publishing company, three parties worked against the same contracts. Through Postman and the API Console, everyone involved could try out the interfaces and find them documented.

° In context · OpenAPI and related terms
As of 2026  ·  3 min read

OpenAPI, Swagger, AsyncAPI, and GraphQL, the terms of API design in context.

Around API design, you come across terms that sit close together and mean different things. This section puts the most common ones in context, from OpenAPI and Swagger through OpenAPI and AsyncAPI to REST and GraphQL. It also covers what a tool has to deliver during design and how the specification turns into documentation and tests.

01

OpenAPI or Swagger?

Both names belong to the same history. The OpenAPI Specification is based on the Swagger Specification, which SmartBear Software contributed to the OpenAPI Initiative. The initiative maintains the standard under open governance under the umbrella of the Linux Foundation. Today, OpenAPI refers to the specification, and Swagger refers to a set of tools that have grown up around this specification.

OpenAPI and REST are equated just as often. REST is an architectural style, and OpenAPI is a format that describes HTTP APIs. For data models, OpenAPI relies on JSON Schema. In the current version, the Schema Object is by default a superset of JSON Schema Draft 2020-12. In our projects, we have described interfaces in RAML and in OpenAPI, for example in the integration of business credit reports into SAP, whose interfaces are specified and documented with OpenAPI.

02

OpenAPI and AsyncAPI, REST and GraphQL

OpenAPI describes HTTP APIs in which a client sends a request and the server responds. AsyncAPI describes message-driven interfaces in a machine-readable format and is protocol-agnostic. Channels, operations, and messages take the place of paths and responses. Where a landscape contains both, the two formats stand side by side.

GraphQL is a query language with its own type system. The client specifies which fields it needs and receives exactly those. A REST API returns, for each resource, the representation that the design defines. Which style fits depends on who uses the interface and how much the data needs of these consumers differ. The project examples on this page are REST APIs. The table on the API Services page shows which format covers which use case.

  • °
    OpenAPI   HTTP APIs with paths, operations, schemas, and security mechanisms.
  • °
    AsyncAPI   Message-driven interfaces with channels, operations, and messages.
03

Tools, documentation, and tests from the specification

With tools for API design, what counts is what they deliver during design. They should edit the specification and validate it against the format, check agreed rules on naming and structure, serve example responses before the implementation exists, and generate readable documentation. The specification lives as a file in version control and can go through the same review as code. The API Services page explains how API First and code first differ.

Documentation and tests emerge from the contract. At a publishing company, Karate integration tests safeguarded every integration flow, and the API Console let everyone involved try out the interfaces. The API Portal page describes how documentation and catalog reach the consumers of your APIs. For architectures based on API-led connectivity on the Anypoint Platform, read API Design & Architecture. Looking ahead, the Model Context Protocol also describes tools for AI agents with a name, a description, and a JSON Schema of the inputs, so a clearly described API does the groundwork for it.

° Formats & tools

What we design with.

The formats in which we describe interfaces, the standards a design relies on, and tools for design and verification. RAML, OpenAPI, OAuth 2.0, Postman, API Console, Karate, and GitLab, among others, come from our projects. The remaining entries put the surrounding field in context.

01

Specification

OpenAPIRAMLJSON SchemaAsyncAPIGraphQL schemaYAML & JSON
02

Standards in design

HTTP semantics · RFC 9110Problem Details · RFC 9457OAuth 2.0OpenID ConnectSemantic VersioningDeprecation and Sunset headers
03

Design & verification

PostmanAPI ConsoleKarateSwagger EditorSwagger UIGitLab
° Approach

From business process to agreed specification

API design in five steps. The result is a contract that everyone involved develops and tests against.

01

Requirements

Clarify processes, API consumers, and the systems involved with business teams and development.

02

Resource model

Derive resources, endpoints, and operations from the business processes.

03

Building blocks

Describe the data model, error model, and access mechanism as reusable parts.

04

Specification

Work out the contract in OpenAPI or RAML, with examples for each operation.

05

Review and approval

Review the specification with those involved and approve it as the basis for implementation and tests.

° From our projects
3 parties
worked against the same agreed
contracts at a publishing company
1 layer
of REST APIs for the apps and online shop
of a lottery company
RAML-first
every interface in the tariff comparison
of an energy utility
OpenAPI
as the contract between a credit reporting service
and the SAP system of an industrial company
° Frequently asked questions about API design and OpenAPI

Questions and answers on API design.

01 What is API design?

API design means drafting an application programming interface before it is implemented. It defines the resources and endpoints, the HTTP methods and status codes, the data models for requests and responses, the error model, the access mechanism, and the rules for later changes. The result is a specification, for example in OpenAPI, that serves as a contract between the provider and the consumers of the API.

02 How do you design a REST API?

It starts with the business processes and the applications that are meant to use the API. The resources and their paths follow from these. For each operation, the HTTP method is chosen, such as GET for reading or PUT for a full replacement, along with the status codes for success and failure. Data models, the error model, and the access mechanism come next. The design is written down as a specification and reviewed with those involved before implementation begins. The fundamentals are covered in our articles on the HTTP protocol and on status codes.

03 What are best practices in API design?

A design rests on four API design principles. The specification is created before the implementation and aligned with everyone involved. Business objects are described once and reused in every API, as are recurring API design patterns such as pagination. Naming, error format, and versioning are governed uniformly in a style guide with API design guidelines, and for a RESTful API so is the use of HTTP methods and status codes. Every operation carries examples so that the consumers of the API can develop against the contract early. At an energy utility whose solution architecture we are responsible for, design reviews check every integration flow against the architecture guidelines.

04 OpenAPI or Swagger, what is the difference?

OpenAPI is the name of the specification, and Swagger is the name of tools built around this specification. The OpenAPI Specification is based on the Swagger Specification, which SmartBear Software contributed to the OpenAPI Initiative under the umbrella of the Linux Foundation. In everyday usage, both names are still often used interchangeably. What is meant then is the description of an HTTP API in this format.

05 Which tools do you need for API design?

What matters is what a tool delivers during design. That includes editing the specification and validating it against the format, checking agreed rules, providing example responses, and generating readable documentation. For OpenAPI, there are editors, validation tools, and generators for this, both commercial and open source. In our projects, we have worked with Postman, the API Console, and Karate, among others. Which tools fit your environment is something we clarify together with you during design.

06 Who takes on the API design?

dataliquid takes on API design as a service in its own right or as the first step of an API development project. The design ranges from the resource model through the data model, error model, and versioning to the agreed specification in OpenAPI or RAML. We examine existing specifications in a review. We have specified interfaces for an energy utility, a lottery company, a publishing company, and an industrial company. The API Services page shows how implementation follows. For architectures on the Anypoint Platform, read API Design & Architecture.

API design

Let's talk about your API design.

In the initial call with an engineer, we discuss your interface, the systems involved, and a sensible next step.

01 Submit a request
* Required field
Topic
Encrypted transmission · TLS 1.3