> For the complete documentation index, see [llms.txt](https://docs.violet.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.violet.io/concepts/overview.md).

# Authentication

The Violet API uses a **JWT-based authentication system** with refresh tokens to provide secure, long-term access to your applications. This system ensures your credentials remain secure while providing seamless API access.

#### Key Concepts

* **App Credentials**: `X-Violet-App-Id` and `X-Violet-App-Secret` identify your application
* **Authentication Token**: Short-lived JWT token (24 hours) for API requests
* **Refresh Token**: Long-lived token for obtaining new authentication tokens
* **Environment Separation**: Different credentials for test and production environments

```mermaid
sequenceDiagram
    participant App as Your Application
    participant Violet as Violet API
    participant Dashboard as Channel Dashboard

    Note over App,Dashboard: Initial Setup
    App->>Dashboard: Create account & application
    Dashboard-->>App: App ID & App Secret

    Note over App,Violet: Initial Authentication
    App->>Violet: POST /login<br/>(credentials + headers)
    Violet-->>App: Authentication Token + Refresh Token

    Note over App,Violet: API Requests
    App->>Violet: API Request<br/>(with auth token)
    Violet-->>App: API Response

    Note over App,Violet: Token Refresh (before expiry)
    App->>Violet: GET /auth/token<br/>(with refresh token)
    Violet-->>App: New Authentication Token

    Note over App,Violet: Continued API Usage
    App->>Violet: API Request<br/>(with new auth token)
    Violet-->>App: API Response
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.violet.io/concepts/overview.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
