# Data Takeout

This guide describes how to use the Realpad Takeout API to back up the data stored in the system. Both structured data (such as lists of customers, deals, etc) and files uploaded to the CRM (unit plans, contract scans, ...) can be automatically retrieved this way. You are encouraged to implement an automatic backup system that will download the data from our server at any frequency you prefer, and use the data as a source for a reporting solution, or any other purpose.

## Prerequisites

To use these APIs you need to have the ability to execute HTTP requests either from the command line or from some scripting language. Please contact us if you need our help with achieving this.

## OpenAPI specification

Lives [here](https://openapi.gitbook.com/o/UuR2VSBNcvrkwmPVWwiM/spec/realpad-api-takeout.yaml).

## Request

First of all please contact <support@realpadsoftware.com> to obtain the credentials to use the Takeout API endpoints. You will perform **POST** requests over **HTTPS** and then store the resulting data. Most of the Takeout endpoints have just 2 parameters, both required: `login` and `password`.

*Example call in **cURL:***

```bash
curl \
--data "login=...&password=..." \
--output customers.xls \
https://cms.realpad.eu/ws/v10/list-excel-customers
```

## Response

### Endpoints with XML payload

**list-resources**

This endpoint provides a full list of all the files that were ever uploaded to the CRM for the given real estate developer, whether it’s unit plans, contract scans, invoices, or any other similar data that started out as a file on someone’s computer before being imported into Realpad. We call all such files ***resources***, and the `list-resources` endpoint shows them like this:

The root element is `<resources>`, sub-elements look like this:

```makefile
<resource 
uid="bb938c51-891a-48d7-ba86-bea210a55c79" 
content-type="image/jpeg" 
file-name="some file.jpg" 
size="224292" 
crc="3826804066"/>
```

* `uid` is the unique identifier of this resource, by which it can be retrieved using `get-projects`.
* `content-type` is the MIME type of the file, resolved when uploaded to the system (it's the best guess).
* `file-name` is the original file name when it was uploaded to the system.
* `size` is the file size in bytes.
* `crc` is the CRC32 checksum of the file.

The basic use case for this endpoint is to back up all the files from the CRM to some storage on local infrastructure. For that, you might want to build a tool that will regularly fetch this endpoint, compare its results to the files you already have stored, and fetch the ones that are missing. You may rely on UID as the unique identifier to distinguish between the files. You can fetch resources using **HTTP GET** by retrieving a URL in the following form: `https://cms.realpad.eu/resource/<UID>`

*Example call in **cURL:***

```bash
curl \
--output cached_resource \
https://cms.realpad.eu/resource/bd5563ae-abc...
```

### Endpoints with a binary payload

All of these endpoints return a single Excel file with a `.xls` extension, containing all the relevant data stored in our system. These endpoints behave just like `get-resource`, in that the HTTP headers contain a reasonable file name (e.g. when running from a web browser).

**Newer Excel format:** if an extra parameter `xlsx` is sent with a non-empty value, Takeout API will instead provide the data in the Excel newer `.xlsx` format.

**Column identifiers:** by default, the Excel file will have the header row built in the exactly same way as if the given user clicked a button to download the file in the user interface. This means that each column will have header titled in the language of the invoking user, and the title will be a user-friendly string. In case you need to further work with the data in a programmatic way, we strongly recommend sending an extra parameter to the AP call: its name is `headermode` and there are several possible values controlling how the header will appear in the output:

* `labels` will export headers as one row with the localized column titles. This is the default behavior in case the parameter is omitted.
* `ids` will export headers as one row with the columns identified by special strings that are guaranteed to be stable. **We urge you to use this value for the best long-term compatibility.**
* `labels_ids` will export headers as two rows: localized names first, special strings second.
* `ids_labels` will export headers as two rows: special strings first, localized names second.

{% hint style="info" %}
If you call the endpoints too often, you will receive `429 TOO MANY REQUESTS` and the body of the response tells you when it will be possible to call it again.

**See also:** [Authentication & Error Handling](https://dev.realpadsoftware.com/integrations/introduction/authentication-and-error-handling) for details on the `Retry-After` header, banning behavior, `415 Unsupported Media Type`, and other shared error responses.
{% endhint %}

**list-excel-customers**

{% hint style="warning" %}
Don't use this endpoint if the real estate developer was migrated to Multiple Inquiries.
{% endhint %}

The last column contains the unique customer ID from the Realpad database.

**list-excel-sales-status**

{% hint style="warning" %}
Don't use this endpoint if the real estate developer was migrated to Multiple Inquiries.
{% endhint %}

The last column contains the unit ID from the Realpad database.

**list-excel-customers-contacts**

{% hint style="success" %}
Use this endpoint with Multiple Inquiries.
{% endhint %}

The last two columns contain the unique customer ID, and customer owner ID from the Realpad database.

**list-excel-inquiries**

{% hint style="success" %}
Use this endpoint with Multiple Inquiries.
{% endhint %}

The last two columns contain the unique customer ID and referral ID from the Realpad database.

**list-excel-products**

The last columns contain the unique unit ID, numeric ID of the unit type, numeric ID of the unit availability, unique project ID and deal ID from the Realpad database. See the appendix for the unit type and availability enums.

**list-excel-business-cases**

The last column contains the unique Deal ID from the Realpad database.

**list-excel-projects**

The last column contains the unique project ID from the Realpad database.

**list-excel-deal-documents**

The last three columns contain the unique document ID, customer ID, and sales agent ID from the Realpad database. The first column is the relevant deal ID.

**list-excel-payments-prescribed**

The last column contains the unique payment ID from the Realpad database. The second column is the relevant deal ID.

**list-excel-payments-prescribed-lines**

The last four columns contain the line ID, deal ID, payment ID, and unit ID from the Realpad database.

**list-excel-payments-incoming**

The first column contains the unique incoming payment ID from the Realpad database. The second column is the relevant Deal ID.

**list-excel-additional-products**

The last columns contain the additional product ID, its type ID, and the ID of the associated prescribed payment from the Realpad database. The first column is the relevant deal ID.

**list-excel-inspections**

Among the columns, there are those representing the deal ID and inspection ID from the Realpad database.

**list-excel-defects**

Accepts an additional optional parameter `mode`. By default, all the Deal Warranty Claim Defects are returned. Certain developers will also see the Communal Areas Defects here by default. If `mode` is specified, other Defects can be returned. Available modes are: `DEAL_DEFECTS`, `DEAL_DEFECTS_COMMUNAL_AREA`, `DEAL_DEFECTS_COMBINED`, `INSPECTION_DEFECTS`, `INSPECTION_DEFECTS_COMMUNAL_AREA`, `INSPECTION_DEFECTS_COMBINED`.

The last column contains the unique defect ID from the Realpad database. The second column is the relevant deal ID.

**list-excel-tasks**

The last columns contain the task ID, customer ID, and sales agent ID from the Realpad database.

**list-excel-events**

The last columns contain the event ID, customer ID, unit, and project ID from the Realpad database.

**list-excel-project-units-history**

Accepts an additional required parameter `projectid`, which has to be a valid project ID from the Realpad database.

The first column contains the timestamp of when the given unit started containing the data on the given row. The second column contains the name of the user who caused that data to be recorded.

> **Warning: deprecation notice** - originally we had an endpoint called `list-excel-unit-history`. This was working in an inefficient way, fetching only one unit at a time, which for typical use cases meant the necessity to call the endpoint over and over for many units. While we currently don't have a specific deadline of removing the legacy endpoint, we urge you to consider it deprecated and replace it with the new one.

## Appendix

Unit status enumeration

* 0 - free.
* 1 - pre-reserved.
* 2 - reserved.
* 3 - sold.
* 4 - not for sale.
* 5 - delayed.

Unit type enumeration

* 1 - flat.
* 2 - parking.
* 3 - cellar.
* 4 - outdoor parking.
* 5 - garage.
* 6 - commercial space.
* 7 - family house.
* 8 - land.
* 9 - atelier.
* 10 - office.
* 11 - art workshop.
* 12 - non-residential unit.
* 13 - motorbike parking.
* 14 - creative workshop.
* 15 - townhouse.
* 16 - utility room.
* 17 - condominium.
* 18 - storage.
* 19 - apartment.
* 20 - accommodation unit.
* 21 - bike stand.
* 22 - communal area.
* 23 - non-residential unit - other.
* 24 - berth.
* 25 - construction right.
* 26 - villa.
* 27 - technical space.
* 28 - outdoor parking position for motorbike.
* 29 - property management unit.
* 30 - attic.
* 31 - backyard.
* 32 - terrace.
* 33 - cubicle.
* 34 - tenement house.
* 35 - paved area.
* 36 - garage position.
* 99 - other.

‍

{% @mailchimp/mailchimpSubscribe cta="Sign up to receive updates!" %}
