# Model API

## Model API with Latitude & Longitude

<mark style="color:green;">`POST`</mark> `https://ml.geoiq.io/model/v1.0/{model_id}`

#### Request Body

| Name                                  | Type   | Description                                                                                            |
| ------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| key<mark style="color:red;">\*</mark> | String | Authorised GeoIQ data api key with available credits                                                   |
| lat<mark style="color:red;">\*</mark> | Float  | Latitude should be between -90 to 90                                                                   |
| lng<mark style="color:red;">\*</mark> | Float  | Longitude should be between -180 to 180                                                                |
| date                                  | String | Comma separated list of variables to be fetched. Maximum 50 variables can be fetched in a single call. |
| custom\_variables                     | Object | Variables provided by client which were used in the model                                              |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
  "score": float,
  "status": integer
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid input, object invalid" %}

{% endtab %}

{% tab title="403: Forbidden Authorization Failure. Invalid key" %}

{% endtab %}
{% endtabs %}

#### Sample Request

```json
{
    "key": "Authentication Key",
    "lat": 13.058650,
    "lng": 77.592247,
    "custom_variables": 
    {
        "var1" : 124,
        "var2" : "abc"
    }
}
```

#### Sample Response

```json
{
  "score": 0.73217
  "status": 200
}
```

## Model API with Address

<mark style="color:green;">`POST`</mark> `https://ml.geoiq.io/model/v1.0/{model_id}`

#### Request Body

| Name                                      | Type   | Description                                                                 |
| ----------------------------------------- | ------ | --------------------------------------------------------------------------- |
| key<mark style="color:red;">\*</mark>     | String | Authorised GeoIQ data api key with available credits                        |
| address<mark style="color:red;">\*</mark> | String | Address for which model has to be scored                                    |
| date                                      | String | Date for which model has to be scored if not passed current date is assumed |
| custom\_variables                         | Object | Variables provided by client which were used in the model                   |

{% tabs %}
{% tab title="200: OK Success" %}

```
{
  "score": float,
  "status": integer
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid input, object invalid" %}

{% endtab %}

{% tab title="403: Forbidden  Authorization Failure. Invalid key" %}

{% endtab %}
{% endtabs %}

#### Sample Request

```json
{
    "key": "Authentication Key",
    "address": "447, 17th Cross Road 17th Main HSR Layout Sector 4 Bangalore, 560102",
    "custom_variables": 
    {
        "var1" : 124, 
        "var2" : "abc" 
    }
}
```

#### Sample Response

```json
{
  "score": 0.73217
  "status": 200
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.geoiq.io/api-docs/reference/api-reference-india/latest/model-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
