---
lang: en
title: 'API docs: openapi-spec-builder.operationspecbuilder.withresponse'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withresponse.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/openapi-spec-builder](./openapi-spec-builder.md) &gt; [OperationSpecBuilder](./openapi-spec-builder.operationspecbuilder.md) &gt; [withResponse](./openapi-spec-builder.operationspecbuilder.withresponse.md)

## OperationSpecBuilder.withResponse() method

Describe a response for a given HTTP status code.

<b>Signature:</b>

```typescript
withResponse(status: number | 'default', responseSpec: ResponseObject): this;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  status | <code>number &#124; 'default'</code> | HTTP status code or string "default" |
|  responseSpec | <code>ResponseObject</code> | Specification of the response |

<b>Returns:</b>

`this`


