Abacus.AI API Reference

Abacus.AI API client makes it easy to embed cutting-edge AI into your mobile, web, or/and desktop application(s). These API methods span from creating a project for your data science/engineering team to generating predictions from deployed models. We have divided the API reference section into categories based upon their broad functionality e.g., project, dataset, model, predict, etc. Our APIs are designed to provide maximum security, reliability, interoperability, robustness, modularity, and ease of use. To make the API methods easy to reference, we currently provide at least one example for each API method in both, CURL and Python. You can search for a specific API method using the API search dropdown at the top right of the screen.

Authentication

Abacus.AI uses key based authentication. You can view and manage your API keys in the API keys Dashboard. Your API keys carry many privileges, so be sure to keep them secure. Every private API call requires key-based authentication.

Creating an API key

Navigate to the API keys Dashboard. Click on the "Generate new API Key" button to generate a new key for the current organization. If you want your key to have a custom tag, enter a tag name into the box under the "Generate new API Key" heading and then hit the "Generate new API Key" button. For security reasons, do not put your key directly in your code and don't commit it to public places like GitHub.

Managing API keys

When viewing the API keys Dashboard, you will see a list of your current API keys along with the following information:

FIELD DESCRIPTION
CREATED AT The creation date-time of your API key (PST time zone).
API KEY The Value of your API Key.
TAG The name you defined for your API key.
ACTIONS Actions you can perform on your API keys, such as copying or deleting the key.

Deleting an API key

Once you delete a key, it can no longer be used to access Abacus.AI's services. Click on the "Delete" button corresponding to the key you want to delete. This will delete the key permanently. Abacus.AI will reject any subsequent API calls made using the deleted API key.

Making API Calls using CURL

All API methods under the API reference are marked with GET and/or POST requests.

GET Request Format

The general format for using curl to make a GET request call is as follows:

  curl -X GET -H "apiKey: YOUR_API_KEY" "API_METHOD_URL"

where the client needs to provide an API key in the HTTP request header (for authentication) and then use the API method url (to call the API method).

GET Request Example

An example showing how to make an API call to list all the projects in thr current organization: REQUEST:

curl -X GET -H "apiKey: 3210987**************86507975azz" "https://api.abacus.ai/api/v0/listProjects"

RESPONSE:

{
              "success": true,
              "result": [
                {
                  "projectId": "63dcd98a6",
                  "name": "Movie Recommendations",
                  "useCase": "USER_RECOMMENDATIONS",
                  "createdAt": "2021-01-05T21:22:23+00:00"
                },
                {
                  "projectId": "205a81a4",
                  "name": "TV Series Recommendations",
                  "useCase": "USER_RECOMMENDATIONS",
                  "createdAt": "2021-01-05T20:22:31+00:00"
                }
              ]
              }

POST Request Format

For POST requests, you MUST provide the Content-Type header. Url parameters or POST body parameters are supported interchangeably.

curl -H "apiKey: YOUR_API_KEY" 'METHOD_URL -d 'data1' 'data2'

POST Request Example

An example showing a post request to the rename dataset API method:

curl "https://api.abacus.ai/api/v0/createProject?name=Customer&useCase=" \
  -X POST \
  -H "apiKey:**********c74043986d6087446810a1"

Errors

The Abacus.AI API will return suitable errors if anything goes wrong with your API calls. Most errors will have a brief description of the cause, along with the error type.

Error format

We expose API errors in JSON format:

KEY TYPE DESCRIPTION
success Boolean "true" if the call succeeded, "false" if there was an error.
error String A brief description of the cause.
errorType Enum of type 'String' The type of the error.
title String A description of the error (only for the 403 error)

Error Glossary

The errors shown in the glossary are context dependent. The exact error message will differ and change depending upon the situation it is thrown at. The descriptions shown below are provided to give a general idea on the error codes:

Status Code DESCRIPTION
400 (Bad Request: The request was unacceptable, often due to missing a required parameter) MissingParameterError: A required parameter is missing. InvalidEnumParameterError: An invalid value is passed. InvalidParameterError: An invalid parameter is passed. InvalidRequest: An invalid request is passed.
403 (Forbidden) GenericPermissionDeniedError(403): A generic authentication error.
404 (Not Found: The requested resource doesn't exist) Generic404Error: A generic 404 error. DataNotFoundError: A required parameter is not found.
409 AlreadyExistsError: The request cannot process the request because the ConflictError: The request conflicts with the current state of the target resource.
424 FailedDependencyError: The request depended on another action and that action failed.
500, 502, 503, 504 (Server Errors) NotReadyError : The requested results are not ready.

Error Examples

Example 1: If wrong API key is passed - HTTP 403 error:

curl -X GET -H "apiKey:"  "https://api.abacus.ai/api/v0/listProjectDatasets?projectId=a42399ada"

Error Output:

{"title": "403 Forbidden"}

Example 2: If a parameter is missing - HTTP 400 error:

curl -X GET -H "apiKey:3210987**************86507975azz" "https://api.abacus.ai/api/v0/getTrainingConfigOptions?"

Error Output:

{
  "success": false,
  "error": "Missing required parameter 'projectId'",
  "errorType": "MissingParameterError"
}

Example 3: If an invalid method type is used for the HTTP request:

curl -X GET  -H 'apiKey:3210987**************86507975azz'  'https://api.abacus.ai/api/v0/addCustomColumn?projectId=58e9acad4&datasetId=f58641d08&column=new_gender&sql=CONCAT(gender,"A")'
{
  "success": false,
  "error": "Invalid HTTP Method (GET) used for action addCustomColumn. Method must be called using HTTP Method: POST",
  "errorType": "MethodNotAllowed"
}

Commonly Used API Methods

client.create_dataset_version_from_upload('<DATASET_ID>')
with open('<input_file_path>', 'rb') as input_file:
    upload.upload_file(input_file)
bpv=client.describe_batch_prediction_version('<BATCH_PREDICTION_VERSION>')
with open('output.csv', 'wb') as output_file:
    bpv.download_result_to_file(output_file)
client = ApiClient()
uploader = client.create_dataset_from_upload('MyOutputData-1', 'myoutputdata1', file_format='csv')
with open('my_output_data.csv') as dataset:
    uploader.upload_file(dataset)
dataset = client.describe_dataset(uploader.dataset_id)
dataset.wait_for_inspection()
print(f'{dataset.name} with id of {dataset.dataset_id} is now available at https://abacus.ai/app/dataset_detail/{dataset.dataset_id}')