API Documentation

Base URL: https://api.restats.com

Authorization

Endpoint: /authorization/login

Method: POST

Retrieve a Bearer token tied to a username for accessing transactions. Expires after 15 minutes of inactivity.

Required Header

  • API-Key

Required Parameters

  • username - Username to be logged in
  • user_ip - IP address of the user

Example Request

POST /authorization/login
Header:
    API-Key: your_api_key
Body:
    {
        "username": "test_user",
        "user_ip": "127.0.0.1"
    }

Example Response

{
    "token": "BearerTokenHere"
}

Databases

Endpoint: /databases/MLSList

Method: GET

Retrieve database list that are available to be subscribed.

Optional Parameters

  • fields - Fields to include (comma-separated)
  • filter - Filter (use operators below), e.g., database_name eq TORONTO ON
  • order_column - Column to sort by
  • sort - 1 (ascending) or 2 (descending)

Example Request

GET /databases/MLSList?filter=database_name eq TORONTO%20ON&order_column=database_name&sort=2

Example Response


{
    "entires": 1,
    "result": [
        {
            "CITY": "Toronto",
            "DATABASE_NAME": "TORONTO ON",
            "LAST_UPDATED": "2024-11-01 00:00:00",
            "MLS_NAME": "Toronto Real Estate Board (TRREB)",
            "SHORT_CODE": "TRREB",
            "STATE": "ON"
        }
    ],
    "status": "OK"
}

            

Users

Endpoint: /users/CreateUser

Method: POST

Create a new user with the specified parameters.

Required Header

  • API-Key

Required Parameters

  • full_name - Full name of the user
  • office_name - Office name of the user
  • office_address - Office address of the user
  • city - City of the user
  • state - Two-letter state or province code
  • postal_code - Postal or ZIP code
  • country - Either USA or Canada
  • mls_name (array) - MLS name
  • mls_member_id (array) - MLS member ID
  • mls_office_id (array) - MLS office ID
  • database_name (array) - Database name(s) to be assigned to the user. Check /database/MLSList endpoint for available databases. Include database names for all mls_name included in the mls_name,mls_member_id and mls_office_id parameters. Only include databases that are related to MLS Names that are being sent.

Example Request

POST /users/CreateUser
Header:
    API-Key: your_api_key
Body:
    {
        "full_name": "John Doe",
        "office_name": "Example Realty",
        "office_address": "1234 Elm St",
        "city": "Waterloo",
        "state": "ON",
        "postal_code": "N2L 3G1",
        "country": "Canada",
        "mls_name": ["MLS1", "MLS2"],
        "mls_member_id": ["12345", "67890"],
        "mls_office_id": ["Office1", "Office2"],
        "database_name": ["TORONTO ON", "OTTAWA ON"]
    }

Example Response

{
    "message": "User was successfully created",
    "status": "OK",
    "username": "test_user"
}

Endpoint: /users/UpdateUserStatus

Method: PUT

Activate or deactivate a user.

Required Header

  • API-Key

Required Parameters

  • username - Username of the user

Optional Parameters

  • activate - Either 1 (activate) or 0 (deactivate); default is 0

Example Request

PUT /users/UpdateUserStatus
Header:
    API-Key: your_api_key
Body:
    {
        "username": "test_user",
        "activate": 0
    }

Example Response

{
    "message": "User was successfully deactivated",
    "status": "OK"
}

Endpoint: /users/AssignDatabases

Method: PUT

Assign additional databases to a user. New database assignment requests will be sent for approval.

Required Header

  • API-Key

Optional Parameter

  • disable_database - Send 1 if you need to disable databases that are sent in the database_name parameter. If you send this parameter 1, you do not need to send mls_name, mls_member_id, mls_office_id parameters. If this is sent 1, all databases in the database_name must be active and be assigned to the user.

Required Parameters

  • username - Username of the user
  • mls_name (array) - MLS name
  • mls_member_id (array) - MLS member ID
  • mls_office_id (array) - MLS office ID
  • database_name (array) - Database name(s) to be assigned to the user. Check /database/MLSList endpoint for available databases. Include database names for all mls_name included in the mls_name,mls_member_id and mls_office_id parameters. Only include databases that are related to MLS Names that are being sent.

Example Request

PUT /users/AssignDatabases
Header:
    API-Key: your_api_key
Body:
{
    "username": "test_user",
    "mls_name": ["MLS1", "MLS2"],
    "mls_member_id": ["12345", "67890"],
    "mls_office_id": ["Office1", "Office2"],
    "database_name": ["TORONTO ON", "OTTAWA ON"]
}

Example Response

{
    "message": "Databases are successfully assigned.",
    "status": "OK",
    "username": "test_user"
}

Endpoint: /users/SetOfficeCriteria

Method: POST

This API allows developers to add new criteria for offices associated with a specific username. By providing an office name and its associated wildcard-based criteria, the system stores these details to be used for matching or future operations.

Required Header

  • API-Key

Optional Parameter

  • office_address - To be provided in the offices array. If sent, office address criteria will be also added in addition to office name criteria. Only one office address can be sent unlike office name criteria.

Required Parameters

  • username - The username or identifier for whom the office criteria will be added.
  • offices (array) - A list of office objects, each containing office_name and criteria.
  • office_name - The name of the office to which the criteria will be added.
  • criteria (array) - A list of wildcard patterns for matching office names (case-insensitive).

Example Request

POST /users/SetOfficeCriteria
Header:
    API-Key: your_api_key
Body:
{
  "username": "john_doe",
  "offices": [
    {
      "office_name": "Re/Max",
      "office_address": "60 That St",
      "criteria": [
        "Re/Max*",
        "re/Max*",
        "Re/max*"
      ]
    },
    {
      "office_name": "Coldwell Banker",
      "office_address": "24 The Other St",
      "criteria": [
        "Coldwell*",
        "coldwell*",
        "COLDWELL*"
      ]
    }
  ]
}

Example Response

{
    "message": "Office criteria for the user is successfully added.",
    "status": "OK"
}

Endpoint: /users/UpdateOfficeCriteria

Method: PUT

This API allows developers to update existing criteria for offices associated with a specific username. By providing an office name and its associated wildcard-based criteria, the system updates these details to be used for matching or future operations. Office names must already be set up for the user to use this endpoint. To add new criteria, use /users/SetOfficeCriteria

Required Header

  • API-Key

Optional Parameter

  • office_address - To be provided in the offices array. If sent, office address criteria will be also updated in addition to office name criteria. Only one office address can be sent unlike office name criteria. Send it empty if you want to remove address criteria.

Required Parameters

  • username - The username or identifier for whom the office criteria will be updated.
  • offices (array) - A list of office objects, each containing office_name and criteria.
  • office_name - The name of the office to which the criteria will be updated.
  • office_id - The ID of the office to which the criteria will be updated. Office IDs can be retrieved from /users/GetOfficeCriteria
  • criteria (array) - A list of wildcard patterns for matching office names (case-insensitive).

Example Request

PUT /users/UpdateOfficeCriteria
Header:
    API-Key: your_api_key
Body:
{
  "username": "john_doe",
  "offices": [
    {
      "office_id": "1",
      "office_name": "Re/Max",
      "office_address": "60 That St",
      "criteria": [
        "Re/Max*",
        "re/Max*",
        "Re/max*"
      ]
    },
    {
      "office_id": "2",
      "office_name": "Coldwell Banker",
      "office_address": "24 The Other St",
      "criteria": [
        "Coldwell*",
        "coldwell*",
        "COLDWELL*"
      ]
    }
  ]
}

Example Response

{
    "message": "Office criteria for the user is successfully updated.",
    "status": "OK"
}

Endpoint: /users/GetOfficeCriteria

Method: GET

Retrieves the office criteria set by the user.

Required Header

  • API-Key

Required Parameters

  • username - Username of the user whose office criteria will be retrieved.

Example Request

GET /users/GetOfficeCriteria?username=test_user
Header:
    API-Key: your_api_key

Example Response

{
    "result": [
        {
            "office_id": "1",
            "criteria_list": [
                {
                    "criteria": "Re/Max*",
                    "criteria_id": "1"
                },
                {
                    "criteria": "re/Max*",
                    "criteria_id": "2"
                },
                {
                    "criteria": "Re/max*",
                    "criteria_id": "3"
                }
            ],
            "office_address": "24 The Other St.",
            "office_name": "Re/Max"
        }
    ],
    "status": "OK"
}

Endpoint: /users/DeleteOfficeCriteria

Method: DELETE

Delete an office criteria linked to a user.

Required Header

  • API-Key

Required Parameters

  • username - Username of the user
  • office_id - Office ID to be deleted. Office IDs can be retrieved from /users/GetOfficeCriteria

Example Request

DELETE /users/DeleteOfficeCriteria
Header:
    API-Key: your_api_key
Body:
    {
        "username": "test_user",
        "office_id": 58
    }

Example Response

{
    "message": "Office ID was successfully deleted.",
    "office_id": 58,
    "status": "OK"
}

Transactions

Endpoint: /transactions/Agents

Method: GET

Retrieve agents from a specified database, with optional filtering and sorting.

Required Header

  • Authorization - Bearer token

Required Parameters

  • database_name - Database name, e.g., "TORONTO ON"

Optional Parameters

  • rows - Number of rows to retrieve
  • skip - Number of rows to skip
  • fields - Fields to include (comma-separated)
  • filter - Filter (use operators below), e.g., MemberName eq John Doe
  • order_column - Column to sort by
  • sort - 1 (ascending) or 2 (descending)
  • historical_columns - 1 to include historical columns
  • property_data - 1 to include property data. 0 default.
  • property_filter - Property Filter (use operators below), e.g., DATEOFSALE eq 2025-01-01
  • agent_office_data - 1 to include agents' office data past 6 years. 0 default.
  • agent_office_filter - Agents' Office Filter (use operators below), e.g., Office eq Realty Executives Associates

Example Request

GET /transactions/Agents?database_name=TORONTO%20ON&rows=1&filter=MemberName eq John Doe&historical_columns=1&property_data=1&agent_office_data=1
Header:
    Authorization: Bearer BearerTokenHere

Example Response


{
    "entires": 50000,
    "result": [
        {
            "5_YR_CLOSED_PCT": "75.1234567",
            "5_YR_TOT_LISTINGS": "1500",
            "AGENT_OFFICES": [
                {
                    "OFFICENAME": "Office 1",
                    "YEAR": 2025
                },
                {
                    "OFFICENAME": "Office 2",
                    "YEAR": 2024
                },
                {
                    "OFFICENAME": "Office 1",
                    "YEAR": 2023
                },
                {
                    "OFFICENAME": "Office 3",
                    "YEAR": 2022
                }
            ],
            "AVGDOM_LAST12": "45.67",
            "AVG_CLOSE_PRICE_LAST12": "650000.00",
            "BUYER_SIDE_SALE_COUNT": "320",
            "CLOSED_SIDES_PERCENTILE": "1.23",
            "CLOSED_VOL_PERCENTILE": "1.56",
            "COMPANY": "Fictional Realty",
            "DIST_TO_OFFICE": "2.3",
            "FIRST_TRANS_DATE": "2015-06-15",
            "FIRST_TRANS_DATE_CURRENT_OFFICE": "2015-06-15",
            "FULL_NAME_ID": "FAKE NAME ID 1234567",
            "HOME_ADDRESS_AVAILABLE": "1",
            "LISTING_SIDE_SALE_COUNT": "112",
            "LISTSIDEPCT_LAST_12": "8.34",
            "MAXTRANSDATE": "2024-10-01",
            "MED_CLOSE_PRICE_LAST12": "610000.00",
            "MEMBERDIRECTPHONE": "555-123-4567",
            "MEMBEREMAIL": "fake.email@example.com",
            "MEMBERHOMEPHONE": "555-765-4321",
            "MEMBERMLSID": "FAKE-MLS-1234",
            "MEMBERMOBILEPHONE": "555-000-0000",
            "MEMBERNAME": "John Doe",
            "MEMBEROFFICEPHONE": "555-987-6543",
            "MEMBERTITLE": "Realtor",
            "MLS_TOTAL_CLOSED": "2400",
            "NUMBER_OF_COLISTSELL_PARTNERS_LAST_12": "50",
            "OFFICEADDRESS1": "123 Fake St",
            "OFFICECITY": "Faketown",
            "OFFICEKEY": "OFFICE-KEY-001",
            "OFFICENAME": "Fictional Brokerage",
            "OFFICEPOSTALCODE": "F1K 2B3",
            "PCT_CHANGE#": "-3.45",
            "PCT_CHANGE$": "-1500000.00",
            "PREV_12_UNITS_CALCULATED": "400",
            "PREV_12_VOLUME_CALCULATED": "180000000.00",
            "PRIMARY_COUNTY": "Fakeland",
            "PRODUCTION_ZIP_CODE": "F2K 3A1",
            "SIDES_LAST_12": "15",
            "SWITCH_COLOR": "Red",
            "TOTAL_CLOSED_VOLUME_LAST_12": "190000000.00",
            "TRANSACTIONS": [
                {
                    "AGENTROLE": "Listing Agent",
                    "DATEOFSALE": "2025-01-01",
                    "PROPERTYSUBTYPE": "Bungalow 1 Storey",
                    "PROPERTYTYPE": "Residential"
                },
                {
                    "AGENTROLE": "Buying Agent",
                    "DATEOFSALE": "2025-01-08",
                    "PROPERTYSUBTYPE": "2 Storey",
                    "PROPERTYTYPE": "Residential"
                }
            ],
            "TRANSACTIONS_LAST_12": "450",
            "UPDATE_DATE": "2024-10-20 12:34:56",
            "YRCHANGE#": "-50",
            "YRCHANGE$": "-5000000.00"
        }
    ],
    "status": "OK"
}

            

Endpoint: /transactions/InactiveAgents

Method: GET

Retrieve inactive agents (agents without any transactions) from a specified database, with optional filtering and sorting.

Required Header

  • Authorization - Bearer token

Required Parameters

  • database_name - Database name, e.g., "TORONTO ON"

Optional Parameters

  • rows - Number of rows to retrieve
  • skip - Number of rows to skip
  • fields - Fields to include (comma-separated)
  • filter - Filter (use operators below), e.g., MemberName eq John Doe
  • order_column - Column to sort by
  • sort - 1 (ascending) or 2 (descending)

Example Request

GET /transactions/InactiveAgents?database_name=TORONTO%20ON&rows=1&filter=MemberName eq John Doe
Header:
    Authorization: Bearer BearerTokenHere

Example Response


{
    "entires": 10000,
    "result": [
        {
            "EMAIL": "fake.email@example.com",
            "HOME_ADDRESS_AVAILABLE": "123 Fake St",
            "MEMBERDIRECTPHONE": "000-000-0000",
            "MEMBERID": "FAKE-MLS-1234",
            "MEMBERMOBILEPHONE": "000-000-0000",
            "MEMBERNAME": "John Doe",
            "MEMBERTITLE": Fake Realtor",
            "OFFICEADDRESS": "123 Fake St",
            "OFFICECITY": "Faketown",
            "OFFICEID": "OFFICE-ID-001",
            "OFFICENAME": "Fictional Brokerage",
            "OFFICEPOSTALCODE": "F1K 2B3",
            "OFFICESTATE": "BC"
        }
    ],
    "status": "OK"
}

            

Endpoint: /transactions/MigrationGraph

Method: GET

Retrieve migration counts by office using the user criteria. Office criteria must be set using /users/SetOfficeCriteria to use this function.

Required Header

  • Authorization - Bearer token

Required Parameters

  • database_name - Database name, e.g., "TORONTO ON"

Example Request

GET /transactions/MigrationGraph?database_name=TORONTO%20ON
Header:
    Authorization: Bearer BearerTokenHere

Example Response

{
    "Coldwell Banker": {
        "gained": 210,
        "lost": 241
    },
    "Re/Max": {
        "gained": 27,
        "lost": 50
    },
    "others": {
        "gained": 600,
        "lost": 596
    }
}

Filter Operators

Operators available for filtering data:

and operator can be used. Example: MemberName eq John Doe and transactions_last_12 ge 1000