# Models

The `v1/models` endpoint is used to make predictions using a trained model. Details on training a model via the API can be found at the [Training endpoint](https://docs.akkio.com/akkio-docs/endpoints-and-schemas/endpoints/training). Use `GET` to obtain a list of all models. Then use the model ID to `POST` data to that model and receive predictions.

## Get All Models

<mark style="color:blue;">`GET`</mark> `https://api.akkio.com/v1/models`

#### Query Parameters

| Name                                       | Type   | Description                                                         |
| ------------------------------------------ | ------ | ------------------------------------------------------------------- |
| api\_key<mark style="color:red;">\*</mark> | string | Your api key, accessible from <https://app.akkio.com/team-settings> |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success",
    "models": [
       
        {
            "id": "mpcfo01LuKwZKkH8fMwN",
            "name": "titanic-sheet-titanic"
        },
        {
            "id": "nPG4VV5MhXwiiuNdgYTU",
            "name": "Lead Scoring Demo"
    ]
}
```

{% endtab %}
{% endtabs %}

```bash
# Example cURL

curl --request GET 'https://api.akkio.com/v1/models?api_key=api_key_string'
```

## Make Prediction

<mark style="color:green;">`POST`</mark> `https://api.akkio.com/v1/models`

#### Request Body

| Name                                       | Type   | Description                                                                          |
| ------------------------------------------ | ------ | ------------------------------------------------------------------------------------ |
| api\_key<mark style="color:red;">\*</mark> | string | Your api key, accessible from <https://app.akkio.com/team-settings>                  |
| data<mark style="color:red;">\*</mark>     | array  | Data in the format of: \[{'field name 1': 'value 1', 'field name 2': 0}, {...}, ...] |
| id<mark style="color:red;">\*</mark>       | string | The ID of the model to make the prediction with                                      |

{% tabs %}
{% tab title="200  Example response  from request on the titanic dataset:
{ "id":"wNFRCKF4L2WRwl75lyja",
"data": \[{"Age":58}],
"api\_key": "YOUR\_API\_KEY" }" %}

```
{
    "status": "success",
    "predictions": [
        {
            "Survived": "0",
            "Probability Survived is 0": 0.8029362559318542,
            "Probability Survived is 1": 0.19706374406814575
        }
    ]
}
```

{% endtab %}
{% endtabs %}

```bash
# Example cURL

curl -g --request POST 'https://api.akkio.com/v1/models?id=id_string&api_key=api_key_string&data=[{'\''field name 1'\'': '\''value 1'\'', '\''field name 2'\'': 0}]'
```

## Delete Model&#x20;

<mark style="color:red;">`DELETE`</mark> `https://api.akkio.com/v1/models`

#### Request Body

| Name                                       | Type   | Description                                                         |
| ------------------------------------------ | ------ | ------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>       | string | The ID of the model to be deleted                                   |
| api\_key<mark style="color:red;">\*</mark> | string | Your api key, accessible from <https://app.akkio.com/team-settings> |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success"
}
```

{% endtab %}
{% endtabs %}

```bash
# Example cURL

curl --request DELETE 'https://api.akkio.com/v1/models?id=id_string&api_key=api_key_string'
```
