Pulling Remote Field Classes

Beta
Pull metadata and values for all fields from Remote Source Models in a standardized format, including standard and custom fields.

This feature is only available to customers on our Professional and Enterprise plans. View the Merge Plans to learn more.


Endpoints and query parameters

MethodEndpointDescription
GET/{common_model_name}/remote-field-classesRead Remote Field Classes for a Common Model
GET/{common_model_name}?include_remote_fields=TrueRead Remote Field Classes and values for a Common Model
GET/{common_model_name}/{id}?include_remote_fields=TrueRead Remote Field Classes and values for a Common Model instance

Example

For this example, let’s use custom fields set up on the Contacts model in Hubspot, which is mapped to the Merge Contact Common Model.

We can access Remote Field Classes for Contacts using this endpoint:

GET https://api.merge.dev/api/crm/contacts/remote-field-classes

Custom Fields

These two Remote Field Classes in the response are both custom fields defined by a Hubspot user, as we can tell from the is_custom flag being set to true.

The test_dropdown_custom_field also has a list of accepted values under field_choices.

Example response - GET /contacts/remote-field-classes
1"results": [
2 {
3 "display_name": "Test String Custom Field",
4 "remote_key_name": "test_string_custom_field",
5 "description": "Test custom field with a string",
6 "is_required": false,
7 "field_type": "string",
8 "field_format": "text",
9 "field_choices": null,
10 "item_schema": null,
11 "is_custom": true,
12 "id": "87dc13db-99d6-4391-9f91-56900e284d92",
13 "is_common_model_field": false,
14 },
15 {
16 "display_name": "Test Dropdown Custom Field",
17 "remote_key_name": "test_dropdown_custom_field",
18 "description": "Test custom field with specific values",
19 "is_required": false,
20 "field_type": "string",
21 "field_format": "select",
22 "field_choices": [
23 "Option 1",
24 "Option 2"
25 ],
26 "item_schema": null,
27 "is_custom": true,
28 "id": "9a8f4d23-4c7b-47a9-86d9-c2e8a0f0d84d",
29 "is_common_model_field": false,
30 }
31]

Standard Fields

Meanwhile, these two Remote Field Classes are standard fields from Hubspot, as the is_custom flag is set to false.

Example response - GET /contacts/remote-field-classes
1"results": [
2 {
3 "display_name": "Latest time in \"Subscriber (Lifecycle Stage Pipeline)\"",
4 "remote_key_name": "hs_v2_latest_time_in_subscriber",
5 "description": null,
6 "is_required": false,
7 "field_type": "number",
8 "field_format": "number",
9 "field_choices": null,
10 "item_schema": null,
11 "modified_at": "2023-08-03T23:06:12.323009Z",
12 "is_custom": false,
13 "id": "d3b34c95-257c-4159-8709-a316bfc9f2b5",
14 "is_common_model_field": false
15 },
16 {
17 "display_name": "Latest time in \"Sales Qualified Lead (Lifecycle Stage Pipeline)\"",
18 "remote_key_name": "hs_v2_latest_time_in_salesqualifiedlead",
19 "description": null,
20 "is_required": false,
21 "field_type": "number",
22 "field_format": "number",
23 "field_choices": null,
24 "item_schema": null,
25 "modified_at": "2023-08-03T23:06:12.315781Z",
26 "is_custom": false,
27 "id": "610ad8ff-1b8b-4781-b158-da8f17a77092",
28 "is_common_model_field": false
29 }
30]

Accessing Field Values

To access Remote Field Classes and values for a specific Contact, use the include_remote_fields=True query parameter.

This returns all of an object’s properties including Remote Field Classes metadata and values.

Example response - GET /contacts/{id}?include_remote_fields=True
1{
2 "first_name": "Gil",
3 "last_name": "Feig",
4 ...
5 ...
6 "remote_fields": [
7 {
8 "remote_field_class": {
9 "display_name": "Marketing contact status",
10 "remote_key_name": "hs_marketable_status",
11 "description": null,
12 "is_required": false,
13 "field_type": "string",
14 "field_format": "booleancheckbox",
15 "field_choices": [
16 {
17 "value": "true",
18 "display_name": "Marketing contact",
19 },
20 {
21 "value": "false",
22 "display_name": "Non-marketing contact",
23 },
24 ],
25 "item_schema": null,
26 "modified_at": "2023-08-03T23:06:08.599197Z",
27 "is_custom": false,
28 "id": "07955dbe-bdba-4e91-a105-8b6bf4b4bc24",
29 "is_common_model_field": false,
30 },
31 "value": "false",
32 },
33 ],
34}