Choosing an OpenAPI operationId: a unique identifier tools can use
In OpenAPI, operationId is a string that identifies one operation defined for a path and HTTP method. In OpenAPI Specification (OAS) 3.2.1, it must be unique among every operation described by the API and is case-sensitive. Tools and libraries may use it to identify operations, so include duplicate checks and rename review in your specification workflow.
In OpenAPI, operationId is a string that identifies one operation defined for a path and HTTP method. In OpenAPI Specification (OAS) 3.2.1, it must be unique among every operation described by the API and is case-sensitive. Tools and libraries may use it to identify operations, so include duplicate checks and rename review in your specification workflow.
What it identifies
Put operationId in an Operation Object. Different methods on the same path are distinct operations: GET /orders/{orderId} and DELETE /orders/{orderId} need separate identifiers.
paths:
/orders/{orderId}:
get:
operationId: getOrder
responses:
'200':
description: Returns an order
delete:
operationId: deleteOrder
responses:
'204':
description: Deletes an orderThe identifier is neither the URL nor the HTTP method. It is a name people and tools can use to refer to the operation. An OpenAPI Link Object can reference another operation by operationId or operationRef; those two fields are mutually exclusive.
Uniqueness and naming
OAS 3.2.1 requires each operationId to differ from all the others in the API. Comparison is case-sensitive, so do not treat getOrder, GetOrder, and getorder as the same value. The specification recommends common programming naming conventions.
Choose a consistent team style that describes the action, such as listOrders, getOrder, createOrder, or cancelOrder. Enforce uniqueness with an automated check instead of adding meaningless path fragments. Consider the entire API description, including versioned paths and servers.
Review renames
operationId is optional and not every client uses it. Code generators, SDKs, tests, OpenAPI links, and operational tools may rely on it. Changing a published identifier can rename generated methods or break references even when the URL and HTTP behavior stay the same. Review compatibility before changing it, and consider a migration period or API version when needed. This is team release guidance; OAS does not promise how every tool turns an identifier into code.
Specification review
Decide whether to publish operationId values and keep them unique across the API.
Check duplicates with case preserved.
Pick readable names that fit your team's language and code-generation conventions.
Search for SDK and link references before renaming.
For multi-document OpenAPI descriptions, inspect resolution scope and consider operationRef if names could collide.
Remember that operationId does not replace authentication, HTTP method, path, or request/response schemas.
The OpenAPI specification says tools may use operationId; it does not guarantee a generated function name or identical runtime behavior across tools. No linter, generator, or API was run for this article.
Sources
[OpenAPI Specification 3.2.1: Operation Object](https://spec.openapis.org/oas/v3.2.1.html#operation-object)
[OpenAPI Specification 3.2.1: Link Object](https://spec.openapis.org/oas/v3.2.1.html#link-object)