API Docs

Complete campaigns

Create copy, a WhatsApp-ready draft, and optional image and speech assets in one idempotent request.

POST/campaigns

Arabic campaign with image and speech

Creates three copy variants, a WhatsApp draft, an image, and speech in one operation. Maximum cost is 12 credits.

curl --request POST \
  --url https://www.lahjty.com/api/v1/campaigns \
  --header "Authorization: Bearer $LAHJTY_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: campaign-merchant91-1849" \
  --data '{
  "external_id": "campaign-1849",
  "external_customer_id": "merchant-91",
  "brief": {
    "description": "Weekend offer for a specialty coffee subscription",
    "product": "Monthly specialty coffee subscription",
    "offer": "20% off through Saturday",
    "objective": "Drive WhatsApp orders",
    "output_language": "ar",
    "market": "SA",
    "dialect": "saudi",
    "platform": "whatsapp",
    "tone": "warm",
    "audience": "specific",
    "specific_audience": "Young professionals in Riyadh",
    "required_keywords": [
      "قهوة مختصة"
    ],
    "excluded_keywords": [
      "مجاني"
    ],
    "call_to_action": "اطلب الآن"
  },
  "deliverables": {
    "copy": {
      "type": "ad_copy",
      "framework": "aida"
    },
    "image": {
      "enabled": true,
      "type": "product_showcase",
      "style": "photorealistic",
      "aspect_ratio": "1:1",
      "resolution": "1K",
      "visual_keywords": [
        "specialty coffee",
        "Riyadh morning"
      ],
      "excluded_visuals": [
        "people",
        "logos"
      ],
      "include_text": false
    },
    "speech": {
      "enabled": true,
      "voice_profile": "confident_announcer",
      "delivery": "natural",
      "content_type": "marketing"
    }
  },
  "metadata": {
    "experiment": "repeat-use-pilot"
  }
}'

Example response

response.json
{
  "id": "cmp_01jexample",
  "object": "campaign",
  "request_id": "req_01jexample",
  "status": "completed",
  "external_id": "campaign-1849",
  "output_language": "ar",
  "market": "SA",
  "dialect": "saudi",
  "copy": {
    "variants": [
      {
        "index": 1,
        "content": "..."
      }
    ]
  },
  "whatsapp_template": {
    "status": "draft",
    "header": "خصم 20٪ حتى السبت",
    "body": "...",
    "footer": null,
    "buttons": [
      {
        "type": "quick_reply",
        "text": "اطلب الآن"
      }
    ],
    "warnings": [
      "This convenience draft is not a Meta submission payload."
    ]
  },
  "image": {
    "url": "https://example.convex.cloud/api/storage/image"
  },
  "speech": {
    "url": "https://example.convex.cloud/api/storage/audio"
  },
  "usage": {
    "credits_used": 12,
    "balance_after": 476
  }
}
POST/campaigns

Copy-only campaign

Disable image and speech for the lowest-risk two-credit pilot flow.

curl --request POST \
  --url https://www.lahjty.com/api/v1/campaigns \
  --header "Authorization: Bearer $LAHJTY_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: campaign-copy-only-1850" \
  --data '{
  "external_id": "campaign-1850",
  "external_customer_id": "merchant-93",
  "brief": {
    "description": "Back-to-school stationery sale",
    "output_language": "en",
    "market": "AE",
    "platform": "whatsapp",
    "tone": "friendly",
    "call_to_action": "Shop the collection"
  },
  "deliverables": {
    "copy": {
      "type": "ad_copy",
      "framework": "aida"
    },
    "image": {
      "enabled": false
    },
    "speech": {
      "enabled": false
    }
  }
}'

Partial failure behavior

The campaign operation is billed for the requested deliverables and refunds on generation failure according to the API contract. Keep the merchant's prior plain text available until the complete response is stored.