**Versions de l’API** · [V2 (Latest)](/integrations/v2/docs?lang=fr) · **V1**

> **Cette version de l’API est obsolète.** Utilisez la dernière version pour toute nouvelle intégration. [Voir la documentation actuelle](/integrations/v2/docs?lang=fr)

# WhatsApp

OpenAPI 3.0.3 · API 1.0.0

```json
[
  {
    "url": "https://api.unisoft.world/integrations/v1",
    "description": "API"
  }
]
```

Liste et état en lecture seule des numéros WhatsApp connectés de l’organisation, pour choisir un `whatsappAccountId` valide (à l’état `ready`) pour une campagne. Autorisation : `messages:read`.

## Opérations

## GET /whatsapp-accounts

Lister les numéros WhatsApp connectés

`list_whatsapp_accounts`

Autorisation requise : `messages:read`. Liste les numéros WhatsApp connectés de l’organisation. Choisissez l’identifiant d’un numéro `ready` pour le définir comme whatsappAccountId de campagne.

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "messages:read",
  "additional": []
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WhatsappAccount"
            }
          }
        }
      }
    }
  }
}
```

#### HTTP 401

```json
{
  "description": "ERREUR",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 403

```json
{
  "description": "AUTORISATION_INSUFFISANTE",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "INSUFFICIENT_SCOPE"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "messages:read",
  "x-unisoft-mcp": {
    "category": "read",
    "readOnly": true,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## GET /whatsapp-accounts/{id}/status

Consulter l’état d’un numéro WhatsApp

`get_whatsapp_account_status`

Autorisation requise : `messages:read`. État actuel d’un numéro (`ready` = connecté et utilisable).

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "messages:read",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "format": "uuid",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
  },
  "description": "Identifiant de ressource — doit être un UUID. Un identifiant mal formé est refusé avec 400 INVALID_UUID (pas simplement 404). Besoin d’un nouvel identifiant ? Appelez GET /utils/uuid."
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "$ref": "#/components/schemas/WhatsappAccountStatus"
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "messages:read",
  "x-unisoft-mcp": {
    "category": "read",
    "readOnly": true,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## Schémas

```json
{
  "components": {
    "schemas": {
      "WhatsappAccount": {
        "type": "object",
        "description": "Numéro WhatsApp connecté (lecture seule). Choisissez l’identifiant d’un numéro `ready` comme whatsappAccountId de la campagne.",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true
          },
          "label": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "type": "string",
            "enum": [
              "created",
              "initializing",
              "qr_ready",
              "authenticating",
              "ready",
              "disconnected",
              "failed"
            ],
            "readOnly": true,
            "description": "`ready` = connecté et utilisable."
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "pushName": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "isDefault": {
            "type": "boolean",
            "readOnly": true
          },
          "active": {
            "type": "boolean",
            "readOnly": true
          },
          "dailyCap": {
            "type": "integer",
            "nullable": true,
            "readOnly": true,
            "description": "Limite quotidienne d’envoi ; 0 = illimitée ; null = montée en charge automatique progressive du quota."
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "readOnly": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        }
      },
      "WhatsappAccountStatus": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "ready": {
            "type": "boolean"
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "pushName": {
            "type": "string",
            "nullable": true
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Format : `ke_live_xxx`"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "parameters": {
      "IdParam": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid",
          "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
        },
        "description": "Identifiant de ressource — doit être un UUID. Un identifiant mal formé est refusé avec 400 INVALID_UUID (pas simplement 404). Besoin d’un nouvel identifiant ? Appelez GET /utils/uuid."
      }
    }
  }
}
```
