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

# API Overview

> SPN API endpoints and authentication

# API Overview

The SPN API is built with FastAPI and follows REST conventions.

## Base URL

```
http://localhost:8000/api/v1
```

## Authentication

The API uses JWT (JSON Web Tokens) for authentication.

### Getting a Token

```bash theme={null}
curl -X POST http://localhost:8000/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "password": "yourpassword"}'
```

### Using the Token

Include the token in the Authorization header:

```bash theme={null}
curl http://localhost:8000/api/v1/companies \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

## Rate Limits

| Tier    | Limit   | Endpoints                       |
| ------- | ------- | ------------------------------- |
| AUTH    | 20/min  | Login, register, password reset |
| GENERAL | 120/min | Authenticated CRUD              |
| UPLOAD  | 10/min  | File uploads                    |
| PUBLIC  | 60/min  | Public endpoints                |

## Endpoints Summary

| Module    | Path         | Description                            |
| --------- | ------------ | -------------------------------------- |
| Auth      | `/auth`      | Login, Register, OAuth, Password Reset |
| Companies | `/companies` | Company CRUD, search, domain check     |
| Catalog   | `/catalog`   | Products, bulk upload, XML feed        |
| Contacts  | `/contacts`  | Contact management                     |
| Enquiries | `/enquiries` | Lead management, WhatsApp verify       |
| Users     | `/users`     | Profile, password change, picture      |
| Try-On    | `/tryon`     | AI virtual try-on                      |
| System    | `/system`    | Configuration                          |

## Response Format

### Success

```json theme={null}
{
  "data": {
    "id": "uuid",
    "name": "Example"
  }
}
```

### Error

```json theme={null}
{
  "detail": "Error message"
}
```

## OpenAPI Documentation

Interactive API documentation is available at:

* **Swagger UI**: [http://localhost:8000/docs](http://localhost:8000/docs)
* **ReDoc**: [http://localhost:8000/redoc](http://localhost:8000/redoc)

## Next Steps

* [Authentication](/api/auth)
* [Companies API](/api/companies)
* [Catalog API](/api/catalog)
* [Contacts API](/api/contacts)
