A watchlist in the Enin APIs and Web Portal is a list of companies. You can use as many watchlists as you would like, e.g., you could have one for prospects, another one for existing customers, and one custom-made for statistical analysis. The choices are endless. Watchlists are never visible outside of your organization in the APIs or Web Portal. Changes made to a watchlist in the Web Portal are instantly reflected in the API and vice versa.
Sometimes you would want to add or remove companies from these lists which can be done both in the Web Portal and the API. This guide shows how to make changes to a watchlist by using the Enin API.
Before you start making changes to a watchlist in the API you need a watchlist UUID. Watchlist UUIDs are Enin's unique identifiers for watchlists, in order to manage watchlists from the API you need to obtain the UUID for the watchlists you would like to manage. The watchlist UUIDs never change, unless you delete a watchlist and create a new one in the Web Portal.
To find the watchlist UUID, go to the watchlist summary page in the Web Portal then click "open" on the watchlist you would like to obtain the UUID for.
When you are at the watchlist overview page, the watchlist UUID can be found in the URL in the address bar. The URL for our example watchlist is:
https://app.enin.ai/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/my-automatically-updated-watchlist
... so the watchlist UUID is 6834414f-cc36-44be-8713-d00b2ef7e05d
found between /watchlist/
and /my-automatically-updated-watchlist
.
Visit our api authentication guide to find more info about how to authenticate yourself to the API
In the below code-examples, replace the watchlist UUID:
6834414f-cc36-44be-8713-d00b2ef7e05d
with your own watchlist UUID.
Listing companies in a particular watchlist can be done by using the GET
HTTP method to
the following endpoint https://api.enin.ai/analysis/v1/watchlist/{watchlist_uuid}/company
curl -X "GET" "https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company" -H "accept: application/json" -u "YOUR_BASIC_AUTH_CLIENT_ID:YOUR_BASIC_AUTH_CLIENT_SECRET"
# Python 3.9
from pprint import pprint
import requests
response = requests.get(
"https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company",
headers={
"accept": "application/json",
"Authorization": load_api_bearer_token(api_name="analysis")
# See our Authorization documentation for an example of how to implement load_api_bearer_token
},
).json()
pprint(response)
Adding companies to a watchlist can be done by using the POST
HTTP method to the following
endpoint https://api.enin.ai/analysis/v1/watchlist/{watchlist_uuid}/company
. The endpoint
accept a list of companies in json format, where each company is identified by their
organization number and organization number schema. Organization number schema is used to
identify the format of the organization number and is primarily used to separate
organization numbers from different countries.
Companies you attempt to add which already exist in the watchlist will be ignored.
curl -X "POST" "https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company" -H "accept: application/json" -H "Content-Type: application/json" -d "[{\"org_nr\": \"917540640\",\"org_nr_schema\": \"NO\"}]" -u "YOUR_BASIC_AUTH_CLIENT_ID:YOUR_BASIC_AUTH_CLIENT_SECRET"
# Python 3.9
import requests
companies = [
{
"org_nr": "917540640", # Enin AS
"org_nr_schema": "NO"
}
]
requests.post(
"https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company",
headers={
"accept": "application/json",
"Authorization": load_api_bearer_token(api_name="analysis"),
# See our Authorization documentation for an example of how to implement load_api_bearer_token
},
json=companies,
)
Destructive operation! This will remove all companies from the given watchlist
Emptying a watchlist can be done by using the DELETE
HTTP method to the follwing endpoint
https://api.enin.ai/analysis/v1/watchlist/{watchlist_uuid}/company
. It is not possible to
recover deleted companies so make sure to use this with care.
curl -X "DELETE" "https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company" -H "accept: application/json" -u "YOUR_BASIC_AUTH_CLIENT_ID:YOUR_BASIC_AUTH_CLIENT_SECRET"
# Python 3.9
import requests
requests.delete(
"https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company",
headers={
"accept": "application/json",
"Authorization": load_api_bearer_token(api_name="analysis"),
# See our Authorization documentation for an example of how to implement load_api_bearer_token
}
)
Destructive operation! This will remove all companies from the given watchlist and fill it with companies present in the list of companies
Emptying and refilling a watchlist can be useful when you have larger changes to your set
of companies that are under monitoring. Ideally you would have local copy of companies you
wish to sync to the watchlist kept by Enin. This can be done by using the DELETE
HTTP method
mentioned in the section above, followed by a POST
with the new list of companies you wish
to upload to Enin.
curl -X "DELETE" "https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company" -H "accept: application/json" -u "YOUR_BASIC_AUTH_CLIENT_ID:YOUR_BASIC_AUTH_CLIENT_SECRET"
curl -X "POST" "https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company" -H "accept: application/json" -H "Content-Type: application/json" -d "[{\"org_nr\": \"917540640\",\"org_nr_schema\": \"NO\"}, {\"org_nr\": \"989966359\",\"org_nr_schema\": \"NO\"}]" -u "YOUR_BASIC_AUTH_CLIENT_ID:YOUR_BASIC_AUTH_CLIENT_SECRET"
# Python 3.9
import requests
requests.delete(
"https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company",
headers={
"accept": "application/json",
"Authorization": load_api_bearer_token(api_name="analysis"),
}
)
companies = [
{
"org_nr": "917540640", # Enin AS
"org_nr_schema": "NO"
},
{
"org_nr": "989966359", # Enina AS
"org_nr_schema": "NO"
}
]
requests.post(
"https://api.enin.ai/analysis/v1/watchlist/6834414f-cc36-44be-8713-d00b2ef7e05d/company",
headers={
"accept": "application/json",
"Authorization": load_api_bearer_token(api_name="analysis"),
},
json=companies,
)