API
Docs¶
In order to integrate Alviss AI in to excising systems we provide an API one can use, the documentation is available here https://api.alviss.io/v1/api/docs
Note
In order to access the API documentation one must first have accessed https://app.alviss.io/ and be signed in`
Authentication¶
To authenticate your requests, you will need to provide an access token. To create the access token, please see Create Access Token
Once you have the access token, you can authenticate your request by sending the token in the Authorization
header of your request. For example, in the following request, replace YOUR-TOKEN
with a reference to your token:
curl --request GET \
--url "https://api.alviss.io/v1/team/teams" \
--header "Authorization: Bearer YOUR-TOKEN" \
--header "Accept: application/json"
Access Token¶
to manage your access token you can visit https://app.alviss.io/-/user#access-tokens or by clicking on your profile picture in the top right corner of the Alviss AI platform, and click on Your Account menu, then click on the Access Token tab.
Create Access Token¶
When you click on Create New Token a prompt will be shown with fields:
- Name: just a name of your token
- Expires at: the expire time of the token. to keep your tokens secure, consider setting a token that expires when your task is complete. We only allow a token to be expires within 365 days.
after submitting the prompt, your new access token will be shown once and you must save that token somewhere, once the prompt is closed you will not be able to see it anymore.
Revoking Access Token¶
You can just revoke by pressing Revoke button from the list of your tokens
Example data upload¶
Here is an example python script that
- uploads a file
- creates a dataset using the file
- activates the dataset
""" Script to upload files and create a dataset in Alviss AI. see https://api.alviss.io/v1/api/docs#/ for the API documentation """ import time import requests url = "https://app.alviss.io/api/v1/api" token = "<set me>" # access token created in https://app.alviss.io/-/user team_id = "<set me>" project_id = "<set me>" file_path = "<set me>" # the file we want to upload headers = {"Authorization": "Bearer " + token} team_project_url = url + f"/projects/{team_id}/{project_id}" # Create a data upload response = requests.post( team_project_url + "/datauploads", headers=headers, params={"dataset_name": "Sales"}, # the file type: [Sales,Events, Media, Extra, .....] files={"file": open(file_path, "rb")}, ) # wait for the dataupload to be completed upload_id = response.json().get("upload_id") while True: response = requests.get( team_project_url + f"/datauploads/{upload_id}", headers=headers, ) if response.json().get("Status") == "complete": break print(response.json()) time.sleep(1) # create the dataset response = requests.post( team_project_url + "/datasets", headers=headers, json={ "upload_ids": [upload_id], # "activate": True, # if one want to activate the dataset right away # "dataset_ids": [8], # used to extend a dataset }, ) dataset_id = response.json().get("IId") # wait for the dataupload to complete while True: response = requests.get( team_project_url + f"/datasets/{dataset_id}", headers=headers, ) if response.json().get("Status") == "complete": break print(response.json()) time.sleep(1) # activate the dataset response = requests.post( team_project_url + f"/datasets/{dataset_id}/activate", headers=headers, )