# Customers API Guide

This guide documents the API endpoints for managing your Tips Feed package.

**Base URL:** `https://engage-api.lsports.eu/api/tips`

All endpoints require authentication via the `username` and `password` fields in the request body. Credentials are validated against your stored package credentials.

***

## Endpoints

### 1. Activate Package

Activates a Tips Feed package. Validates credentials and updates the package status to active in the database.

```
POST https://engage-api.lsports.eu/api/tips/package/activate
```

**Request body**

```json
{
  "packageId": 123,
  "username": "user@example.com",
  "password": "password123"
}
```

**Success (200)**

```json
{
  "success": true,
  "message": "Package activation completed successfully",
  "packageId": 123,
  "username": "user@example.com"
}
```

If the package is already active, the API returns success with the message `"Package is already active"`.

**Validation Error (400)**

```json
{
  "error": "Invalid package credentials"
}
```

Possible validation errors:

* `"PackageId must be a positive integer"`
* `"Username is required"`
* `"Password is required"`
* `"Invalid package credentials"`

**Server Error (500)**

```json
{
  "success": false,
  "message": "Failed to activate package",
  "packageId": 123
}
```

**cURL**

```bash
curl -X POST https://engage-api.lsports.eu/api/tips/package/activate \
  -H "Content-Type: application/json" \
  -d '{
    "packageId": 123,
    "username": "user@example.com",
    "password": "password123"
  }'
```

***

### 2. Deactivate Package

Deactivates a Tips Feed package. Validates credentials and updates the package status to inactive in the database.

```
POST https://engage-api.lsports.eu/api/tips/package/deactivate
```

**Request body**

```json
{
  "packageId": 123,
  "username": "user@example.com",
  "password": "password123"
}
```

**Success (200)**

```json
{
  "success": true,
  "message": "Package deactivation completed successfully",
  "packageId": 123,
  "username": "user@example.com"
}
```

If the package is already inactive, the API returns success with the message `"Package is already inactive"`.

**Validation Error (400)**

```json
{
  "error": "Invalid package credentials"
}
```

Possible validation errors:

* `"PackageId must be a positive integer"`
* `"Username is required"`
* `"Password is required"`
* `"Invalid package credentials"`

**Server Error (500)**

```json
{
  "success": false,
  "message": "Failed to deactivate package",
  "packageId": 123
}
```

**cURL**

```bash
curl -X POST https://engage-api.lsports.eu/api/tips/package/deactivate \
  -H "Content-Type: application/json" \
  -d '{
    "packageId": 123,
    "username": "user@example.com",
    "password": "password123"
  }'
```

***

### 3. Get Package Status

Retrieves the current status of a Tips Feed package without modifying it. Returns whether the package is active or inactive.

```
POST https://engage-api.lsports.eu/api/tips/package/status
```

**Request body**

```json
{
  "packageId": 123,
  "username": "user@example.com",
  "password": "password123"
}
```

**Success (200)**

```json
{
  "success": true,
  "status": "active",
  "packageId": 123,
  "username": "user@example.com"
}
```

The `status` field can be either `"active"` or `"inactive"`.

**Validation Error (400)**

```json
{
  "error": "Invalid package credentials"
}
```

Possible validation errors:

* `"PackageId must be a positive integer"`
* `"Username is required"`
* `"Password is required"`
* `"Invalid package credentials"`

**Server Error (500)**

```json
{
  "success": false,
  "message": "Unable to validate package credentials",
  "packageId": 123
}
```

**cURL**

```bash
curl -X POST https://engage-api.lsports.eu/api/tips/package/status \
  -H "Content-Type: application/json" \
  -d '{
    "packageId": 123,
    "username": "user@example.com",
    "password": "password123"
  }'
```

***

## Authentication

All endpoints require authentication via the `username` and `password` fields in the request body. The credentials are validated against the stored package credentials in the database.

***

## Error Handling

**Validation Errors (400)** — Returned when:

* Required fields are missing or invalid
* Package credentials do not match
* Package does not exist

**Server Errors (500)** — Returned when:

* Database connection fails
* External API calls fail
* Unexpected server-side errors occur


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lsports.eu/u/engage/tips-feed/customers-api-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
