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

# Authentication

> Secure your API requests using JSON Web Tokens (JWT)

## Authentication via JWT

Secure your API requests using JSON Web Tokens (JWT). This method is ideal for user interactions and temporary sessions.

### Login via API

To obtain a JWT, send your credentials to the login endpoint:

```bash theme={null}
curl -X POST https://api.craftingstudiopro.de/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "username": "YourUsername",
    "password": "YourPassword"
  }'
```

#### Expected Response

```json theme={null}
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5...",
  "user": {
    "username": "YourUsername",
    "role": "USER"
  }
}
```

### Using the Token

Include the token in the `Authorization` header as a **Bearer Token**.

```bash theme={null}
curl -X GET https://api.craftingstudiopro.de/v1/plugins/my \
  -H "Authorization: Bearer YOUR_TOKEN_HERE"
```

<Warning>
  **Security Note:** JWTs expire after 24 hours for security reasons. After that, a new login is required. For persistent scripts or server-to-server communication, please use [API Keys](/api-keys).
</Warning>
