Atoka API User Reference
v20241018.0953Basic Concepts
Each collection refers to a single type of subject, either company or person: use the parameter type with these APIs to distinguish between the two. A collection may have several versions which are the "containers" of your data.
Each version has a schema (a list of fields) and you can upload data to a specific version: every record you upload must have the specific schema of the version you are uploading to. A version has one of the following status in this order:
- new: the version has been created and you can still amend the schema, but you cannot upload data yet
- enabled: the version is available for data upload and you can't change the schema at this stage
- deleted: the version is no longer available, you can't upload data neither amend the schema
For each collection
- there must be only one active version: this is the one that is available through the Atoka API, see Custom Data Update API to set/unset the active version for a custom data. Only versions in status enabled can be set as active
- there can be up to 3 versions in status enabled: if you need to create more versions, delete the unused ones first
Here is the process that you should follow:
- First, ask us to create a custom data collection. You'll be given the id of the collection and your token will be granted access to that specific collection. Get in touch with your sales contact for further details.
- Create the first version (and the related schema) for your newly created collection, using the Custom Data Version Create API.
- Enable the newly created version using the Custom Data Version Update API and then set it as active for your collection, using the Custom Data Update API.
- Prepare the file to upload:
- cannot exceed the size of 1MB (including headers for the request, if you keep the file ~900KB it's fine)
- CSV file with , as field separator and ; as separator of multiple values in the same field
- 1 header line, containig the two mandatory columns key and atokaId followed by the field ids of the collection
- each row should have as first columns key which is an unique identifier and atokaId the atoka Id of the company referring to the row data
- following the two mandatory columns, there should be the row values in the same order as the header
key,atokaId,field_1,field_2 1,6da785b3adf2,val_1A;val_1B,val_2
- Once you have a valid collection, you would like to:
- perform and incremental update, add data to new companies, or update existing ones, without rewriting the whole thing. In this case you can jump directly to step 6.
- replace all the data you uploaded previously, using the same schema. In this case you need to "increase" your custom data version, using the Custom Data Version Increase API. This will create a new version with the same schema of the latest one.
- change the schema of your data. You will need to create a new version of the schema with the Custom Data Version Create API and specifying the new list of fields.
- Upload the file with Custom Data Upload API: it will automatically upload the data using the latest versione available. The custom data writing in asynchronous, because the request will upload the file, start a new task, and return the response.
- If your data is bigger than the maximum allowed size for upload, you can split it in mulitple files, using the same structure, and just call multiple times the Custom Data Upload API with the different files.
- You can check the custom data status using a dedicated API. The writing is completed when a collection is in the status SYNC. Also, you can check how many records has been loaded at any given time into a version with the Custom Data Count API.
- You can check which version of your data is currently the "active" one using the Custom Data Version List API.
Custom Data List
This API shows you the list of all the custom data collections you have access to, including the list of their fields.
https://api.atoka.io/v2/customdata
All requests must be properly authenticated.
general
curl -G "https://api.atoka.io/v2/customdata" -d "type=company" -d "country=it"
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -G "https://api.atoka.io/v2/customdata"
Response
The custom data schema list
Custom Data Read
This API allows you to read the schema of a single custom data collection.
https://api.atoka.io/v2/customdata/{id}
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -G "https://api.atoka.io/v2/customdata/{id}"
Response
The custom data schema definition
Custom Data Update
This API allows you to change the active schema version for a custom data collection.
In the process of uploading your custom data, you should not need to use this API, while it is very useful where there are problems with the most recent data and you need to switch back to another previous version.
https://api.atoka.io/v2/customdata/{id}
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
general
Parameters
-
type string,
default is "company"Type of the objects the Custom Data refers to.
Choose only one among:
company
person
-
version string Private parameter
The schema version.
Use one of the versions that you see are available in the Custom data versions endpoint
-
versionUnset boolean Private parameter
If set to true, unsets the currently active schema version. Can't be used together with
version
. -
label string
the display name of the collection
-
restore boolean Private parameter
If set to true, restores a collection that was soft-deleted Can't be used together with any other parameter.
curl -XPUT "https://api.atoka.io/v2/customdata/{id}" -d "type=company" -d "version=mydata_1" -d "versionUnset=true" -d "label=Display Name" -d "restore=true"
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -XPUT "https://api.atoka.io/v2/customdata/{id}"
Response
The custom data schema definition
Custom Data Deletion
CAREFUL: This API allows you to delete an existing custom data collection, and all the data uploaded in it. A collection can be deleted only if all its versions are in status deleted.
https://api.atoka.io/v2/customdata/{id}
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
general
curl -XDELETE "https://api.atoka.io/v2/customdata/{id}" -d "type=company"
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -XDELETE "https://api.atoka.io/v2/customdata/{id}"
Response
Delete Response
Custom Data Count
This API allows you to count the number of documents in a custom data collection version.
https://api.atoka.io/v2/customdata/{id}/count
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -G "https://api.atoka.io/v2/customdata/{id}/count"
Response
counts for that version
Custom Data Version List
This API allows you to get all schema versions available for a custom data collection.
You can recognize the current active one by the field active: true
.
https://api.atoka.io/v2/customdata/{id}/versions
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
general
curl -G "https://api.atoka.io/v2/customdata/{id}/versions" -d "type=company" -d "versionStatus=enabled"
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -G "https://api.atoka.io/v2/customdata/{id}/versions"
Response
The custom data version list
Custom Data Version Create
This API allows you to create a new schema version for a custom data collection. Remember that this will create a new schema with no data inside, and unless you upload the data using the bulk API or change it using the custom data update, this will not be the "active" version (meaning the one providing the data to the user through the Company Search).
Structure of the Fields
In order to create a field for your custom data, you have to follow a specific schema (you can find the complete json structure of the fields in the parameter definition)
Each field should have:
field
: the unique identifier (in the collection) of the field, this is the name you will use also as header in the bulk uploaddefinition
: this is the most important part where you define how your data is structured and have these properties:type
: the datatype, must be one of:boolean
,integer
,float
,date
,time
,keyword
,text
,array
. If it is an array you should also add a property"items": {"type": "<datatype>"}
that specifies the datatype for the array elements.required
: (bool) is this field required for every item in the custom data uploaded?options
: an object containing various settings that depend on the datatype, some of them do not apply to all the datatypes.min
andmax
: (for numeric and date-time fields) defines min and max values allowed for the fieldsymbols
: (for keyword) list of possible valuessuggester
: (bool, for keyword), does this field support a suggester API?ignoreCase
: (bool, for keyword)language
: (italian, english, only for text)distribution
: (for numeric and date-time fields) defines how the statistics distribution aggregation should be performed on this field.
search
: is this field searchable? if yes, set it to {"active": true"}facet
: is faceting active on this field? if yes set it to {"active": true", "type": "values/presence"}. Usevalues
if you want the counts for each value of the field, orpresence
if you are interested only in knowing how many companies have a value for this field.
https://api.atoka.io/v2/customdata/{id}/versions
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
general
Parameters
-
type string,
default is "company"Type of the objects the Custom Data refers to.
Choose only one among:
company
person
-
version string required
the schema version
-
fields array required
The schema fields. Pass this parameter once per field.
To specifiy multiple values, repeat the parameter.
SCHEMA:{}"field": "foo","esField": "foo","label": "foo","definition": {},"required": false,"type": "boolean","items": {},"type": "boolean""options": {}"min": 0.42,"max": 0.42,"distribution": {},"numBuckets": 42,"interval": 0.42,"ranges": []{},"from": 0.42,"to": 0.42..."symbols": [],"foo",..."suggester": undefined,"ignoreCase": false,"language": "foo","format": "url","labelTemplate": "foo","urlTemplate": "foo""search": {},"active": false"facet": {}"active": false,"type": "presence" -
light boolean,
default is falseIs the collection schema light?
curl -XPOST "https://api.atoka.io/v2/customdata/{id}/versions" -d "type=company" -d "version=mydata_1"
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -XPOST "https://api.atoka.io/v2/customdata/{id}/versions"
Response
The custom data version list with the new version
Custom Data Version Increase
This API is a shortcut for the Custom Data Version Create endpoint, when you want to keep the same structure for your data.
This is the API to call before uploading a new full set of data: it will create a new version of custom data with the same schema of the latest available version for the custom data collection.
Similarly to the Custom Data Version Create it will not set the new version as "active".
https://api.atoka.io/v2/customdata/{id}/versions/increase
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -XPOST "https://api.atoka.io/v2/customdata/{id}/versions/increase"
Response
The custom data version list with the new version
Custom Data Version Update
This API allow you to change the status of a version and, if the version is still in status new
, change its mapping.
https://api.atoka.io/v2/customdata/{id}/versions/{version}
Replace {id} with the Custom Collection ID you want details for..
Replace {version} with the Custom Collection version you want to change..
All requests must be properly authenticated.
general
Parameters
-
fields array
The schema fields. Pass this parameter once per field.
To specifiy multiple values, repeat the parameter.
SCHEMA:{}"field": "foo","esField": "foo","label": "foo","definition": {},"required": false,"type": "boolean","items": {},"type": "boolean""options": {}"min": 0.42,"max": 0.42,"distribution": {},"numBuckets": 42,"interval": 0.42,"ranges": []{},"from": 0.42,"to": 0.42..."symbols": [],"foo",..."suggester": undefined,"ignoreCase": false,"language": "foo","format": "url","labelTemplate": "foo","urlTemplate": "foo""search": {},"active": false"facet": {}"active": false,"type": "presence" -
type string,
default is "company"Type of the objects the Custom Data refers to.
Choose only one among:
company
person
-
versionStatus string
desired status of the Custom Data version
Choose only one among:
new
enabled
deleted
curl -XPUT "https://api.atoka.io/v2/customdata/{id}/versions/{version}" -d "type=company" -d "versionStatus=enabled"
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -XPUT "https://api.atoka.io/v2/customdata/{id}/versions/{version}"
Response
The updated custom data version
Custom Data Version Deletion
CAREFUL: This API allows you to delete an existing custom data version for good. A version can be deleted only when is alredy in status deleted
https://api.atoka.io/v2/customdata/{id}/versions/{version}
Replace {id} with the Custom Collection ID you want details for..
Replace {version} with the Custom Collection version you want to change..
All requests must be properly authenticated.
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -XDELETE "https://api.atoka.io/v2/customdata/{id}/versions/{version}"
Response
Delete Response
Custom Data Upload
Upload a file containing your custom data in the Atoka API. Your data will be uploaded in the latest available custom data version.
Since the maximum request size allowed is 1MB, in case you need to upload more data, just split them in mulitple files, with the same structure, and call this API multiple times with different files.
The API will return as soon as file upload is completed, while the process of uploading actual data in our system could take longer. This is managed by an asynchornous task: you can check its status using the Custom Data Upload Status API.
The custom data upload should be sent as a multipart/form POST request.
https://api.atoka.io/v2/customdata/{id}/bulk
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
general
Parameters
-
type string,
default is "company"Type of the objects the Custom Data refers to.
Choose only one among:
company
person
-
dryRun boolean,
default is falseIs this a dry run or do you want to really write the data?
-
versionId string
the schema version.
This parameter is deprecated. Please use
version
instead -
version string Private parameter
The schema version.
Use one of the versions that you see are available in the Custom data versions endpoint
-
file string required
The CSV file containing the data to upload.
- The maximum size allowed for the whole request is 1MB, we suggest to keep the file < 900KB.
- Please use
,
as field separator and;
for separating multiple values in the same field. - The file should always have 1 line for header and 2 columns containing a unique identifier for each row (
key
) and the Atoka Id (atokaId
) of the company described in that row. - Following the two mandatory columns, there should be the values of the row following the same order of the header
Example:
key,atokaId,field_1,field_2 1,6da785b3adf2,val_1A;val_1B,val_2
curl -XPOST "https://api.atoka.io/v2/customdata/{id}/bulk" -d "type=company" -d "versionId=mydata_1" -d "version=mydata_1"
Authentication
The custom data upload should be sent as a multipart/form POST request.
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -XPOST "https://api.atoka.io/v2/customdata/{id}/bulk"
Response
The custom data collection uploaded
Custom Data Upload Status
With this API you can monitor the status of your custom data upload task.
Possible status are (in order):
QUEUED
: the task has been created, and is waiting to be exectutedMATCHING
: the task started the process of matching your data with the ones available in AtokaMATCHING DONE
: the task completed the matching part, and is waiting to start the writingWRITING
: the task started the actual writing of the data in our storageWRITING DONE
: the task completed the writing and is waiting for the custom data version switch.SYNC
: the task switched the "active" version to the latest available and the upload is completed.
https://api.atoka.io/v2/customdata/{id}/progress
Replace {id} with the Custom Collection ID you want details for..
All requests must be properly authenticated.
general
Parameters
-
type string,
default is "company"Type of the objects the Custom Data refers to.
Choose only one among:
company
person
-
version string Private parameter
The schema version.
Use one of the versions that you see are available in the Custom data versions endpoint
curl -G "https://api.atoka.io/v2/customdata/{id}/progress" -d "type=company" -d "version=mydata_1"
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -G "https://api.atoka.io/v2/customdata/{id}/progress"
Response
The custom data collection upload status
Custom Data Text Suggester
This API allows you to get possibile values of a text field in your custom collection.
https://api.atoka.io/v2/customdata/{id}/suggester/{field}
Replace {id} with the Custom Collection ID you want details for..
Replace {field} with the field you want to get possible values.
All requests must be properly authenticated.
Authentication
Parameters
-
token string required
All requests must be properly authenticated; see the Authentication section for more info
curl -G "https://api.atoka.io/v2/customdata/{id}/suggester/{field}"
Response
The list of possible values