Skip to main content

Essential steps before doing anything else:

  1. Create an account
  2. Create a new Project (this could be the name of your API)
  3. Generate a new ‘Access Key’ (sometimes referred to as a root key)
  4. Copy your ‘Access Key’ and Project ID somewhere safe!

Authentication

All API endpoints are authenticated using your ‘Access token’.
curl --request GET \
 --url https://api.theauthapi.com/ \
 --header 'x-api-key: REPLACE_WITH_YOUR_ACCESS_TOKEN'

const options = {
  method: 'GET',
  headers: {
    'x-api-key': 'REPLACE_WITH_YOUR_ACCESS_TOKEN'
  }
};

fetch('https://api.theauthapi.com/', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
import requests

url = "https://api.theauthapi.com/"

headers = {"x-api-key": "REPLACE_WITH_YOUR_ACCESS_TOKEN"}

response = requests.request("GET", url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.theauthapi.com/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-api-key: REPLACE_WITH_YOUR_ACCESS_TOKEN"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.get("https://api.theauthapi.com/")
  .header("x-api-key", "REPLACE_WITH_YOUR_ACCESS_TOKEN")
  .asString();
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.theauthapi.com/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-api-key", "REPLACE_WITH_YOUR_ACCESS_TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}