# How to make your first API call

## Step 1 - Open the answr API Reference

Before you start making your first API call, open the answr API Reference. You can find it in the answr Web app or through the answr documentation.&#x20;

{% content-ref url="/pages/ICmDFEQPOjqcIL3zf5P7" %}
[API Reference](/api-reference/authentication.md)
{% endcontent-ref %}

The documentation provides complete reference on the authentication process, but also on how different statistics and data layers, like [Climatic variables](/api-data-layers/climate-analytics/climatic-variables.md) and [Natural disasters](/api-reference/natural-disasters.md), can be requested.

This guide provides you a short introduction on how to make your first answr API call.&#x20;

## Step 2 - Choose your programming language&#x20;

Depending on what programming language you prefer, we have currently code examples for requests and responses in cURL, Python, Javascript, MATLAB and R available.

Check out the chapter [👩💻Code Samples](/coding-examples/code-samples.md) and choose the programming language you want to use.

{% content-ref url="/spaces/aeFFaXxEeZmdbsofIXux/pages/83ssaHSkCce974sGvqri" %}
[Code Samples](/coding-examples/code-samples.md)
{% endcontent-ref %}

Copy the code from "Step 1" and set up your console for performing your authentication process!

If you wish to get code samples in other programming languages, please send us your request through our [community support form.](https://www.answr.space/support)

## Step 3 - Authentication

As a first step you will need to authenticate yourself.&#x20;

Below you can find a code example in Python. Exchange the dummy email and password with your account credentials.

<pre class="language-python" data-overflow="wrap" data-line-numbers><code class="lang-python">import requests
headers = { 'accept': 'application/json', 'Content-Type': 'application/json', 
} 
json_data = { 'email': 'youremail@mail.com', 'password': 'password', }
response = requests.post('https://api.answr.space/api:auth/auth/login',
 headers=headers, json=json_data)
<strong>response.content
</strong></code></pre>

If the request was successful (value = 200), you will receive a Authentication Token (Bearer), which will have the following format:

```
eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIiwiemlwIjoiREVGIn0
```

Use it to perform your first data requests.

## Step 4 - First data request

Once you have authenticated yourself and received your Token, you can start requesting data through the answr API. You will find the Code how to perform your first data request in different programming languages, in "Step2" of the [👩💻Code Samples](/coding-examples/code-samples.md).

{% content-ref url="/spaces/aeFFaXxEeZmdbsofIXux/pages/83ssaHSkCce974sGvqri" %}
[Code Samples](/coding-examples/code-samples.md)
{% endcontent-ref %}

{% hint style="info" %}
For each API call, we cache the response for 30 minutes. This means that when you call multiple times a specific API endpoint with the same coordinates, the response is instantly available and we do not count additional requests from the authenticated account
{% endhint %}

Here is again an example in Python. Replace the word "TOKEN" with the Authentication Token you have received in the authentication process:

{% code overflow="wrap" lineNumbers="true" %}

```python
headers = { 'accept': 'headers = 
{ 'accept': 'application/json', 'Authorization': 'Bearer TOKEN', } 
params = { 'Input_point': '{"type":"point","data":{"lng":69.104192266327,"lat":36.2471504211426}}', }

response = requests.get('https://api.answr.space/api:climate-variables/a-frost-days',
 params=params, headers=headers) 
response.content
```

{% endcode %}

**Response:** (Average frost days per month on the chosen location)

```python
{
"CV88_M1":30.26427069577304,
"CV88_M2":26.46405896273526,
"CV88_M3":23.403805472634055,
"CV88_M4":14.639534906907516,
"CV88_M5":9.528541202910922,
"CV88_M6":2.90803387879648,
"CV88_M7":0.089852011000568,
"CV88_M8":0.261099363761869,
"CV88_M9":4.987315048548308,
"CV88_M10":13.34038048847155,
"CV88_M11":20.978858622637663,
"CV88_M12":28.531385161659934
}
```

**Congratulations!** You successfully performed your first data request.&#x20;


---

# 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.answr.space/start-here/how-to-make-your-first-api-call.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.
