> 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/contract/contract-query.md).

# Contract Query

{% hint style="warning" %}
To use EverReal playground is required to provide the Bearer token, read more in Master Data page
{% endhint %}

To understand what is necessary and how to use graphql, in Master Data page we explain what is necessary to do

{% content-ref url="/pages/-MgjbMsY28KoSiFbx\_k6" %}
[Ideal CSV Structure](/how-to-guide/everreal-data-import-process/master-data.md)
{% endcontent-ref %}

```graphql
type Query {
  contracts(input: ContractsFilterListPaging): [Contract]
}

type ContractTerms {
  rent: Float
  deposit: Float
  heatingCosts: Float
  utilityCosts: Float
  totalMonthlyRent: Float
  contractEndDate: Date
  contractStartDate: Date
}

type ContractData {
  terms: ContractTerms
}

type Contract {
  id: String
  startDate: Date
  endDate: Date
  contractFlowType: CONTRACT_FLOW_TYPE
  status: String
  candidate: Candidate
  units: [Unit]
  tenants: [Tenant]
  tenantFullNames: String
  versions: [JSON]
  contractData: ContractData
  contractDataString: String
  createdAt: DateTime
  updatedAt: DateTime
}

input ListContractFilter {
  id: String
  companyId: String
  propertyGroupId: String
  propertyId: String
  status: String
  from: Date
  to: Date
}

input ContractsFilterListPaging {
  filter: ListContractFilter
  paging: GraphPaging
  sort: GraphSorting
}

enum CONTRACT_FLOW_TYPE {
  VIRTUAL
  OFFLINE
  DOWNLOAD_UPLOAD
  ELECTRONIC_SIGNATURE_V2
  ELECTRONIC_SIGNATURE_QES
}
```

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

```graphql
  query contracts($companyId: String, $propertyId: String, $status: String) {
    contracts(
      input: {
        paging: { take: 100, skip: 0 }
        filter: { companyId: $companyId, propertyId: $propertyId, status: $status }
      }
    ) {
      id
      contractDataString
        startDate
        endDate
        status
        unit {
            id
        }
        candidate {
            id
        }
        versions
        contractData {
            terms {
                rent
                deposit
                heatingCosts
                utilityCosts
                totalMonthlyRent
            }
        }
        contractDataString
        createdAt
    }
  }
```

{% endtab %}

{% tab title="CURL" %}

```bash
curl --location --request POST 'https://acme.everreal.co/api/reporting/graphql' \
--header 'Authorization: Bearer ....' \
--header 'Content-Type: application/json' \
--header 'Cookie: accept-language=en-US' \
--data-raw '{"query":"  query contracts($companyId: String, $propertyId: String, $status: String) {\n    contracts(\n      input: {\n        paging: { take: 100, skip: 0 }\n        filter: { companyId: $companyId, propertyId: $propertyId, status: $status }\n      }\n    ) {\n      id\n      contractDataString\n        startDate\n        endDate\n        status\n        unit {\n            id\n        }\n        candidate {\n            id\n        }\n        versions\n        contractData {\n            terms {\n                rent\n                deposit\n                heatingCosts\n                utilityCosts\n                totalMonthlyRent\n            }\n        }\n        contractDataString\n        createdAt\n    }\n  }","variables":{"status":"CONTRACT_TERMINATED"}}'
```

{% endtab %}

{% tab title="Javascript" %}

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

var graphql = JSON.stringify({
  query: "  query contracts($companyId: String, $propertyId: String, $status: String) {\n    contracts(\n      input: {\n        paging: { take: 100, skip: 0 }\n        filter: { companyId: $companyId, propertyId: $propertyId, status: $status }\n      }\n    ) {\n      id\n      contractDataString\n        startDate\n        endDate\n        status\n        unit {\n            id\n        }\n        candidate {\n            id\n        }\n        versions\n        contractData {\n            terms {\n                rent\n                deposit\n                heatingCosts\n                utilityCosts\n                totalMonthlyRent\n            }\n        }\n        contractDataString\n        createdAt\n    }\n  }",
  variables: {"status":"CONTRACT_TERMINATED"}
})
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: graphql,
  redirect: 'follow'
};

fetch("https://acme.everreal.co/api/reporting/graphql", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));// Some code
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://api-docs.everreal.co/endpoints/contract/contract-query.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
