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

# Authentication

> How to authenticate with the TensorPool API

## API Token Authentication

The TensorPool API uses bearer token authentication. All API requests must include your API token in the Authorization header.

## Getting Your API Token

1. Log in to your [TensorPool Dashboard](https://tensorpool.dev/dashboard/profile)
2. Generate or copy your API token

<Warning>
  Keep your API token secure and never share it publicly. Treat it like a password.
</Warning>

## Making Authenticated Requests

Include your API token in the `Authorization` header with the `Bearer` scheme:

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
  https://engine.tensorpool.dev/me
```

### Python Example

```python theme={null}
import requests

API_TOKEN = "your_api_token_here"
BASE_URL = "https://engine.tensorpool.dev"

headers = {
    "Authorization": f"Bearer {API_TOKEN}"
}

response = requests.get(f"{BASE_URL}/me", headers=headers)
data = response.json()
```

### JavaScript/Node.js Example

```javascript theme={null}
const API_TOKEN = 'your_api_token_here';
const BASE_URL = 'https://engine.tensorpool.dev';

const headers = {
  'Authorization': `Bearer ${API_TOKEN}`
};

fetch(`${BASE_URL}/me`, { headers })
  .then(response => response.json())
  .then(data => console.log(data));
```

## Testing Your Authentication

You can verify your API token is working by calling the `/me` endpoint:

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
  https://engine.tensorpool.dev/me
```

A successful response will return your account information.

## Error Responses

If authentication fails, you'll receive a `401 Unauthorized` response:

```json theme={null}
{
  "error": "Invalid or missing authentication token"
}
```

Common authentication errors:

* `401 Unauthorized`: Invalid or missing token
* `403 Forbidden`: Valid token but insufficient permissions
