# Démarrage rapide

Démarrez avec PocketAlert en quelques minutes. Ce guide vous accompagne pour envoyer votre première notification push.

## Prérequis

- Un compte PocketAlert — [Créer un compte](https://pocketalert.app/signup) ou [Se connecter](https://pocketalert.app/signin)
- L’application mobile PocketAlert installée sur votre appareil

---

## Étape 1 : Obtenir votre clé API

1. Connectez-vous à [PocketAlert](https://pocketalert.app/signin)
2. Accédez à [Clés API](https://pocketalert.app/account/apikeys)
3. Cliquez sur **Créer une nouvelle clé**
4. Copiez et conservez votre clé API en lieu sûr

> **Warning: Important**
>
> Votre clé API n’est affichée qu’une seule fois. Conservez-la dans un endroit sûr.

---

## Étape 2 : Envoyer votre première notification

Choisissez la méthode de votre choix :

**cURL**

```bash
curl -X POST "https://api.pocketalert.app/v1/messages" \
  -H "Token: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Hello from API",
    "message": "This is my first notification!"
  }'
```

**JavaScript**

```javascript
const response = await fetch('https://api.pocketalert.app/v1/messages', {
  method: 'POST',
  headers: {
    'Token': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'Hello from API',
    message: 'This is my first notification!'
  })
});

const data = await response.json();
console.log('Message sent:', data.tid);
```

**Python**

```python
import requests

response = requests.post(
    'https://api.pocketalert.app/v1/messages',
    headers={
        'Token': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'title': 'Hello from API',
        'message': 'This is my first notification!'
    }
)

print('Message sent:', response.json()['tid'])
```

**PHP**

```php
$response = Http::withHeaders([
    'Token' => 'YOUR_API_KEY',
])->post('https://api.pocketalert.app/v1/messages', [
    'title' => 'Hello from API',
    'message' => 'This is my first notification!',
]);

echo 'Message sent: ' . $response['tid'];
```

**Go**

```go
package main

import (
    "bytes"
    "encoding/json"
    "net/http"
)

func main() {
    payload := map[string]string{
        "title":   "Hello from API",
        "message": "This is my first notification!",
    }
    body, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", 
        "https://api.pocketalert.app/v1/messages", 
        bytes.NewBuffer(body))
    req.Header.Set("Token", "YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    client.Do(req)
}
```

---

## Étape 3 : Vérifier la réponse

Une requête réussie renvoie :

```json
{
  "tid": "cq4k7rml9m2qqmuw44ypoos93",
  "title": "Hello from API",
  "message": "This is my first notification!",
  "application": "",
  "device": "",
  "created_at": "18.01.2026 15:30:00"
}
```

| Champ | Description |
|-------|-------------|
| `tid` | Identifiant unique du message |
| `title` | Titre de votre notification |
| `message` | Contenu de votre notification |
| `created_at` | Horodatage de l’envoi du message |

---

## Et ensuite ?

<div class="tip custom-block" style="padding-top: 8px">

**Découvrez davantage de fonctionnalités :**

- [Créer des applications](https://info.pocketalert.app/api/applications/create.md) — Organisez les messages par projet
- [Gérer les appareils](https://info.pocketalert.app/api/devices/get-devices.md) — Envoyez à des appareils spécifiques
- [Configurer des webhooks](https://info.pocketalert.app/api/webhooks/create.md) — Recevez des alertes de services externes
- [Utiliser la CLI](https://info.pocketalert.app/cli.md) — Envoyez des notifications depuis votre terminal

</div>

---

## Besoin d’aide ?

Pour toute assistance complémentaire ou pour nous faire part de vos cas d’usage :

| Ressource | Lien |
|----------|------|
| Support par e-mail | [support@pocketalert.app](mailto:support@pocketalert.app) |
| Référence de l’API | [Documentation complète](https://info.pocketalert.app/intro.md) |
| Outil CLI | [Télécharger et installer](https://info.pocketalert.app/cli.md) |
