> For the complete documentation index, see [llms.txt](https://api-docs.everreal.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.everreal.co/endpoints/listing.md).

# Listing

A listing is the advert for a property that is for sale or for rent. It stands for the marketing agreement between a principal and an agent.

{% hint style="warning" %}
The playground needs your [Bearer token](https://api-docs.everreal.co/key-concepts.md#access-token). See [Authentication](https://api-docs.everreal.co/master.md).
{% endhint %}

### Important information

#### Amenities

Parking can have 2 values:

* `null` if the [listing](https://api-docs.everreal.co/key-concepts.md#listing) does not have amenity "Has Parking" checked
* `{type, quantity}` if the listing has amenity "Has Parking" checked

**Pictures and documents**

There are 4 important file properties: `{coverPicture,pictures,documents,floorplans}`.

The full address of a picture is `baseUrl + "/" + picture.resourcePath`. The base URL is `https://resources.everreal.co`.

### Pages in this section

| Page                                                                                                                    | What it covers                                                                                                                                                                   |
| ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Listing Query](https://api-docs.everreal.co/endpoints/listing/listing-query.md)                                        | `listings`, `listingCounts`, `avgListingActivity`, `listingFunnelActivity` and the filters                                                                                       |
| [Listing Mutation](https://api-docs.everreal.co/endpoints/listing/listing-mutation.md)                                  | `createListing`, `patchListing`, and a list of all listing mutations                                                                                                             |
| [Listing: status changes](https://api-docs.everreal.co/endpoints/listing/listing-status-changes.md)                     | `updateListing`: activate, deactivate, archive                                                                                                                                   |
| [Listing: pictures and files](https://api-docs.everreal.co/endpoints/listing/listing-pictures-and-files.md)             | Import from links, the upload folder, set and add pictures and floor plans                                                                                                       |
| [Listing: settings](https://api-docs.everreal.co/endpoints/listing/listing-settings.md)                                 | `setListingSettings`                                                                                                                                                             |
| [Listing: requirements](https://api-docs.everreal.co/endpoints/listing/listing-requirements.md)                         | `setListingRequirements`                                                                                                                                                         |
| [Listing: custom fields](https://api-docs.everreal.co/endpoints/listing/listing-custom-fields.md)                       | `setListingCustomFields`                                                                                                                                                         |
| [Listing: energy certificate](https://api-docs.everreal.co/endpoints/listing/listing-energy-certificate.md)             | `setListingEnergyCertificate`                                                                                                                                                    |
| [Listing: unit and property fields](https://api-docs.everreal.co/endpoints/listing/listing-unit-and-property-fields.md) | `patchListingUnit`, `patchListingProperty`                                                                                                                                       |
| [Listing: reference reads](https://api-docs.everreal.co/endpoints/listing/listing-reference-reads.md)                   | [Users](https://api-docs.everreal.co/key-concepts.md#user-and-member), templates, [custom fields](https://api-docs.everreal.co/key-concepts.md#custom-field) and portal accounts |

### Query

The [Endpoints](https://api-docs.everreal.co/endpoints.md) page explains how to call the GraphQL endpoint.

```graphql
type Query {
  listings(input: ListingFilterListPaging): [Listing]
  avgListingActivity(input: AvgActivityFilter): AvgListingActivity
  listingCounts(input: ListingCountsFilter): ListingCounts
  listingFunnelActivity(listingId: ID!): ListingFunnel
}

type AvgListingActivity {
  activeListings: Int
}

type ListingCounts {
  listingsMissingViewings: Int
  listingsMissingContracts: Int
  activeAndPublished: Int
  olderThan30Days: Int
  listingsInContracting: Int
  listingsContractingCompleted: Int
  listingsMoveinCompleted: Int
}

type ListingFunnel {
  candidates: Int!
  viewings: Int!
  applicants: Int!
  contracts: Int!
}

type Listing {
  id: String
  title: String
  type: String
  isArchived: Boolean
  isActive: Boolean
  companyId: String
  listingResponsible: User
  contractDetails: ListingContractDetails
  coverPicture: IFile
  pictures: [IFile]
  documents: [IFile]
  floorplans: [IFile]
  company: Company
  status: LISTING_STATUS
  amenities: ListingAmenities
  listingInformation: ListingInformation
  availableFrom: Date
  propertyId: String
  property: Property
  unitId: String
  unit: Unit
  descriptions: ListingDescription
  createdAt: DateTime
  updatedAt: DateTime
}

type ListingAmenities {
  amenitiesIncluded: [AMENITIES_INCLUDED] # See this type under units page
  parking: UnitParkingType # See this type under units page
  qualityOfAmenities: String
  condition: String
  lastRenovationYear: Int
  heatingType: String
  mainEnergySource: String
  energyPerformanceCertificateAvailability: ENERGY_PERFORMANCE_CERTIFICATE_AVAILABILITY
  energyCertificateCreationDate: ENERGY_CERTIFICATE_CREATION_DATE
  buildingEnergyRatingType: BUILDING_ENERGY_RATING_TYPE
  thermalCharacteristic: Float
  energyConsumptionContainsWarmWater: Boolean
  energyEfficiencyClass: ENERGY_EFFICIENCY_CLASS
}

type ListingDescription {
  object: String
  amenities: String
  location: String
  other: String
}

type ListingContractDetails {
  currency: String
  rent: Float
  totalMonthlyRent: Float
  parkingRent: Float
  deposit: Float
  heatingCostsIncluded: Boolean
  utilityCosts: Float
  heatingCosts: Float
  petsAllowed: String
  displayAmount: Float
  hasCommission: Boolean
  commission: String
  commissionNote: String
  commissionType: String
}

enum UNIT_TYPE {
  APARTMENT
  HOUSE
  PARKING
  OFFICE
  STORE
  GASTRONOMY
  INDUSTRY
  SPECIAL_PURPOSE
  LAN
}

enum LISTING_TYPE {
  RENT_APARTMENT
  SELL_APARTMENT
  RENT_SHORT_TERM_APARTMENT
  RENT_HOUSE
  SELL_HOUSE
  RENT_PARKING
  SELL_PARKING
  RENT_RESIDENTIAL_LAND
  SELL_RESIDENTIAL_LAND
  RENT_OFFICE
  SELL_OFFICE
  RENT_STORE
  SELL_STORE
  RENT_GASTRONOMY
  SELL_GASTRONOMY
  RENT_INDUSTRY
  SELL_INDUSTRY
  RENT_SPECIAL_PURPOSE
  SELL_SPECIAL_PURPOSE
  RENT_COMMERCIAL_LAND
  SELL_COMMERCIAL_LAND
}

enum LISTING_STATUS {
  OPEN_FOR_CANDIDATES
  OPEN_FOR_APPLICANTS
  CONTRACTING_STARTED
  CONTRACTING_COMPLETED
  MOVE_IN_COMPLETED
  IS_INACTIVE
  IS_ARCHIVED
}

input ListingFilter {
  from: Date
  to: Date
  companyId: String
  propertyGroupId: String
  propertyId: String
  ownerId: String
  listingId: String
  external: Boolean
  fullSearch: String
  isArchived: Boolean
  isActive: Boolean
  internalAdvertiseId: String
  availableFrom: Date
  externalPropertyId: String
  scoringTemplateId: String
  propertyCity: String
  propertyName: String
  propertyStreet: String
  listingType: LISTING_TYPE
  status: LISTING_STATUS
  responsibleFullName: String
  unitName: String
  unitId: String
  externalUnitId: String
  userId: String
  unitType: UNIT_TYPE
  priceMin: Float
  priceMax: Float
  roomsMin: Int
  roomsMax: Int
  surfaceMin: Int
  surfaceMax: Int
  livingSurfaceMin: Int
  livingSurfaceMax: Int
  heightMax: Int
  heightMin: Int
  listingResponsibleUserId: String
  projectId: String
}

input ListingFilterListPaging {
  filter: ListingFilter
  paging: GraphPaging
  sort: GraphSorting
}

input ListingCountsFilter {
  userId: String
  companyId: String
  propertyGroupId: String
  propertyId: String
  ownerId: String
}

```

The filter rules ([partner](https://api-docs.everreal.co/key-concepts.md#partner) limit, [uuid](https://api-docs.everreal.co/key-concepts.md#uuid) ids, the `external` [owner view](https://api-docs.everreal.co/key-concepts.md#unit-share-and-owner-view)) are on [Listing Query](https://api-docs.everreal.co/endpoints/listing/listing-query.md).

Usage:

{% tabs %}
{% tab title="GraphQL" %}
**Query:**

```graphql
  query listingsQuery(
    $from: Date
    $to: Date
    $companyId: String
    $propertyId: String
    $propertyGroupId: String
    $ownerId: String
    $listingId: String
    $isArchived: Boolean
    $isActive: Boolean
    $fullSearch: String
  ) {
    listings(
      input: {
        paging: { take: 100, skip: 0 }
        filter: {
          from: $from
          to: $to
          companyId: $companyId
          propertyGroupId: $propertyGroupId
          propertyId: $propertyId
          ownerId: $ownerId
          listingId: $listingId
          isArchived: $isArchived
          isActive: $isActive
          fullSearch: $fullSearch
        }
      }
    ) {
      id
      title
      type
      isArchived
      isActive
      companyId
      amenities{
        amenitiesIncluded
        qualityOfAmenities
        parking {type quantity}
        energyPerformanceCertificateAvailability
        energyCertificateCreationDate
        buildingEnergyRatingType
        thermalCharacteristic
        energyConsumptionContainsWarmWater
        energyEfficiencyClass
      }
      coverPicture {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      pictures  {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      documents   {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      floorplans  {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      property {
        objectId
        name
        category
        subtype
        type
        ownershipType
        fullAddress
      }
      unit {
        id
        objectId
        name
        category
        type
        subtype
        leasingStatusEnum
        leasingStatusesEnum
        statusesEnum
        floorNumber
        surface
        livingSurface
        netFloorSurface
        hasMainStorage
      }
      contractDetails {
        currency
        rent
        totalMonthlyRent
        parkingRent
        deposit
        heatingCostsIncluded
        utilityCosts
        heatingCosts
        petsAllowed
        displayAmount
        hasCommission
        commission
        commissionNote
        commissionType
      }
    }
  }
```

**Variables:**

You can use any variable in `ListingFilter`.

```
{
  "listingId": "fce90f3a-b8e4-4bc6-b6c0-2539acef5cdc",
  "propertyId": "e7cde0a1-9708-4fce-b36e-d8b8bcaa695f",
  "isActive": true,
  "isArchived": false,
  "fullSearch": "Hermannstrasse"
}
```

The answer looks like this:

![](https://1594188794-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgL3i0-8YP9K1HyrHy8%2Fuploads%2FuVGik3Cbkms4zhuqOGcr%2FScreenshot%202022-06-20%20at%205.04.30%20PM.png?alt=media\&token=a4bd64fd-5143-4a9b-acba-8162ea5c7277)
{% endtab %}

{% tab title="CURL" %}

```shell
curl --location --request POST 'https://{subdomain}.everreal.co/api/reporting/graphql' \
--header 'authorization: Bearer <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Cookie: accept-language=en-US' \
--data-raw '{"query":"query listingsQuery($listingId: String, $isActive: Boolean, $fullSearch: String) { listings(input: { paging: { take: 100, skip: 0 }, filter: { listingId: $listingId, isActive: $isActive, fullSearch: $fullSearch } }) { id title type isArchived isActive companyId pictures { name resourceId resourcePath } floorplans { name resourceId resourcePath } contractDetails { currency rent totalMonthlyRent } } }","variables":{"listingId":"fce90f3a-b8e4-4bc6-b6c0-2539acef5cdc","isActive":true,"fullSearch":"Hermannstrasse"}}'
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const query = `
  query listingsQuery($listingId: String, $isActive: Boolean, $fullSearch: String) {
    listings(input: { paging: { take: 100, skip: 0 }, filter: { listingId: $listingId, isActive: $isActive, fullSearch: $fullSearch } }) {
      id
      title
      type
      isArchived
      isActive
      companyId
      pictures { name resourceId resourcePath }
      floorplans { name resourceId resourcePath }
      contractDetails { currency rent totalMonthlyRent }
    }
  }
`;

fetch('https://{subdomain}.everreal.co/api/reporting/graphql', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <ACCESS_TOKEN>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    query,
    variables: { listingId: 'fce90f3a-b8e4-4bc6-b6c0-2539acef5cdc', isActive: true, fullSearch: 'Hermannstrasse' },
  }),
})
  .then((response) => response.json())
  .then((result) => console.log(result))
  .catch((error) => console.log('error', error));
```

{% endtab %}
{% endtabs %}

### Mutation

{% hint style="info" %}
The listing mutations create a listing, change its fields, its pictures, its settings and its status. The full list is on [Listing Mutation](https://api-docs.everreal.co/endpoints/listing/listing-mutation.md).
{% endhint %}

```graphql
type Mutation {
  createListing(input: CreateListingInput!, companyId: ID): ListingAdminResult!
  patchListing(input: PatchListingInput!, companyId: ID): ListingAdminResult!
  updateListing(listing: ListingInput, companyId: ID): Listing
}
```

* `createListing` and `patchListing`: see [Listing Mutation](https://api-docs.everreal.co/endpoints/listing/listing-mutation.md). They need the [scope](https://api-docs.everreal.co/key-concepts.md#scope) `company_admin`.
* `updateListing`: activate, deactivate or archive a listing. See [Listing: status changes](https://api-docs.everreal.co/endpoints/listing/listing-status-changes.md).

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