Create or update one or more accounts (previously organizations) (merge)
The merge Ortto endpoint of the accounts entity is used to create or update one or more accounts records in Ortto’s customer data platform (CDP).
This page provides descriptions of this endpoint’s:
HTTP method and request resource
POST https://api.ap3api.com/v1/accounts/mergeNOTE: Ortto customers who have their instance region set to Australia or Europe will need to use specific service endpoints relative to the region:
Australia: https://api.au.ap3api.com/ Europe: https://api.eu.ap3api.com/For example: https://api.eu.ap3api.com/v1/<entity/endpoint>
All other Ortto users will use the default service endpoint (https://api.ap3api.com/).
Path and query parameters
This endpoint takes no additional path and/or query parameters.
Headers
This endpoint requires a custom API key and content type (
application/jsonfor the request body) in the header of the request:
X-Api-Key: CUSTOM-PRIVATE-API-KEYContent-Type: application/jsonRequest body
The request body consists of a JSON object whose valid elements are listed in the table below.
The following JSON object is an example of field and object data that Ortto can recognize to create or update one or more account records in your Ortto account’s CDP.
Example create/update accounts request body in Ortto’s CDP
json
{ "accounts": [ { "fields": { "str:o:name": "Ortto", "int:o:employees": 60, "str:o:industry": "SaaS", "str:o:website": "https://ortto.com", "geo:o:city": {"name": "San Francisco"}, "str:o:address": "1390 Market St", "geo:o:region": {"name": "California"}, "geo:o:country": {"name": "United States"}, "str:o:postal": "94102", "str:o:source": "API" } }, { "fields": { "str:o:name": "My Online Store", "int:o:employees": 200, "str:o:industry": "E-commerce", "str:o:website": "https://www.myonlinestore.studio", "geo:o:city": {"name": "San Francisco"}, "str:o:address": "9000 O'Dea Ave", "geo:o:region": {"name": "California"}, "geo:o:country": {"name": "USA"}, "str:o:postal": "94123", "str:o:source": "API" } } ], "async": false, "merge_by": ["str:o:name"], "merge_strategy": 2, "find_strategy": 0 }NOTE: If merging by a accounts ID, then
accounts_idmust be the only field in themerge_byarray.Example create/update people and merge by a person’s ID
json
json
{ "accounts": [ { "fields": { "str:o:name": "Ortto", "str:o:accounts_id": "10634f759a9e23bee7a10a00", "int:o:employees": 60, "str:o:industry": "SaaS", "str:o:website": "https://ortto.com", "geo:o:city": {"name": "San Francisco"}, "str:o:address": "1390 Market St", "geo:o:region": {"name": "California"}, "geo:o:country": {"name": "United States"}, "str:o:postal": "94102", "str:o:source": "API" } }, { "fields": { "str:o:name": "My Online Store", "str:o:accounts_id": "1064092a89de464aff589500", "int:o:employees": 200, "str:o:industry": "E-commerce", "str:o:website": "https://www.myonlinestore.studio", "geo:o:city": {"name": "San Francisco"}, "str:o:address": "9000 O'Dea Ave", "geo:o:region": {"name": "California"}, "geo:o:country": {"name": "USA"}, "str:o:postal": "94123", "str:o:source": "API" } } ], "async": false, "merge_by": ["str:o:accounts_id"], "merge_strategy": 2, "find_strategy": 0 }Valid request body elements
The following table lists all valid request body elements (arrays, objects, or fields), which are available to this endpoint.
Element
Type
Description
accounts
arrayof objectsThe
accountsarray consists of objects containing their ownfieldsobjects, where each of these objects contains data associated with an account being created or updated in your Ortto account’s CDP. Between 1 to 100 accounts (each as individual objects of thisarray) can be created and/or updated in a single request body call to this endpoint.→
fieldsObject containing account field members
The object containing the fields for an account being created or updated in your Ortto account’s CDP. This account is either created or updated in Ortto’s CDP based on these criteria:
If thisfieldsobject contains an account field member whose value matches themerge_bymember’s value submitted in this request, and this account field’s value does not match that of an existing account in Ortto’s CDP, then Ortto creates this organization as a new record. Otherwise, if the account field member’s value does already match that of an existing account in Ortto’s CDP, then Ortto updates the fields of that accounts record in the Ortto CDP, based on themerge_strategyvalue of this request.→
tags
arrayofstringvaluesEach
stringvalue in thetagsarray represents a tag that is applied to this account in this request. Tags can be applied to a account, regardless of whether their record is being created or updated in your Ortto account’s CDP. If a specified tag already exists in the CDP, then that tag is re-used when applied to this account. If the account does not yet exist in the CDP, it will be created before applying any tags.→
unset_tags
arrayofstringvaluesEach
stringvalue in theunset_tagsarray represents a tag that is removed from this account in this request. Be aware that if theunset_tagsarray:
is used in conjunction with thetagsarray in a single request, avoid specifying the same tag in both arrays, since the processing order of these arrays may differ from one request to the next, resulting in unpredictable tagging outcomes. contains tags which were not applied to this account, then specifying them in this array has no effect.Therefore, a construct like:
json
"accounts": [ { "fields": { "str:o:name": "Company1" }, "tags": ["Tag2", "Tag3"], "unset_tags": ["Tag1"] }would result in Tag2 and Tag3 being applied to this org. Tag1 would be removed if it had already been applied. Otherwise, if Tag1 were not applied to this account, the tag’s explicit removal (as depicted in this code example), has no effect.
async
booleanWhen set to
true, theasyncelement enables you to queue the ingestion of merged account data. You will receive. animmediate response confirming the queued ingestion.
merge_by
arrayof one or twostringvaluesThe
merge_byelement/s whose field ID values specify the account fields used to determine whether the organizations' records are either created or updated in your Ortto account’s CDP.When the value of the account field member (determined by the relevant
merge_bymember value), submitted in this request matches that of an existing account in Ortto’s CDP, then this accounts record is updated in the CDP and where appropriate, existing field values are merged according to the strategy below. Otherwise, Ortto creates a new accounts record in the CDP.Unlike the
merge_byvalue for the/v1/person/mergeendpoint, there are no default field values associated with the custom API key submitted along with the request. Therefore, specifying at least onemerge_byelement is mandatory.NOTE: If merging by an accounts ID, then `accounts_id` must be the only field in the
merge_byarray, i.e."merge_by": ["str:o:account_id"]
merge_strategy
integer(default value is2Overwrite existing)When the
merge_bymember value (and its corresponding account field member value) submitted in this request determines that an existing accounts record in Ortto’s CDP will be updated, then thismerge_strategymember value determines how the accounts existing field values are merged. Learn more about this value in Merge strategy below. Ifmerge_strategyis not specified in the request, then the default value of2(Overwrite existing) is used.
find_strategy
integer(default value is0[any])The Find strategy determines how the
merge_byfields are used in finding an existing account to merge with, in particular, whether bothmerge_byfields are used, or just one. Learn about the different options in Find strategy below. Iffind_strategy" is not specified in the request, then the default value of `0([any]) is used.About empty values
When you use a filter to search for accounts, the Has any value filter option will find matches for field values that have a value of
0or""(empty string). However, Has any value won’t find attribute or field values that arenull.You can set values according to your needs by updating a accounts data using this API endpoint (
v1/accounts/merge). To:
Include an empty value in a search: set an existingnullto0or"". Exclude an empty value from search: set an existing""or0value tonull.For example, updating an accounts field value to exclude it from search can look like this:
json
"accounts": [ { "fields": { "str:o:name": "Oscar's Pet Supplies", "str:o:industry": null }Accounts fields
In Ortto, an account field:
contains the data for a specific piece of information (i.e. field) about each account in Ortto’s CDP, is referenced via the Ortto API using a specific ID format, could be a built in Ortto field or a custom field you have defined yourself (which also has its own ID format), and is defined as a member for each account (within their respectivefields : { … }object) submitted in the request to this endpoint.The following built-in account fields are accessible through Ortto’s API when creating or updating accounts in the CDP.
Field name (in product)
Field ID
Example
Description
Name
str:o:name
"str:o:name": "Ortto"A string whose value is the name of the account. This account field and its value is commonly used as the main
merge_byfield that determines whether an accounts record in Ortto’s CDP is either created or updated.Account ID
str:o:account_id
"str:o:account_id": "Ortto"A string value representing a unique identifier for the o CDP record.
Employees
int:o:employees
"int:o:employees": 60An integer whose value is the number of employees within the account.
Industry
str:o:industry
"str:o:industry": "SaaS"A string whose value briefly categorizes the accounts type of industry.
Website
str:o:website
"str:o:website": "https://ortto.com"A string whose value is the URL for the accounts web site.
City
geo:o:cityjson
"geo:o:city": { "name": "Melbourne" }A geographical data object consisting of a member
namewhose string value is this accounts current city.Address
str:o:address
"str:o:address": "28 O’Connell St"A string whose value is the accounts actual street address.
Region
geo:o:regionjson
"geo:o:region": { "name": "Victoria" }A geographical data object consisting of a member
namewhose string value is this accounts current region (e.g. state or province) within its country.Country
geo:o:countryjson
"geo:o:country": { "name": "Australia" }A geographical data object consisting of a member
namewhose string value is this accounts current country.Postal
str:o:postal
"str:o:postal": "2000"A string whose value is this accounts current postal code.
Source
str:o:source
"str:o:source": "Google AdWords"A string whose value represents the data source that created this accounts record. For manually created accounts records, this value is typically Manually created.
Account field ID format
Each account field is referenced by an ID.
Since Ortto integrates with many third-party products, references to account fields in Ortto’s CDP are both strongly-typed and namespace-specific. Therefore, each account field’s ID is based on the format:
type:namespace:field-nameFor:
Ortto’s own built-in accounts fields, thenamespacevalue iso. Hence, these built-in fields are referenced by an ID based on the format:
type:o:field-name Up to 100 custom fields can be added to an Ortto account/instance.
type:oc:field-nameAccount field type abbreviations
The following account field type abbreviations are used to form the first part (
type) of each account field’s ID for built-in fields:
Field type abbreviation
Type of value
geoGeographical data (object)
intInteger.
For internal operations and calculations, the Ortto API treats decimal values as integers multiplied by 1,000. This is done to preserve the precision of values resulting from these calculations.
strString
Merge strategy
The merge strategy determines how an accounts existing field values are merged.
When the
merge_bymember value (and its corresponding account field member value) submitted in this request determines that an existing accounts record in Ortto’s CDP will be updated, then one of the followingmerge_strategyvalues in the request determines how the accounts existing field values are merged:
merge_strategy (integer)
Strategy
Description
1
Append only
Using this strategy, all fields with existing values in Ortto’s CDP are not changed. Ortto only adds new data (for fields without a value).
For example, assuming you have a custom field
str:oc:head-office-city, and the request contains the account field value:"str:oc:head-office-city": "Oslo",
If this accounts existingstr:oc:head-office-cityvalue is"Sydney"in the CDP, then this existing value would not be changed after the request is submitted, and the value would remain"Sydney"in the CDP. If, however, this accounts existingstr:oc:head-office-cityvalue is empty in the CDP, then this empty field would be updated to "Oslo" in the CDP.2
Overwrite existing (default)
Using this strategy, any account fields specified in the request are updated in Ortto’s CDP, even when existing values are present, and hence are overwritten. An accounts field in the CDP can be cleared by specifying the corresponding account field’s value in the request as
null.For example, assuming you have a custom field
str:oc:head-office-cityand this accounts existingstr:oc:head-office-cityvalue in the CDP is"Sydney", then a request containing the account field value:
"str:oc:head-office-city": "Oslo"would be changed to"Oslo"in the CDP after the request is submitted,"str:oc:head-office-city": nullwould be cleared and made empty in the CDP after the request is submitted.Any accounts fields which are not specified in the request are not cleared (and retain their value) in the accounts CDP record.
3
Ignore
Using this strategy, no updates are applied to the existing accounts record in Ortto’s CDP.
TIP: Use this merge strategy to enforce only adding new accounts to the CDP, leaving existing accounts' records untouched.
Find strategy
The find strategy determines how the
merge_byfields are used to detect an existing account match.The find strategy is only relevant if you have 2
merge_byfields provided. When you have only 1 field, this setting makes no difference to the outcome. When 2merge_byfields are provided, thefind_strategyvalue determines if we utilise both fields or just one, in detecting an existing account match:
find_strategy (integer)
Strategy
Description
0
Any (default)
Using this strategy, all
merge_byfields are used in detecting an existing account to merge with.For example, assuming you have
str:o:nameandstr:o:websiteas your twomerge_byfields, and provide both fields in your request:
Starting with the firstmerge_byfield (in this case,str:o:name), try to find an existing account match using that field, and if a match is found, merge. If a match is not found using the first field, the second field is then used (in this case,str:o:website) to try and find a match, and if found, merge.1
Next only if previous empty
Using this strategy, the first
merge_byfield is prioritized, and the second field is only used if the first field was not provided.For example, assuming you have
str:o:nameandstr:o:websiteas your twomerge_byfields, and provide both fields in your request:
Starting with the first `merge_byfield (in this case,str:o:name), try to find an existing account match using that field, and if a match is found, merge. If a match is not found using the first field, the second field is ignored (even if there would be a match).If the first field is not provided for an account in the request, only then will the second field be used to detect a match.