> ## 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.

# API Keys

> Create and manage persistent keys for server-to-server communication

## Why use API Keys?

API Keys are the best way for server-side scripts, CI/CD pipelines, and Minecraft plugins to interact with our API. Unlike JWTs, API keys provide persistent access and do not expire.

## Generating a Key

Follow these steps to create your first API key:

1. **Dashboard:** Go to your [Account Settings](https://craftingstudiopro.de/dashboard/settings/api).
2. **Creation:** Navigate to the **API Keys** tab and click on "Create New Key".
3. **Storage:** Copy the key immediately. For security reasons, it will **never be shown again** in its full form.

## Header Integration

To use your API key, include it in the `X-API-Key` HTTP header:

```bash theme={null}
curl -X GET https://api.craftingstudiopro.de/v1/plugins/my-plugin/latest \
  -H "X-API-Key: YOUR_API_KEY_HERE"
```

## Java Implementation Example

If you are developing a Minecraft plugin, here is a simple way to check for updates using Java's `HttpClient`:

```java theme={null}
public void checkUpdate(String slug, String apiKey) {
    try {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.craftingstudiopro.de/v1/plugins/" + slug + "/latest"))
            .header("X-API-Key", apiKey)
            .GET()
            .build();

        client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
            .thenApply(HttpResponse::body)
            .thenAccept(json -> {
                // The API responds with the latest version info
                System.out.println("Update info: " + json);
            });
    } catch (Exception e) {
        e.printStackTrace();
    }
}
```

<Tip>
  **Best Practice:** Never hardcode your API key directly in your source code. Instead, create a `config.yml` for your plugin so users can enter their own keys.
</Tip>
