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

# Overview

> Learn how to authenticate and use the Gitar API to manage your installation

## Base URL

```
https://api.gitar.ai/v1
```

## Authentication

All endpoints require a Bearer token in the Authorization header.

## Creating an API Token

<Steps>
  <Step title="Navigate to Organization Settings">
    Go to [app.gitar.ai](https://app.gitar.ai) and open your organization settings.
  </Step>

  <Step title="Create New Token">
    Click **Create API Token** in the API section.
  </Step>

  <Step title="Configure Token">
    Set the following options:

    * **Alias** (optional): Descriptive name (e.g., "Health Monitor")
    * **Duration**: Token expiration (default: 30 days)
  </Step>

  <Step title="Copy and Store Securely">
    Copy your token immediately — it won't be shown again. Store it securely in your CI/CD secrets or environment variables.
  </Step>
</Steps>

## Quick Example: Check Installation Health

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.gitar.ai/v1/external/installation/health \
    -H "Authorization: Bearer $GITAR_API_TOKEN"
  ```

  ```python Python theme={null}
  import requests
  import os

  response = requests.get(
      "https://api.gitar.ai/v1/external/installation/health",
      headers={
          "Authorization": f"Bearer {os.environ['GITAR_API_TOKEN']}"
      }
  )

  data = response.json()
  for platform, info in data["code_hosting"].items():
      print(f"{platform}: {info['status']}")
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch("https://api.gitar.ai/v1/external/installation/health", {
    headers: {
      "Authorization": `Bearer ${process.env.GITAR_API_TOKEN}`
    }
  });

  const { code_hosting } = await response.json();
  if (code_hosting.gitlab) console.log(`GitLab: ${code_hosting.gitlab.status}`);
  if (code_hosting.github) console.log(`GitHub: ${code_hosting.github.status}`);
  ```
</CodeGroup>

## Response Format

All API responses are JSON. Successful responses include the requested data:

```json theme={null}
{
  "code_hosting": {
    "gitlab": {
      "status": "ok",
      "host": "gitlab.example.com",
      "group": "my-org"
    },
    "github": {
      "status": "ok"
    }
  }
}
```

Error responses include a message:

```json theme={null}
{
  "message": "Not Found"
}
```

## Rate Limits

API requests are rate limited per organization. If you exceed the limit, you'll receive a `429 Too Many Requests` response. Contact [developers@gitar.ai](mailto:developers@gitar.ai) if you need higher limits.

## Next Steps

<CardGroup cols={2}>
  <Card title="Onboard GitLab Project" icon="gitlab" href="/api-reference/gitlab/onboard-project">
    Add a GitLab project to Gitar for code review
  </Card>

  <Card title="Installation Health" icon="heart-pulse" href="/api-reference/installation/get-installation-health">
    Check the health status of your code hosting installation
  </Card>
</CardGroup>
