# Create a campaign

A campaign without a LinkedIn sequence, to group rows and emails: an email pilot, a weekly batch. The same name returns the existing campaign (`created: false`), so this is also how you find its id again. Put rows in it with `campaign_id` on POST /tables/* or PATCH, and pass `campaign_id` when you log an email. It does not count toward the limit on running LinkedIn campaigns.

## Authentication

Send `Authorization: Bearer gtk_…`. Create the key under **Connect assistant → API keys**. Every `gtk_` key can call these routes, also while the Signals API is closed. A missing, invalid or revoked key is **401**.

### Body parameters

- **`name`** `string` · **required** — As the user sees it, up to 80 characters.

## Response

- **`id`** `string` · **required** — The campaign id.
- **`name`** `string` · **required** — Its name.
- **`status`** `string` · **required** — `active`.
- **`channel`** `string` · **required** — `email` for a campaign made here.
- **`created_at`** `string` · **required** — When it was made.
- **`created`** `boolean` · **required** — False when a campaign with this name existed.
- **`dashboard_url`** `string` · **required** — Leads in mySDR, on this campaign.

## Credits

Free. This call never uses credits.

## Errors

- **400** `invalid_request` — No `name`, or longer than 80 characters.
- **409** `invalid_state` — The key has no user behind it, so mySDR cannot record who did it.
- **401** `authentication_error` — The Authorization header is missing, or the key is unknown or revoked.
- **403** `permission_error` — API access is not part of your plan, or your account is suspended.
- **429** `rate_limit_error` — More than 60 requests per minute, or more than 3 at the same time, on one key. Wait for the Retry-After header.
- **503** `service_unavailable` — The API is temporarily unavailable. Retry later.
- **500** `internal_error` — Something went wrong on our side.

## Example

### cURL

```bash
curl -X POST "https://mysdr.app/api/v1/outreach/campaigns" \
  -H "Authorization: Bearer $MYSDR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Email pilot – Belgium"
  }'
```

### JavaScript

```javascript
const response = await fetch('https://mysdr.app/api/v1/outreach/campaigns', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MYSDR_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "name": "Email pilot – Belgium"
  })
});
const body = await response.json();
```

### Python

```python
import json
import os
import urllib.request

payload = {
  "name": "Email pilot – Belgium"
}

request = urllib.request.Request(
    "https://mysdr.app/api/v1/outreach/campaigns",
    headers={
    "Authorization": f"Bearer {os.environ['MYSDR_API_KEY']}",
    "Content-Type": "application/json"
    },
    data=json.dumps(payload).encode(),
    method="POST",
)
with urllib.request.urlopen(request) as response:
    body = json.load(response)
```

### Example response

```json
{
  "id": "5e0c1a2b-3d4e-4f50-8a61-7b8c9d0e1f23",
  "name": "Email pilot – Belgium",
  "status": "active",
  "channel": "email",
  "created_at": "2026-10-19T08:00:00.000Z",
  "created": true,
  "dashboard_url": "https://mysdr.app/en/gtm/leads?campaign=5e0c1a2b-3d4e-4f50-8a61-7b8c9d0e1f23"
}
```
