>Contributing Data>Using the HESTIA API

Using the HESTIA API


The HESTIA API allows programmatic interaction with user accounts and uploaded files.

To use the API, you will need a HESTIA account (see Getting Started).

Retrieving the access token

Once your account is created, you will get a personal access token. You have several ways to retrieve the token:

  1. Go to your profile and copy the key in the section API Key.
  2. Use cURL from a terminal:
curl -X POST "https://api.hestia.earth/users/signin" \
  -H "Content-Type: application/json" \
  --data '{"email":"email@email.com","password":"pwd"}' | jq '.token'
  1. Using Python:
import json
import requests

headers = {'Content-Type': 'application/json'}
body = json.dumps({"email":"email@email.com","password":"pwd"})
token = requests.post('https://api.hestia.earth/users/signin', body, headers=headers).json().get('token')
print(token)
  1. Using JavaScript in the browser:
(async () => {
  const url = 'https://api.hestia.earth/users/signin';
  const headers = {
    'Content-Type': 'application/json'
  };
  const body = JSON.stringify({ email: 'email@email.com', password: 'pwd' });
  const response = await fetch(url, { method: 'POST', headers, body });
  const { token } = await response.json();
  console.log(token);
})();
  1. Using JavaScript with NodeJS:
const axios = require('axios');

(async () => {
  const url = 'https://api.hestia.earth/users/signin';
  const body = { email: 'email@email.com', password: 'pwd' };
  const { data: { token } } = await axios.post(url, body);
  console.log(token);
})();

You can now test the API on the Swagger docs.