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

# Response Format

> Standard response structure for all API endpoints.

## Standard response envelope

All API responses share a consistent structure:

```json theme={null}
{
  "success": true,
  "message": "Optional message",
  "data": { ... }
}
```

| Field     | Type           | Description                                       |
| --------- | -------------- | ------------------------------------------------- |
| `success` | boolean        | `true` on success, `false` on error               |
| `message` | string         | Human-readable message (always present on errors) |
| `data`    | object / array | Response payload (present on success)             |

## Paginated responses

List endpoints return paginated results:

```json theme={null}
{
  "success": true,
  "data": [
    { "id": 1, ... },
    { "id": 2, ... }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 15,
    "total": 72
  },
  "links": {
    "first": "https://yourdomain.com/v1/invoices?page=1",
    "last": "https://yourdomain.com/v1/invoices?page=5",
    "next": "https://yourdomain.com/v1/invoices?page=2",
    "prev": null
  }
}
```

Use the `page` query parameter to navigate pages:

```http theme={null}
GET /v1/invoices?page=2
```

## Error responses

**Validation error (422):**

```json theme={null}
{
  "success": false,
  "message": "The given data was invalid.",
  "errors": {
    "email": ["The email field is required."],
    "password": ["The password must be at least 8 characters."]
  }
}
```

**Authentication error (401):**

```json theme={null}
{
  "success": false,
  "message": "Unauthenticated."
}
```

**Not found (404):**

```json theme={null}
{
  "success": false,
  "message": "Resource not found."
}
```

**Rate limited (429):**

```json theme={null}
{
  "success": false,
  "message": "Too Many Attempts."
}
```

**Server error (500):**

```json theme={null}
{
  "success": false,
  "message": "An unexpected error occurred."
}
```

## HTTP status codes

| Code | Meaning                              |
| ---- | ------------------------------------ |
| 200  | Success                              |
| 201  | Created                              |
| 204  | No content (delete operations)       |
| 401  | Unauthenticated                      |
| 403  | Forbidden (insufficient permissions) |
| 404  | Not found                            |
| 422  | Validation error                     |
| 429  | Rate limit exceeded                  |
| 500  | Server error                         |
