---
title: Authentication
slug: authentication
description: Learn how to use the Pricemoov API effectively with this comprehensive document. Discover how to obtain and manage API keys for secure authentication, ensuring all requests are made over HTTPS. Gain insights into generating authentication tokens with code
icon: 👤
createdAt: 2023-03-13T15:10:26.000Z
---

The Pricemoov API uses API keys to authenticate requests.


# Generating an authentication Token

Your authentication token carries many privileges, so keep them secure! Do not share your key in publicly accessible areas like GitHub, client-side code, etc.


All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. See the error section.


The default lifetime of JWT tokens is 24h

:::CodeblockTabs
```shell
# Generate a token
curl --location --request POST 'https:/api.pricemoov.com/login/' \
--header 'Content-Type: application/json' \
--data-raw '{"email":"example@company.com","password":"XXXYYYYZZZ"}'
```

```python
import requests

url = 'https://api.pricemoov.com/login/'
headers = {'Content-Type': 'application/json'}
payload = {"email": "example@company.com", "password": "XXXYYYYZZZ"}

response = requests.post(url, headers=headers, json=payload)
token = response.json()['token']
```

```javascript
fetch('https://api.pricemoov.com/login/', {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({email: 'example@company.com', password: 'XXXYYYYZZZ'})
})
.then(response => response.json())
.then(data => {
  const token = data.token;
  // do something with the token
})
.catch(error => console.error(error));
```
:::

#

# Using the authentication Token to make HTTP requests

:::CodeblockTabs
```curl
curl -X GET \
  -H "Authorization: jwt xxxxxx" \
  https://api.pricemoov.com/example

```

```javascript
const axios = require('axios');
const token = 'xxxxxx'; // replace with actual JWT token
const url = 'https://api.pricemoov.com/example'; // replace with actual URL
axios.get(url, {
  headers: {
    Authorization: `jwt ${token}`
  }
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.log(error);
});

```

```python
import requests

token = 'xxxxxx' # replace with actual JWT token
url = 'https://api.pricemoov.com/example' # replace with actual URL
response = requests.get(url, headers={'Authorization': f'jwt {token}'})
print(response.json())

```

```php
<?php
$token = 'xxxxxx'; // replace with actual JWT token
$url = 'https://api.pricemoov.com/example'; // replace with actual URL
$headers = ['Authorization: jwt ' . $token];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>

```
:::

