Creating and updating organizations

Here is a cURL example of creating and updating an organization in Autopilot:

curl --location\
     --request POST 'https://api.ap3api.com/v1/organizations/merge'\
     --header 'X-Api-Key: YOUR-API-KEY-HERE'\
     --header 'Content-Type: application/json'\
     --data-raw '{
        "organizations": [
          {
            "fields": {
              "str:o:name": "Autopilot",
              "int:o:employees": 60,
              "str:o:industry": "SaaS",
              "str:o:website": "https://autopilotapp.com",
              "str:o:source": "API",
              "str:o:postal": "2000",
              "geo:o:city": {"geo::city": {"name": "Sydney"}},
              "geo:o:region": {"geo::region": {"name": "New South Wales"}},
              "geo:o:country": {"geo::country": {"name": "Australia"}},
              "str:o:address": "28 OConnell St."
            }
          }
        ],
        "async": false,
        "merge_by": ["str:o:name"],
        "merge_strategy": 2,
        "find_strategy": 0
      }'

Note that "organizations" is an array. And you may provide up to 100 organizations per payload. If an organization with the provided merge key is already present, it will be created or updated updated according to the merge strategy (see below).

The person field names follow a well-defined format, if we look at str:o:name we see:

Field component Examples Description

Type

str:o:name, int:oc:my-custom-integer

The first part of the field is the type. Autopilot is strongly typed so the type is critical and the data sent to the API must be of a valid type.

Namespace

str: o:name, str:oc:custom-variable

The second part of the field is the namespace. This is used internally in Autopilot to delineate data coming from different data sources. The organization namespaces is "o", which is why you see the :o: in the middle of all the organization fields, like str:o:name. "oc" stands for custom organization field, which are custom fields that you add to your Autopilot account for organizations.

Name

str:o: name, str:oc:custom-variable

The name of the field itself. This will be stripped of any special characters and use hyphens instead of spaces.

A list of built-in organization fields

In order to not lose precision in decimal operations internally, the Autopilot API treats decimals as integers, multiplied by 1000.

Field name field_id Example Notes

Name

str:o:name

{"str:o:email": "Autopilot"}

Name of the company. Commonly used as a primary key in the merge strategy.

Employees

int:o:employees

{"int:o:employees": 60}

Number of employees at the company

Industry

str:o:industry

{"str:o:industry": "SaaS"}

Website

str:o:website

{"str:o:website": "https://autopilotapp.com"}

Source

str:o:source

{"str:o:source": "Google Adwords"}

Postal

str:o:postal

{"str:o:postal": "2000"}

Country

geo::country

{"geo::country": {"name": "Australia"}}

Region

geo::region

{"geo::region": {"name": "Victoria"}}

City

geo::city

{"geo::city": {"name": "Melbourne"}}

Why are there so few in-built fields?

Autopilot has very few built-in fields. This is because the product has several editions and data sources which have use cases requiring different fields. Each edition, and each data source adds its own fields to the system in their own namespaces. You can also add up to 100 custom fields to your own instance.