# Response Module

Import

```
import response from 'response';
```

Represents the current response object. setHeader, write and setStatusCode are only available\
in scripts originating from a custom Route script request.

### Methods

[setHeader(name, value)](https://docs.medable.com/reference#section-setheader-name-value-)\
[write(data)](https://docs.medable.com/reference#section-write-data-)\
[setStatusCode(code)](https://docs.medable.com/reference#section-setstatuscode-code-)\
[setCookie(name, value, options)](https://docs.medable.com/reference#section-setcookie-name-value-options-)\
[clearCookie(name, options)](https://docs.medable.com/reference#section-clearcookie-name-options-)

### setHeader(name, value)

**Arguments**

* `name` (String) header name
* `value` (String) header value

### write(data)

**Arguments**

* `data` (String) response data.

### setStatusCode(code)

**Arguments**

* `code` (Number) the http status code.

### setCookie(name, value, options)

**Arguments**

* `name` (String) cookie name
* `value` (Object) cookie value
* `options` (Object)
  * `signed` (Boolean:false)
  * `secure` (Boolean:false)
  * `maxAge` (Number:null)
  * `httpOnly` (Boolean:false)

### clearCookie(name, options)

**Arguments**

* `name` (String) cookie name
* `options` (Object)
  * `signed` (Boolean:false)
  * `secure` (Boolean:false)
  * `maxAge` (Number:null)
  * `httpOnly` (Boolean:false)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.medable.com/cortex-api/scripting/modules-1/response-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
