> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
