> For the complete documentation index, see [llms.txt](https://qbits-organization.gitbook.io/buildwise-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qbits-organization.gitbook.io/buildwise-doc/authentication.md).

# Authentication

**Version:** 1.0.0\
**Organization:** Qbit Spark\
**Authors:** Back-end team

***

### Base URLs

* **Development:** `http://localhost:8082`
* **Production:** `https://api.qbitspark.com`

***

### Authentication

Most endpoints require JWT Bearer token authentication:

```http
Authorization: Bearer <access-token>
```

#### Token Lifecycle

* **Access Token:** 7 days expiration
* **Refresh Token:** 365 days expiration

***

### Standard Response Format

All API responses follow this consistent structure:

```json
{
  "success": boolean,
  "httpStatus": "HTTP_STATUS_CODE",
  "message": "Descriptive message",
  "action_time": "ISO-8601 timestamp",
  "data": {} // Response payload or error details
}
```

***

### Error Handling

#### Standard Error Response

```json
{
  "success": false,
  "httpStatus": "BAD_REQUEST",
  "message": "Error description",
  "action_time": "2025-05-27T14:11:37.143039",
  "data": "Detailed error information"
}
```

#### HTTP Status Code Reference

| Code | Status                | Description                                  |
| ---- | --------------------- | -------------------------------------------- |
| 200  | OK                    | Request processed successfully               |
| 201  | Created               | Resource created successfully                |
| 400  | Bad Request           | Invalid request data or business logic error |
| 401  | Unauthorized          | Authentication required or invalid token     |
| 403  | Forbidden             | Access denied or account not verified        |
| 404  | Not Found             | Requested resource not found                 |
| 422  | Unprocessable Entity  | Request validation failed                    |
| 500  | Internal Server Error | Unexpected server error                      |
