# Email campaigns from your code (/docs/automations/email-campaigns/api)

Authenticated with `?privateKey=YOUR_KEY` (see [Authentication](/docs/authentication)).

<Endpoints ops={["POST /admin/automations", "GET /admin/automations", "PATCH /admin/automations/{id}", "GET /admin/email-campaigns"]} />

<ApiPlayground
  method="post"
  path="/admin/automations"
  tool="create_automation"
  args={`{
  "name": "Docs example: send-to-emailCampaign",
  "isActive": true,
  "website": "64b7f0a1c2d3e4f5a6b7c8d9",
  "when": "new-lead-is-identified",
  "then": "send-to-emailCampaign",
  "interval": "immediately",
  "actions": {
    "sentToEmailCampaign": {
      "emailCampaign": "6a3f00000000000000000004"
    }
  }
}`}
/>

## Use case: Find the campaign [#use-case-find-the-campaign]

`GET /admin/email-campaigns` lists your campaigns; use one's `_id` as `emailCampaign`.
