Samples management

Endpoints to interact with your samples. Since samples are contained in projects, you will always need to indicate the project_id in which you want to operate.

get
List allowed formats

https://api.expai.io/api/files/get_allowed
Retrieves the current allowed file formats in EXPAI
Request
Response
Request
Headers
access-token
required
string
Active JWT token
Content-Type
required
string
Value: "application/json"
Response
200: OK
{
"code": "success",
"files_type": [
"csv"
],
"http_code": 200,
"message": "success"
}

post
Create a Sample

https://api.expai.io/api/projects/<project_id>/samples/create
Load a file to create a sample in an EXPAI project. We support two types of datasets: regular samples and display samples. Regular samples are those that can be used directly as input to the models. If your model doesn't handle transformation, regular samples must contain transformed data. In this case, you can also upload a display sample for visualisation. Index and column names must match in both samples. They are linked through their IDs.
Request
Response
Request
Path Parameters
project_id
required
string
Unique ID from the project where data must be stored
Headers
access-token
required
string
Active JWT token
Form Data Parameters
sample_file
required
object
File containing the data to be uploaded
sample_name_des
required
string
Unique name for the sample
sample_file_separator_des
required
string
Separator for CSV files
sample_file_encoding_des
required
string
Encoding used to store the data
sample_target_col
optional
string
If data is supervised, indicate target column
is_display
required
integer
1 if display sample else 0
original_sample_id
optional
string
If display sample with existing regular sample, indicate the id from the regular sample to link them.
display_sample_id
optional
string
If regular sample with existing display sample, indicate the id from the display sample to link them.
sample_protected_columns_des
optional
string
Columns containing sensitive data that may lead to bias. They will be used for fairness analysis.
sample_drop_columns_des
optional
string
Columns from the data that must be dropped before going through the model
Response
201: Created
Successful project creation
{
"code": "success",
"http_code": 201,
"id": 1,
"message": "Resource created",
"sample_id": "baea116d-ff6e-44ea-915a-ceac30f43e72"
}

get
List all Samples

https://api.expai.io/api/projects/<project_id>/sample/list
List all the samples in your project
Request
Response
Request
Path Parameters
project_id
required
string
Unique ID from the project where you want to search
Headers
access-token
required
string
Active JWT token
Content-Type
required
string
Value: "application/json"
Response
200: OK
Example of a project list containing 1 element.
{
"code": "success",
"http_code": 200,
"message": "success",
"samples": [
{
"created_on_dt": "Tue, 02 Mar 2021 13:06:54 GMT",
"display_sample_id": "58eabff8-59fc-44c9-bb35-2144510c8100",
"project_id": "02a40a7e-6aaf-40d1-8032-da39f30a6135",
"project_name_des": "My first project",
"sample_columns_des": "car,body,mileage,engV,engType,registration,year,model,drive",
"sample_file_encoding_des": "utf-8",
"sample_file_separator_des": ";",
"sample_file_type_des": "csv",
"sample_id": "46f9f040-9801-4b40-8086-0080083a4f24",
"sample_name_des": "Car Selling Sample",
"sample_summary_des": null,
"sample_target_col": "price"
},
{
"created_on_dt": "Tue, 02 Mar 2021 13:12:40 GMT",
"display_sample_id": null,
"project_id": "02a40a7e-6aaf-40d1-8032-da39f30a6135",
"project_name_des": "My first project",
"sample_columns_des": "car,body,mileage,engV,engType,registration,year,model,drive",
"sample_file_encoding_des": "latin-1",
"sample_file_separator_des": ";",
"sample_file_type_des": "csv",
"sample_id": "58eabff8-59fc-44c9-bb35-2144510c8100",
"sample_name_des": "Car Selling Display Sample",
"sample_summary_des": null,
"sample_target_col": "price"
}
]
}

get
Search Samples by name

https://api.expai.io/api/projects/<project_id>/sample/list/contains/<text>
List all samples in your project containing a string in their names
Request
Response
Request
Path Parameters
project_id
required
string
Unique ID from the project where you want to search
text
required
string
String to search Projects by
Headers
access-token
required
string
Active JWT token
Content-Type
required
string
Value: "application/json"
Response
200: OK
Example of a project list containing 1 element.
{
"code": "success",
"http_code": 200,
"message": "success",
"projects": [
{
"created_on_dt": "Tue, 13 Apr 2021 16:21:51 GMT",
"explanations_count": 1,
"models_allowed_num": 10,
"models_count": 3,
"models_created_num": 5,
"modified_on_dt": null,
"project_description_des": "<MY-DESCRIPTION>",
"project_id": "3620945a-d2ca-4d4e-af4e-e310e5120f48",
"project_name_des": "My project",
"samples_count": 2
}]
}

patch
Update Sample

https://api.expai.io/api/projects/<project_id>/sample/<sample_id>
Update metadata in an existing project
Request
Response
Request
Path Parameters
sample_id
required
string
Unique ID from the sample to be updated
project_id
required
string
Project to be modified unique identifier
Headers
access-token
required
string
Active JWT token
Form Data Parameters
sample_name_des
optional
string
New name for the sample
sample_file_encoding_des
optional
string
New value for sample_file_encoding_des
sample_target_col
optional
string
New value for sample_target_col
sample_file
optional
object
New file to replace existing data
Response
204: No Content
Successful modification
{
"code": "success",
"http_code": 204,
"message": "success"
}

post
Add new entries to existing Sample

https://api.expai.io/api/projects/<project_id>/sample/<sample_id>/append
Update metadata in an existing project
Request
Response
Request
Path Parameters
sample_id
required
string
Unique ID from the sample to be updated
project_id
required
string
Project to be modified unique identifier
Headers
access-token
required
string
Active JWT token
Form Data Parameters
sample_file
optional
object
File including data to be appended
Response
204: No Content
Successful modification
{
"code": "success",
"http_code": 204,
"message": "success"
}

delete
Delete Sample

https://api.expai.io/api/projects/<project_id>/sample/<sample_id>
Delete a Sample in a Project
Request
Response
Request
Path Parameters
project_id
required
string
Unique ID for the project containing the sample
sample_id
required
string
Unique ID for the sample to be deleted
Headers
access-token
required
string
Active JWT token
Response
204: No Content
Successful deletion
{
"code": "success",
"http_code": 204,
"message": "success"
}