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

# API introduction

> How to authenticate and use the Hostifer backend API

Hostifer exposes a REST API for authentication, project management, deployments, and GitHub integration.

## Base URL

Use your backend URL as the API origin.

* Local development: `http://localhost:3000`
* Production: your deployed Hostifer backend URL

## Authentication

You authenticate protected routes with a Bearer token in the `Authorization` header.

```bash theme={null}
Authorization: Bearer <access_token>
```

Get tokens from `POST /auth/login`, then refresh them with `POST /auth/refresh` when needed.

<Note>
  Most routes under Projects, Deployments, and GitHub require a valid Bearer token.
</Note>

## Request and response format

You send and receive JSON for standard REST endpoints.

* Content type: `application/json`
* Error responses: NestJS exception payloads with an HTTP status code and message
* Validation: request DTO validation is enforced for core modules

## Streaming logs (SSE)

The deployment logs route streams Server-Sent Events instead of a single JSON response.

* Endpoint: `GET /deployments/:id/logs`
* Content type: `text/event-stream`
* Event payloads include `ready`, log lines, `error`, and `done`

## GitHub webhook verification

The GitHub webhook endpoint validates the `x-hub-signature-256` signature against the raw request body.

* Endpoint: `POST /github/webhook`
* Headers required: `x-github-event`, `x-hub-signature-256`

## Environment variables in API testing

The backend Postman collection uses these common variables:

* `baseUrl`
* `accessToken`
* `refreshToken`
* `userId`
* `projectId`
* `deploymentId`

Use the pages in this API reference tab to see per-module endpoint behavior and examples.
