Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.msgflash.com/llms.txt

Use this file to discover all available pages before exploring further.

Endpoint

POST /api/v1/messages/schedule

Important — how to get instanceId

instanceId is the technical identifier required to schedule a message. To get it:
  1. call GET /api/v1/instances
  2. choisir l’instance souhaitée
  3. copy data[n].id
  4. utiliser cette valeur dans instanceId
Ne pas envoyer :
  • name
  • waNumber

Body

FieldTypeRequiredDescription
instanceIdUUIDyesTechnical identifier of the MsgFlash instance, obtained via GET /api/v1/instances
tostringyesE.164 number
scheduledAtISO 8601yesDate/heure d’envoi
typeenumyes if no templateIdtext, image, video, audio, document, voice_note, location, contact, buttons
templateIdUUIDyes if no typeTemplate to render
variablesobjectnocustom.* values
Les autres champs suivent les mêmes règles que /messages/send, y compris les champs spécifiques aux boutons (title, description, footer, buttons).

Request example

curl -X POST https://srv.msgflash.com/api/v1/messages/schedule \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "INSTANCE_UUID",
    "to": "+33612345678",
    "type": "text",
    "text": "Hello dans 30 minutes",
    "scheduledAt": "2026-04-02T08:00:00.000Z"
  }'

Example avec boutons

curl -X POST https://srv.msgflash.com/api/v1/messages/schedule \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "INSTANCE_UUID",
    "to": "+33612345678",
    "type": "buttons",
    "title": "Rappel programmé",
    "description": "Votre rendez-vous est dans 30 minutes",
    "scheduledAt": "2026-04-02T08:00:00.000Z",
    "buttons": [
      {
        "type": "reply",
        "displayText": "Confirmer",
        "id": "confirm_appointment"
      }
    ]
  }'

Success response 201

{
  "data": {
    "id": "msg_uuid",
    "userId": "user_uuid",
    "instanceId": "inst_uuid",
    "contactId": null,
    "campaignId": null,
    "direction": "outbound",
    "type": "text",
    "from": null,
    "to": "+33612345678",
    "body": "Hello dans 30 minutes",
    "mediaUrl": null,
    "status": "queued",
    "error": null,
    "providerMessageId": null,
    "warnings": [
      "This instance is still in the warmup phase."
    ],
    "safety": {
      "decision": "warn",
      "riskLevel": "medium",
      "state": "warming",
      "score": 56
    },
    "createdAt": "2026-04-02T07:30:00.000Z",
    "updatedAt": "2026-04-02T07:30:00.000Z"
  }
}
Les warnings safety sont informatifs. En V1, ils ne bloquent pas les messages planifiés.

Common errors

HTTPCodeWhen
400VALIDATION_ERRORInvalid body
400TEMPLATE_INVALIDTemplate invalid
404NOT_FOUNDInstance, contact, or template not found
429MONTHLY_OUTBOUND_QUOTA_EXCEEDEDQuota already exhausted