# Training Endpoints

**Note:** Also, please check out for Training Slots and Special Data parameters.

### Create Training

POST /v2/personas/:id/trainings

**Parameters**

| Name   | Type    | Description                                                                                                                            |
| ------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| image  | string  | <p><strong>Required</strong><br>URL of the training image or reference data</p>                                                        |
| info   | string  | <p><em>Optional</em><br>Information or description about the training data</p>                                                         |
| slot   | integer | <p><em>Optional</em><br>Training slot number <br>(1-7 reserved for system)<a href="persona-slots"> <strong>Learn more</strong></a></p> |
| extras | text    | <p><em>Optional</em><br>Additional metadata or training information</p>                                                                |

**Curl Example**

```bash
curl -X POST https://api.luw.ai/v2/personas/123/trainings \
-H "Authorization: Bearer LUW_API_TOKEN" \
-d "image=https://example.com/training.jpg" \
-d "slot=8" \
-d "info=Modern living room design"
```

**Response Example**

```json
{
  "status": true,
  "training_id": 456
}
```

✨ Training slots 1-7 are reserved for system use. Use slots 8+ for custom training data.

### List Trainings

GET /v2/personas/:id/trainings

**Parameters**

| Name | Type    | Description                                                                   |
| ---- | ------- | ----------------------------------------------------------------------------- |
| id   | integer | <p><strong>Required</strong><br>ID of the persona whose trainings to list</p> |

**Curl Example**

```bash
curl -X GET https://api.luw.ai/v2/personas/123/trainings \
-H "Authorization: Bearer LUW_API_TOKEN"
```

**Response Example**

```json
{
  "status": true,
  "trainings": [
    {
      "id": 456,
      "image": "https://example.com/training.jpg",
      "slot": 8,
      "info": "Modern living room design",
      "created_at": "2024-01-04T12:00:00Z"
    }
  ]
}
```

### Get Training

GET /v2/personas/:id/trainings/:training\_id

**Parameters**

| Name         | Type    | Description                                                        |
| ------------ | ------- | ------------------------------------------------------------------ |
| id           | integer | <p><strong>Required</strong><br>ID of the persona</p>              |
| training\_id | integer | <p><strong>Required</strong><br>ID of the training to retrieve</p> |

**Curl Example**

```bash
curl -X GET https://api.luw.ai/v2/personas/123/trainings/456 \
-H "Authorization: Bearer LUW_API_TOKEN"
```

**Response Example**

```json
{
  "status": true,
  "training": {
    "id": 456,
    "image": "https://example.com/training.jpg",
    "slot": 8,
    "info": "Modern living room design",
    "created_at": "2024-01-04T12:00:00Z"
  }
}
```

### Update Training

PUT /v2/personas/:id/trainings/:training\_id

**Parameters**

| Name         | Type    | Description                                                      |
| ------------ | ------- | ---------------------------------------------------------------- |
| id           | integer | <p><strong>Required</strong><br>ID of the persona</p>            |
| training\_id | integer | <p><strong>Required</strong><br>ID of the training to update</p> |
| image        | string  | <p><em>Optional</em><br>New URL of the training image</p>        |
| info         | string  | <p><em>Optional</em><br>New information about the training</p>   |
| slot         | integer | <p><em>Optional</em><br>New training slot number</p>             |
| extras       | text    | <p><em>Optional</em><br>New additional metadata</p>              |

**Curl Example**

```bash
curl -X PUT https://api.luw.ai/v2/personas/123/trainings/456 \
-H "Authorization: Bearer LUW_API_TOKEN" \
-d "info=Updated modern living room design" \
-d "slot=9"
```

**Response Example**

```json
{
  "status": true
}
```

### Delete Training

DELETE /v2/personas/:id/trainings/:training\_id

**Parameters**

| Name         | Type    | Description                                                      |
| ------------ | ------- | ---------------------------------------------------------------- |
| id           | integer | <p><strong>Required</strong><br>ID of the persona</p>            |
| training\_id | integer | <p><strong>Required</strong><br>ID of the training to delete</p> |

**Curl Example**

```bash
curl -X DELETE https://api.luw.ai/v2/personas/123/trainings/456 \
-H "Authorization: Bearer LUW_API_TOKEN"
```

**Response Example**

```json
{
  "status": true
}
```

### Delete Training by Slot

DELETE /v2/personas/:id/trainings/slot/:slot

**Parameters**

| Name | Type    | Description                                                                                    |
| ---- | ------- | ---------------------------------------------------------------------------------------------- |
| id   | integer | <p><strong>Required</strong><br>ID of the persona</p>                                          |
| slot | integer | <p><strong>Required</strong><br><a href="persona-slots">Slot</a> of the training to delete</p> |

**Curl Example**

```bash
curl -X DELETE https://api.luw.ai/v2/personas/123/trainings/slot/7 \
-H "Authorization: Bearer LUW_API_TOKEN"
```

**Response Example**

```json
{
  "status": true
}
```
