**גרסאות API** · [V2 (Latest)](/integrations/v2/docs?lang=he) · **V1**

> **גרסה זו של ה־API מיושנת.** לחיבורים חדשים יש להשתמש בגרסה העדכנית ביותר. [לתיעוד העדכני](/integrations/v2/docs?lang=he)

# Campaigns

OpenAPI 3.0.3 · API 1.0.0

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

Message campaigns (WhatsApp / SMS / Email + fallback cascades). The draft (state INIT) is fully editable; SENDING is a SEPARATE, higher-risk action behind the `messages:send` scope (real mass send: SMS cost, WhatsApp ban risk, GDPR). Preview the audience with GET /{id}/targets before sending. Scopes: `messages:read` (also covers WhatsApp numbers & messaging configs) / `messages:write` (also covers uploads) / `messages:send`.

## פעולות

## GET /campaigns

List campaigns

`list_campaigns`

Required scope: `messages:read`. Lists the org's campaigns with delivery stats. Paginated. Filter with `?state` (INIT|VALIDATE|FINISHED) or `?type`.

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```json
{
  "name": "limit",
  "in": "query",
  "schema": {
    "type": "integer",
    "minimum": 1,
    "maximum": 200,
    "default": 50
  },
  "description": "Number of results per page"
}
```

```json
{
  "name": "cursor",
  "in": "query",
  "schema": {
    "type": "string"
  },
  "description": "Opaque cursor returned by the previous request"
}
```

```json
{
  "name": "state",
  "in": "query",
  "schema": {
    "type": "string",
    "enum": [
      "INIT",
      "VALIDATE",
      "FINISHED"
    ]
  }
}
```

```json
{
  "name": "type",
  "in": "query",
  "schema": {
    "type": "string"
  }
}
```

### תגובות

#### HTTP 200

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

#### HTTP 401

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

#### HTTP 403

```json
{
  "description": "INSUFFICIENT_SCOPE",
  "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
  }
}
```

## POST /campaigns

Create a campaign (draft)

`create_campaign`

Required scope: `messages:write`. Creates a campaign in state INIT (draft). Does NOT send — use POST /{id}/send. Targeting is mutually exclusive (allContact | staredOnly | categories).

### אימות

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

### הרשאות נדרשות

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

### גוף הבקשה

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CampaignInput"
      }
    }
  }
}
```

### תגובות

#### HTTP 200

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

#### HTTP 400

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

#### HTTP 403

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

### OpenAPI

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

## GET /campaigns/sms/available

Remaining SMS quota

`get_sms_quota`

Required scope: `messages:read`. Returns the org's remaining SMS credits (useful before sending an SMS campaign).

### אימות

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

### הרשאות נדרשות

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

### תגובות

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean"
              },
              "total": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}
```

### OpenAPI

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

## GET /campaigns/{id}

Get a campaign

`get_campaign`

Required scope: `messages:read`. Full campaign incl. delivery stats.

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
}
```

### תגובות

#### HTTP 200

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

#### 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
  }
}
```

## PATCH /campaigns/{id}

Update a draft campaign

`update_campaign`

Required scope: `messages:write`. Updates a campaign — only while it is INIT (draft). Returns 409 if it has already been sent.

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
}
```

### גוף הבקשה

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CampaignInput"
      }
    }
  }
}
```

### תגובות

#### HTTP 200

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

#### HTTP 400

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

#### HTTP 404

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

#### HTTP 409

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

### OpenAPI

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

## DELETE /campaigns/{id}

Delete a campaign

`delete_campaign`

Required scope: `messages:write`. Soft-deletes the campaign.

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
}
```

### תגובות

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
```

#### 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:write",
  "x-unisoft-mcp": {
    "category": "delete",
    "readOnly": false,
    "destructive": true,
    "idempotent": true,
    "warn": false
  }
}
```

## POST /campaigns/{id}/duplicate

Duplicate a campaign

`duplicate_campaign`

Required scope: `messages:write`. Duplicates the campaign as a fresh INIT draft (new id, scheduledAt cleared, stats reset; media shared by reference).

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
}
```

### תגובות

#### HTTP 200

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

#### 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:write",
  "x-unisoft-mcp": {
    "category": "create",
    "readOnly": false,
    "destructive": false,
    "idempotent": false,
    "warn": false
  }
}
```

## GET /campaigns/{id}/targets

Preview the recipient count

`preview_campaign_targets`

Required scope: `messages:read`. Counts the recipients the campaign's stored targeting resolves to, WITHOUT creating any delivery. Returns 0 if no targeting is set.

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
}
```

### תגובות

#### HTTP 200

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

#### 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
  }
}
```

## POST /campaigns/{id}/send

Send the campaign (real mass send)

`send_campaign`

Required scope: `messages:send`. **Triggers the real mass send.** Transitions the draft INIT→VALIDATE and enqueues one delivery per resolved recipient; daemons then send via WhatsApp/SMS/email. **Irreversible** and may incur SMS costs, risk WhatsApp number bans (rate limits), and has GDPR implications (messaging real contacts). Preview the audience first with POST /{id}/targets. Idempotent: a campaign already sent (state ≠ INIT) returns 409.

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
}
```

### תגובות

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean"
              },
              "data": {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string"
                  },
                  "targets": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```

#### HTTP 404

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

#### HTTP 409

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

### OpenAPI

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

## POST /campaigns/{id}/test

Send a test to one contact (draft only)

`test_campaign`

Required scope: `messages:send`. Sends a single test message of the campaign to one contact (real send to that contact; excluded from stats; ignores the unsubscribe list). Allowed ONLY while the campaign is a draft (state INIT) — returns 409 otherwise. Body: {contactId}.

### אימות

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

### הרשאות נדרשות

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

### פרמטרים

```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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
}
```

### גוף הבקשה

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CampaignTestInput"
      }
    }
  }
}
```

### תגובות

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
```

#### HTTP 400

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

#### HTTP 404

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

#### HTTP 409

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

### OpenAPI

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

## סכמות

```json
{
  "components": {
    "parameters": {
      "LimitParam": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200,
          "default": 50
        },
        "description": "Number of results per page"
      },
      "CursorParam": {
        "name": "cursor",
        "in": "query",
        "schema": {
          "type": "string"
        },
        "description": "Opaque cursor returned by the previous request"
      },
      "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": "Resource id — must be a UUID. A malformed id is rejected with 400 INVALID_UUID (it is not just a 404). Need a fresh one? Call GET /utils/uuid."
      }
    },
    "schemas": {
      "Campaign": {
        "type": "object",
        "description": "A message campaign (collection messages): a WhatsApp/SMS/Email broadcast. Lifecycle state INIT (draft) → VALIDATE (sent) → FINISHED. `targets`/`percentSuccess`/`percentError` are computed from the deliveries.",
        "properties": {
          "crmTarget": {
            "type": "object",
            "readOnly": true,
            "description": "Versioned contact-list/category targeting. Union by default; exclusions override inclusion. Backoffice review required before editing, preview or send."
          },
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "WHATSAPP",
              "SMS",
              "EMAIL",
              "WHATSAPP_OU_SMS",
              "WHATSAPP_OU_EMAIL",
              "WHATSAPP_OU_SMS_OU_EMAIL",
              "SMS_OU_EMAIL"
            ],
            "description": "Channel or fallback cascade."
          },
          "state": {
            "type": "string",
            "enum": [
              "INIT",
              "VALIDATE",
              "FINISHED"
            ],
            "readOnly": true,
            "description": "INIT = draft (editable); VALIDATE = sending/sent; FINISHED = done."
          },
          "subject": {
            "type": "string",
            "description": "Email subject (EMAIL channels)."
          },
          "message": {
            "type": "string",
            "description": "Message body (text, with {{firstname}}/{{lastname}}/{{hebrewname}} templating; legacy {{prenom}}/{{nom}}/{{prenomHE}} aliases remain supported)."
          },
          "emailContent": {
            "type": "string",
            "description": "Full HTML email body (alternative to emailTemplate)."
          },
          "emailTemplate": {
            "type": "string",
            "nullable": true,
            "description": "id of an email template (its HTML is loaded into emailContent at send time)."
          },
          "emailConfig": {
            "type": "string",
            "nullable": true,
            "description": "id of the email sending config to use (see GET /messaging-configs)."
          },
          "smsConfig": {
            "type": "string",
            "nullable": true,
            "description": "id of an SMS config — accepted for parity but IGNORED by the SMS daemon (mono-config per org)."
          },
          "whatsappAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Sending WhatsApp number id (required when type contains WHATSAPP)."
          },
          "allContact": {
            "type": "boolean",
            "description": "Targeting: all contacts."
          },
          "staredOnly": {
            "type": "boolean",
            "description": "Targeting: local/starred contacts (Proximité module)."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Targeting: contacts in any of these categories."
          },
          "familles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Legacy field, stored but NOT used for targeting."
          },
          "docs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignMedia"
            }
          },
          "videos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignMedia"
            }
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignLink"
            }
          },
          "prefix": {
            "type": "string"
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Send time (null = immediate after send)."
          },
          "datetime": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "targets": {
            "type": "integer",
            "readOnly": true,
            "description": "Number of deliveries (after send)."
          },
          "percentSuccess": {
            "type": "string",
            "readOnly": true
          },
          "percentError": {
            "type": "string",
            "readOnly": true
          }
        }
      },
      "CampaignMedia": {
        "type": "object",
        "description": "A campaign media item. `doc` is an http(s) URL (re-hosted on write) or a filename already hosted (e.g. returned by POST /uploads).",
        "properties": {
          "name": {
            "type": "string",
            "description": "Display label."
          },
          "doc": {
            "type": "string",
            "description": "http(s) URL (re-hosted) or hosted filename."
          }
        }
      },
      "CampaignLink": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "hasMore": {
            "type": "boolean"
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "CampaignInput": {
        "type": "object",
        "description": "Contact-list campaigns expose crmTarget for reading; editing, target preview and send require backoffice review (CONTACT_LIST_REVIEW_REQUIRED). New crmTarget writes are rejected by this API. Create or update a message campaign. Targeting is MUTUALLY EXCLUSIVE: set exactly one of `allContact`, `staredOnly` or `categories`.\nWhen `type` contains WHATSAPP, `whatsappAccountId` is REQUIRED and must be a connected number (see GET /whatsapp-accounts).\nMedia (`docs`/`videos`): each item's `doc` may be an http(s) URL (re-hosted) or a filename returned by POST /uploads.\nA campaign is created in state INIT (draft); editing is only allowed while INIT. Sending is a separate action (POST /{id}/send, scope messages:send).",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "WHATSAPP",
              "SMS",
              "EMAIL",
              "WHATSAPP_OU_SMS",
              "WHATSAPP_OU_EMAIL",
              "WHATSAPP_OU_SMS_OU_EMAIL",
              "SMS_OU_EMAIL"
            ],
            "description": "Required on create."
          },
          "whatsappAccountId": {
            "type": "string",
            "description": "Required when type contains WHATSAPP."
          },
          "subject": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "emailContent": {
            "type": "string"
          },
          "emailTemplate": {
            "type": "string",
            "description": "id of an existing email template."
          },
          "emailConfig": {
            "type": "string",
            "description": "id of an existing email config (GET /messaging-configs)."
          },
          "smsConfig": {
            "type": "string",
            "description": "id of an SMS config (accepted but ignored by the daemon)."
          },
          "allContact": {
            "type": "boolean"
          },
          "staredOnly": {
            "type": "boolean"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "familles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "docs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignMedia"
            }
          },
          "videos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignMedia"
            }
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignLink"
            }
          },
          "prefix": {
            "type": "string"
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "CampaignTargets": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Number of recipients the targeting resolves to."
          }
        }
      },
      "CampaignTestInput": {
        "type": "object",
        "required": [
          "contactId"
        ],
        "properties": {
          "contactId": {
            "type": "string",
            "description": "Contact to send the test to."
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Format: `ke_live_xxx`"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
```
