# The Operation Object in OpenAPI
Source: https://speakeasy.com/openapi/operations

import { Table } from "@/mdx/components";



An operation object describes a single API operation within a path, including all its possible inputs and outputs and the configuration required to make a successful request.

Each operation object corresponds to an HTTP verb, such as `get`, `post`, or `delete`.

Example:

```yaml
paths:
  /drinks:
    get:
      # The Operation Object
      operationId: listDrinks
      summary: Get a list of drinks.
      description: Get a list of drinks, if authenticated this will include stock levels and product codes otherwise it will only include public information.
      security:
        - {}
      tags:
        - drinks
      parameters:
        - name: type
          in: query
          description: The type of drink to filter by. If not provided all drinks will be returned.
          required: false
          schema:
            $ref: "#/components/schemas/DrinkType"
      responses:
        "200":
          description: A list of drinks.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Drink"
```

<Table
  title="Operation Object Fields"
  data={[
    {
      field: "`operationId`",
      type: "String",
      required: "",
      description: "A unique identifier for the operation, this **_must_** be unique within the document, and is **_case sensitive_**. It is **_recommended_** to always define an `operationId`, but is not required."
    },
    {
      field: "`deprecated`",
      type: "Boolean",
      required: "",
      description: "Whether the operation is deprecated or not. Defaults to `false`."
    },
    {
      field: "`summary`",
      type: "String",
      required: "",
      description: "A short summary of what the operation does. This may contain [CommonMark syntax](https://spec.commonmark.org/) to provide a rich description."
    },
    {
      field: "`description`",
      type: "String",
      required: "",
      description: "A detailed description of the operation, what it does, and how to use it. This may contain [CommonMark syntax](https://spec.commonmark.org/) to provide a rich description."
    },
    {
      field: "`servers`",
      type: "[Servers](/openapi/servers)",
      required: "",
      description: "A list of [Server Objects](/openapi/servers) that override the servers defined at the document and path levels and apply to this operation."
    },
    {
      field: "`security`",
      type: "[Security](/openapi/security)",
      required: "",
      description: "A list of [Security Requirement Objects](/openapi/security#security-requirement-object) that override the security requirements defined at the document and path levels and apply to this operation."
    },
    {
      field: "`x-*`",
      type: "[Extensions](/openapi/extensions)",
      required: "",
      description: "Any number of extension fields can be added to the operation object that can be used by tooling and vendors."
    },
    {
      field: "`parameters`",
      type: "[Parameters](/openapi/paths/parameters)",
      required: "",
      description: "A list of [Parameter Objects](/openapi/paths/parameters#parameter-object) that are available to this operation. The parameters defined here merge with any defined at the path level, overriding any duplicates."
    },
    {
      field: "`requestBody`",
      type: "[Request Body Object](/openapi/paths/operations/requests)",
      required: "",
      description: "The request body for this operation where the [HTTP method supports a request body](https://httpwg.org/specs/rfc7231.html). Otherwise, this field is ignored."
    },
    {
      field: "`responses`",
      type: "[Responses](/openapi/paths/operations/responses)",
      required: "✅",
      description: "A map of [Response Objects](/openapi/paths/operations/responses#response-object) that define the possible responses from executing this operation."
    },
    {
      field: "`callbacks`",
      type: "[Callbacks](/openapi/paths/operations/callbacks)",
      required: "",
      description: "A map of [Callback Objects](/openapi/paths/operations/callbacks#callback-object) that define possible callbacks that may be executed as a result of this operation."
    }
  ]}
  columns={[
    {
      key: "field",
      header: "Field"
    },
    {
      key: "type",
      header: "Type"
    },
    {
      key: "required",
      header: "Required"
    },
    {
      key: "description",
      header: "Description"
    }
  ]}
/>

The above order of fields is recommended for defining the fields in the document to help set the stage for the operation and provide a clear understanding of what it does.