Accounts
Send events from your own integrations to Assembly. This is a great way to track and update your accounts.
API Key
You must first create an API Key in Assembly. It is located under “Manage Integrations”, then scroll to the bottom and click “Manage API Keys”.
Here, you can see your existing keys, their names and expiration. You can delete existing ones.
When creating a new API key, the name must be unique in your organization. Once the key has been created, you will be shown a one-time dialog box with your new API key. You should copy this down somewhere safe — we will not show this again.
If you lose your API key, you will need to make a new one.
Accounts
Maintain your accounts through these API endpoints. Accounts types include: Company or Customer. In general you can refer to an account by appending its Assembly ID or domain to the URL. Or you can add the source specific ID of the account as a query parameter.
Create Account
Required attributes are type
, name
, and domain
. The domain for a Company Account should be a domain i.e. company.com
while the domain for a Customer Account should be an email i.e. name@company.com
.
There are various optional attributes that you can add to define the account. The possible attributes are shown in the example below. You can also add source specific IDs that will then act as another id for you to reference the account with in lieu of using our Assembly ID for the account.
Note there are attributes specific to Company versus Customer Accounts:
- Company Specific Attributes:
company_type
andnumber_of_seats
- Customer Specific Attributes:
role
The Assembly ID of the created account is returned in the format {"id":"01945162-52fc-739b-98de-e2ac9f2eec49"}
Get Accounts
You can grab all the accounts for your organization by calling accounts
. This call is paginated, so please include the limit and offset in your URL otherwise the default limit=100
and offset=0
will be used.
The return type is {"accounts": {"data": [...], "has_next_page": ..., "next_cursor": ...}}
.
Note: the accounts are sorted by type so all Company Accounts will show up before Customer Accounts. Within each account type section, the accounts are sorted alphabetically by account name.
To grab a specific account, you can use the ID from Assembly, the domain of the account, or a source specific ID that you’ve already linked to the account. This call is not paginated since you are only grabbing a specific account.
The account is returned in this format {"account":{...}}
. Note that the source specific ID format is a bit different since it needs to be passed in as a query parameter.
Update Account
Update any of the account fields with this method. You can update an account via the Assembly ID, the domain of the account, or with a source specific ID that you’ve already linked to the account. In the input arguments, include any of the fields that you want to update. For updating additional properties, if the key already exists on the account then the value of that key will be updated, otherwise the whole key value pair will be added. If you want more granular actions for additional properties, please use the Additional Properties Endpoints.
All the allowed parameters are the same as the CREATE
endpoint except there are additional parameters for tags and source specific IDs.
The general tags
will be tags that are being added and then there’s an additional removed_tags
to indicate removing a tag. Similarily, the source_specific_ids
will be added while the ‘removed_source_specific_ids’ will be removed.
The Assembly ID of the updated account is returned in the format {"id":"01945162-52fc-739b-98de-e2ac9f2eec49"}
.
Upsert Account
A combination of the create and the update endpoints! If no Assembly ID, domain, nor source specific ID is passed in or if the values pass in don’t map to an existing account, then the account will be created. Otherwise, the existing account will be updated.
The Assembly ID of the updated or created account is returned in the format {"id":"01945162-52fc-739b-98de-e2ac9f2eec49"}
.
We recommend always inputting the required attributes for create (type
, name
, and domain
) so that the endpoint won’t fail when the account needs to be created.
Delete Account
Delete an account by referencing the account with its Assembly ID, domain, or source specific ID. The return is empty {}
.
Contacts
Endpoints for managing your contacts (customers who are apart of a company account). These endpoints are similar in format to the Accounts APIs. In general you can refer to a contact by appending its Assembly ID or domain to the URL. Or you can add the source specific ID of the contact as a query parameter.
Create Contact
Required attributes are name
,domain
(email i.e. name@company.com
), and some sort of company identifier. For the company identifier, you need to include the Assembly ID of the company in company_id
, the domain of the company in company_domain
, or the source specific ID of the company in company_source_specific_id
.
There are various optional attributes that you can add to define the contact, all the options are shown below. You can also add source specific IDs that will then act as another id for you to reference the contact with in lieu of using our Assembly ID for the contact.
The Assembly ID of the created contact is returned in the format {"id":"01966e6b-3219-78be-a0fe-260e590565f5"}
Get Contacts
You can grab all the contacts for your organization by calling contacts
. This call is paginated, so please include the limit and offset in your URL otherwise the default limit=100
and offset=0
will be used.
The return type is {"contacts": {"data": [...], "has_next_page": ..., "next_cursor": ...}}
.
To grab a company account’s contacts, you can use the ID from Assembly, the domain of the company account, or a source specific ID that you’ve already linked to the company account. This call is also paginated, so please include the limit and offset in your URL.
The contacts are returned in this format {"contacts":{...}}
. Note that the format for passing in the source specific ID is a bit different, it needs to be passed in as a query parameter.
To grab a specific contact, you can use the ID from Assembly, the domain of the contact, or a source specific ID that you’ve already linked to the contact. This call is not paginated since you are only grabbing a specific account.
The contact is returned in this format {"contact":{...}}
Update Contact
Update any of the contact’s fields via the Assembly ID, the domain of the contact, or with a source specific ID that you’ve already linked to the contact. In the input arguments, include any of the fields that you want to update. For updating additional properties, if the key already exists on the account then the value of that key will be updated, otherwise the whole key value pair will be added. If you want more granular actions for additional properties, please use the Additional Properties Endpoints.
All the allowed parameters are the same as the CREATE
endpoint except there are additional parameters for tags and source specific IDs.
The general tags
will be tags that are being added and then there’s an additional removed_tags
to indicate removing a tag. Similarily, the source_specific_ids
will be added while the ‘removed_source_specific_ids’ will be removed.
The Assembly ID of the updated contact is returned in the format {"id":"01966e6b-3219-78be-a0fe-260e590565f"}
.
Upsert Contact
A combination of the create and the update endpoints! If no Assembly ID, domain, nor source specific ID is passed in or if the values pass in don’t map to an existing contact, then the contact will be created. Otherwise, the existing account will be updated.
The Assembly ID of the updated or created contact is returned in the format {"id":"01966e6b-3219-78be-a0fe-260e590565f"}
.
We recommend always inputting the required attributes for create (name
, domain
, and one of the company identifiers so company_id
, company_domain
or company_source_specific_id
) so that the endpoint won’t fail when the contact needs to be created.
Delete Contact
Delete a contact by referencing the contact with its Assembly ID, domain, or source specific ID. The return is empty {}
.
Additional Properties
The custom attributes are stored on a per item basis. Therefore, all of these endpoints affect a specific account’s or contact’s additional properties. In general, the additional properties endpoints are in this format add_props/:item/:id
Create Additional Properties
To denote which account/contact to create the property on, you have to append the item (accounts
or contacts
) and either the item’s Assembly ID, source specific id, or domain to the url.
Then include a map of the properties you want to add to the value of each property. If the property already exists on that item’s additional properties, an “already exists” error will be returned. Otherwise, the Assembly ID of the account/contact that the property was created for is returned in the format {"id":"01945162-52fc-739b-98de-e2ac9f2eec49"}
.
Get Additional Properties
Specify the item (accounts
or contacts
) and either the Assembly ID, domain, or source specific ID of the item to get the additional properties.
The return includes the ID of the account and the account’s additional properties in this format {"id": "01945162-52fc-739b-98de-e2ac9f2eec49", "additional_properties": {...}}
Update Additional Properties
Update an item’s aditional properties by specifying the item (accounts
or contacts
) and either the item’s Assembly ID, domain, or source specific ID. Include any of the fields that we want to update with a mapping to their new values.
If the specified field does not already exist in the item’s additional properties, we will directly add it. The ID of the account/contact whose additional properties were updated is returned in the format {"id": "01945162-52fc-739b-98de-e2ac9f2eec49"}
Delete Additional Property
Similarly, specify the item (accounts
or contacts
) and its Assembly ID, domain, or source specific ID and then specify which properties to delete by the property names. The return is empty {}
.
Labels
Here are the API endpoints for account labels. Account label types include: Tier
, Stage
, CompanyType
, or AccountTag
(Tags).
Create Label
Required attributes are the type
, name
, and color
of the label. Optionally, include a description. The ID of the created label will be returned in this format {"id": "0195a666-3405-7664-aaf1-ad65b6091e96"}
.
Get Labels
There are three versions of grabbing account labels. You can grab all the account labels for your organization by calling /account/labels
.
To grab a specific type of account labels, add the label type so /account/labels/{type}
. And then to grab a specific label, add the label ID so /account/labels/{label_id}
.
The labels are returned in this format {"labels": [...]}
.
Update Label
To update an account label, you must have the label id and call /account/labels/{label_id}
. Use the get account labels endpoints to grab the label id if needed.
Include the fields that you are changing for the label in the json object. The possible arguments are type
, name
, color
, and description
. The ID of the updated label is returned as {"id": "0195a666-3405-7664-aaf1-ad65b6091e96"}
Delete Label
You also must have the label_id to delete an account label. Then just call /account/labels/{label_id}
with a delete operation. The return is empty {}
.
Usage
Here are the API endpoints for sending usage logs to be stored under a specific account.
Add Usage Log
The required attributes are:
timestamp
: when the event happenedtype
: the type of log, the options are “Action”, “Metric”, or “CumulativeMetric”content
: what happened in the log (think the string that shows up in your logs)attribute
: the category that the log is related to, we’ll use this attribute to group logs together for account 360s and for calculating health scores (i.e. “Login” or “AccountSpend”)value
: if the type of the log is “Metric” or “CumulativeMetric”, we require you to pass in the value of the metric so that we can use it for grouping and filtering (i.e. $20 or 7) Additionally, you can add any metadata that you want to store. The ID of the created log is returned in this format{"id": "01945162-52fc-739b-98de-e2ac9f2eec49"}
.
If you want to tie the usage log to a specific item, then you’ll need to include the item (accounts
or contacts
) and its Assembly ID, source specific id, or domain in the url.
Get Usage Logs
You can either grab all the usage logs for your organization or specify a specific account/contact through one of the three identifying methods.
This call is also paginated, so please include the limit and offset in your URL otherwise the default limit=100
and offset=0
will be used.
Note: the logs are returned in decreasing timestamp order so the newest logs are returned first.
The logs are returned in this format {"logs": {"data": [...], "has_next_page": ..., "next_cursor":...}}
You can also grab a specific usage log by appending the usage log’s id.
Update Usage Log
Update any values in a usage log by the usage log’s ID. Include the values that you want to update in the input data. Note, that updating the metadata field will completely override the existing metadata value.
The ID of the updated log is returned in this format {"id": "01945162-52fc-739b-98de-e2ac9f2eec49"}
.
Delete Usage Log
Delete a usage log by its specific ID which is returned when a usage log is created. The return is empty {}
.
Rate Limiting
There is a rate limit of 30 events per second. If you exceed this, you will receive a 429 response code.
If you need a higher rate, please let us know.