# Listing Mutation

{% hint style="info" %}
Mutations are responsible to update a specific operations like activating, deactivating listing or archiving or unarchiving listing.
{% endhint %}

```typescript
type Mutation {
  updateListing(listing: ListingInput): Listing
}
```

Here are details on the capabilities of different mutations

* `updateListing`: Is used to perform update on an listing with the help of a listing Id, this will help is performing some basic operations listed below

### Schema Definition

```graphql
input ListingInput {
  id: String!
  action: LISTING_ACTIONS!
}

enum LISTING_ACTIONS {
  ACTIVATE_LISTING
  DEACTIVATE_LISTING
  ARCHIVE_LISTING
  UNARCHIVE_LISTING
}
```

Below we are providing a full example how to  update listing, all this information is not required, only the ones that was using **!** notation previously.

{% tabs %}
{% tab title="graphQL" %}

```graphql

mutation {
  updateListing(
    listing: {
      id: "42b751a6-3eb6-4e48-a0d1-8e9959151672"
      action: ACTIVATE_LISTING
    }
  ) {
    id
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl --location --request POST 'http://<subdomain>.everreal.co/api/reporting/graphql' \
--header 'Authorization: Bearer ....' \
--header 'Content-Type: application/json' \
--header 'Cookie: accept-language=de-DE' \
--data-raw '{"query":"\r\nmutation {\r\n  updateListing(\r\n    listing: {\r\n      id: \"42b751a6-3eb6-4e48-a0d1-8e9959151672\"\r\n      action: ACTIVATE_LISTING\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}","variables":{}}'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer ....");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "accept-language=de-DE");

var graphql = JSON.stringify({
  query: "\r\nmutation {\r\n  updateListing(\r\n    listing: {\r\n      id: \"42b751a6-3eb6-4e48-a0d1-8e9959151670\"\r\n      action: ACTIVATE_LISTING\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}",
  variables: {}
})
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: graphql,
  redirect: 'follow'
};

fetch("http://<subdomain>.everreal.co/api/reporting/graphql", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));j
```

{% endtab %}
{% endtabs %}


---

# 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://api-docs.everreal.co/endpoints/listing/listing-mutation.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.
