Document management

Endpoints to upload documents to EverReal and link them to different objects

Introduction

Important notes

  • Documents represents files that are uploaded and have metadata that link them to different objects in EverReal. Documents can be linked to tenants, units, properties, property groups. If you want to upload files and link them to listings later, please read the Simple file upload section.

  • Documents need to have a resourcePath that is a "virtual folder" in EverReal. Recommended resource paths

    • Tenant documents: tenants/$tenantId

    • Property documents: properties/$propertyId

    • Unit documents: units/$unitId

    • property group documents: properties/$propertyId - documents attached to a property group should also be attached to a property as well

Endpoints

Upload a document with metadata

Uploading a document is a multipart/form-data operation that can pass via multipart parameters several required or optional parameters.

Please note that the field metadata needs to be passed as string JSON and can contain the following data:

// The type of document
type?: DOCUMENT_TYPES;
// Link a document to a tenant by id
tenantId?: string;
// Link the document to a unit by id
unitId?: string;
// Link the document to a property by id
propertyId?: string;
// Link the document to a property group by id
propertyGroupId?: string;

enum DOCUMENT_TYPES {
  // default document type
  DOCUMENT = "DOCUMENT",
  // rental application of a tenant, passed during rental process
  RENTAL_APPLICATION = "RENTAL_APPLICATION",
  // contract with a tenant or buyer
  CONTRACT = "CONTRACT",
  // move-in protocol
  MOVE_IN = "MOVE_IN",
  // move-out protocol
  MOVE_OUT = "MOVE_OUT",
}

Sample response

{
    "id": "f2d8b7a5-9e58-4347-8864-35243fd952b0",
    "resourcePath": "subdomain/116aeae1-615a-11e7-97db-257f422c1234/properties/117ff3a1-6f1b-4da8-a3da-208d2e6f5ac4/f2d8b7a5-9e58-4347-8864-35243fd952b0",
    "title": "Floor plans",
    "companyId": "116aeae1-615a-11e7-97db-257f422c1234",
    "type": "DOCUMENT",
    "propertyId": "117ff3a1-6f1b-4da8-a3da-208d2e6f5ac4",
    "propertyGroupId": null,
    "unitId": null,
    "tenantId": null,
    "email": null,
    "mediaType": "image/png",
    "size": 10473459,
    "createdAt": "2023-05-24T09:43:19.043Z",
    "updatedAt": "2023-05-24T09:43:19.043Z"
}

// afterwards the file will be accessible at 
// https://resources.everreal.co/subdomain/116aeae1-615a-11e7-97db-257f422c1234/properties/117ff3a1-6f1b-4da8-a3da-208d2e6f5ac4/f2d8b7a5-9e58-4347-8864-35243fd952b0

Upload a document with metadata

POST https://{custom_subdomain}.everreal.co/api/file-storage/company/documents

The parameters are passed via form data and are listed below.

Request Body

NameTypeDescription

file*

form Data File

File buffer

resourcePath*

String

metadata*

String

name

String

Force another file name

format

ENUM

JPEG,PNG . Will force the conversion to JPEG or PNG of any image.

The example below will upload a file and attach it to a property and unit by passing metadata as string JSON.


curl --location "${BASE_URL}/api/file-storage/company/documents" \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {accessToken}' \
--form 'file=@"file blob multipart"' \
--form 'resourcePath="units/{unitId}"' \
--form 'name="Floor plans"' \
--form 'metadata="{\"propertyId\": \"{propertyId}\", \"unitId\": \"{unitId}\"}"'

Delete a document by id

Deletes a document by id

DELETE https://{custom_subdomain}.everreal.co/api/file-storage/company/documents/{documentId}

Path Parameters

NameTypeDescription

documentId

String

Get all documents metadata and / or apply filters

Get all documents metadata from a company and filter

GET https://{custom_subdomain}.everreal.co/api/file-storage/company/documents/metadata

Can get all documents metadata from an account and filter by certain parameters passed via query string

Query Parameters

NameTypeDescription

unitId

String

propertyId

String

types

Array String

See documentation above for available values

skip

Number

How many items should skip

take

Number

Ho many items should take.

propertyGroupId

String

title

String

tenantId

String

Get document metadata by id

Get a single document metadata

GET https://{custom_subdomain}.everreal.co/api/file-storage/company/documents/{documentId}/metadata

Last updated