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

# API REST

> Référence complète de l'API publique Tempo Forecast. Gratuite, sans authentification.

Base URL : `https://api.tempo-forecast.mblq.cloud`

Pas d'authentification. Pas de clé API. Un simple GET suffit.

## Endpoints

| Méthode | Chemin                | Description                                         |
| ------- | --------------------- | --------------------------------------------------- |
| GET     | `/v1/public`          | Prévisions complètes (today + tomorrow + J+2 à J+7) |
| GET     | `/v1/public/today`    | Couleur du jour                                     |
| GET     | `/v1/public/tomorrow` | Couleur de demain                                   |
| GET     | `/v1/public/{date}`   | Date spécifique (YYYY-MM-DD)                        |
| GET     | `/v1/public/season`   | Quotas restants par couleur                         |
| GET     | `/v1/public/history`  | Historique officiel (paramètres `from`, `to`)       |

## Prévisions complètes

`GET /v1/public` retourne `today`, `tomorrow`, et `forecast` (J+2 à J+7).

```bash theme={null}
curl https://api.tempo-forecast.mblq.cloud/v1/public
```

### Champs de réponse

Chaque jour contient :

| Champ         | Type   | Description                       |
| ------------- | ------ | --------------------------------- |
| `date`        | string | Format YYYY-MM-DD                 |
| `color`       | string | Bleu, Blanc ou Rouge              |
| `confidence`  | int    | 0–100 (100 = officiel RTE)        |
| `source`      | string | RTE ou Prediction                 |
| `explanation` | string | Explication du modèle (optionnel) |
| `rates.hp`    | float  | Tarif heures pleines (€/kWh)      |
| `rates.hc`    | float  | Tarif heures creuses (€/kWh)      |

### Exemple de réponse

```json theme={null}
{
  "updated_at": "2026-03-17T10:30:00+01:00",
  "today": {
    "date": "2026-03-17",
    "color": "Rouge",
    "confidence": 100,
    "source": "RTE",
    "rates": { "hp": 0.706, "hc": 0.1575 }
  },
  "tomorrow": {
    "date": "2026-03-18",
    "color": "Rouge",
    "confidence": 100,
    "source": "RTE",
    "rates": { "hp": 0.706, "hc": 0.1575 }
  },
  "forecast": [
    {
      "date": "2026-03-19",
      "color": "Blanc",
      "confidence": 78,
      "source": "Prediction",
      "explanation": "Températures en hausse, consommation en baisse.",
      "rates": { "hp": 0.1871, "hc": 0.1499 }
    }
  ]
}
```

## Couleur du jour / demain

```bash theme={null}
curl https://api.tempo-forecast.mblq.cloud/v1/public/today
curl https://api.tempo-forecast.mblq.cloud/v1/public/tomorrow
```

```json theme={null}
{
  "date": "2026-03-17",
  "color": "Rouge",
  "confidence": 100,
  "is_official": true,
  "hp_rate": 0.706,
  "hc_rate": 0.1575
}
```

## Quotas de saison

`GET /v1/public/season` — jours restants par couleur pour la saison en cours.

```bash theme={null}
curl https://api.tempo-forecast.mblq.cloud/v1/public/season
```

```json theme={null}
{
  "season": "2025-2026",
  "remaining": { "rouge": 10, "blanc": 12, "bleu": 159 },
  "total": { "rouge": 22, "blanc": 43, "bleu": 300 },
  "days_elapsed": 198,
  "days_remaining": 167
}
```

Paramètre optionnel : `?season=2024-2025`

## Historique

`GET /v1/public/history` — couleurs officielles RTE pour une période donnée. Max 365 jours.

```bash theme={null}
curl "https://api.tempo-forecast.mblq.cloud/v1/public/history?from=2026-01-01&to=2026-03-17"
```

## Limites

* Aucune authentification requise
* 60 requêtes par minute par IP
* Les prévisions changent au plus 1 fois par heure — **1 appel par minute suffit**
* Codes de réponse : `200` OK, `400` paramètre invalide, `429` quota dépassé, `500` erreur serveur
