> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bitgpt.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Learn how to authenticate using API keys and the correct headers.

To interact with the API you must authenticate each request using an API key to ensures all requests are linked to your organization.

## API base URL

All requests must be sent to `https://api.bitgpt.xyz`

## Required headers

You must include your API key in the `Authorization` header of every request:

```
Authorization: YOUR_API_KEY
```

Requests **must** be made over **HTTPS**.

## Example: `/auth/debug_token` Endpoint

Use the `/auth/debug_token` endpoint to debug your authenticated request

<CodeGroup dropdown>
  ```bash cURL theme={"system"}
  curl -X GET https://api.bitgpt.xyz/auth/debug_token \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Example.js theme={"system"}
  const fetch = require('node-fetch');

  fetch('https://api.bitgpt.xyz/auth/debug_token', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  })
  .then(res => res.json())
  .then(data => console.log(data));
  ```

  ```php Example.php theme={"system"}
  <?php

  $ch = curl_init('https://api.bitgpt.xyz/auth/debug_token');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY'
  ]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  curl_close($ch);
  echo $response;

  ?>
  ```

  ```python Example.py theme={"system"}
  import requests

  headers = {
    'Authorization': 'Bearer YOUR_API_KEY'
  }

  response = requests.get('https://api.bitgpt.xyz/auth/debug_token', headers=headers)
  print(response.json())
  ```

  ```java Example.java theme={"system"}
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;

  public class AuthCheck {
    public static void main(String[] args) throws Exception {
      URL url = new URL("https://api.bitgpt.xyz/auth/debug_token");
      HttpURLConnection con = (HttpURLConnection) url.openConnection();
      con.setRequestMethod("GET");
      con.setRequestProperty("Authorization", "Bearer YOUR_API_KEY");

      BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
      String inputLine;
      StringBuffer content = new StringBuffer();

      while ((inputLine = in.readLine()) != null) {
        content.append(inputLine);
      }
      in.close();

      System.out.println(content.toString());
    }
  }
  ```
</CodeGroup>
