Create Campaign
Groups existing short links around a goal so you can track clicks, unique visitors, or compare channels. Campaigns are available on paid plans and always start as ACTIVE.
Send a name, a goal, and at least one link slug you own. Use templateKey to apply a known template. The API stores that key plus a typed goal.config — for example windowDays on a bio campaign.
Send Authorization: Bearer sk_api_your_api_key on every request. See authentication.
Request body
The body must be JSON. Extra keys are rejected. Dates use ISO 8601.
Fields for creating a campaign
| Field | Type | Description |
|---|---|---|
name | string | Required. Campaign name. 1–100 characters. |
goalType | string | Required. One of CLICKS, UNIQUE_VISITORS, or COMPARE. Must match the template when that template locks the goal type. |
goalTarget | number | Target value, at least 1. Required for CLICKS and UNIQUE_VISITORS unless goalConfig.target is set. Not used for COMPARE. |
linkSlugs | string[] | Required. Slugs of links you own. At least one. |
description | string | Optional short description. Max 500 characters. |
templateKey | string | One of blank, general-clicks, channel-test, content-drop, bio-evergreen, qr-offline, or launch. Unknown values are rejected. Omit it to skip template defaults. |
goalConfig | object | Typed goal settings. Shape depends on goalType. Extra keys are rejected. See the table below. |
startsAt | string | ISO 8601 start date. Required for launch. |
endsAt | string | ISO 8601 end date. Required for launch. Not allowed for bio-evergreen. |
Goal config
If you send goalConfig, it must match goalType. If you omit it and send a known template, the API fills in the template default.
Allowed goalConfig fields
| Field | Type | Description |
|---|---|---|
target | number | Goal value, at least 1. Used by CLICKS and UNIQUE_VISITORS. |
windowDays | number | Rolling click window, 1–365. CLICKS only. Bio template default is 30. |
burstDays | number | Burst window, 1–90. UNIQUE_VISITORS only. Content-drop default is 7. |
metric | string | CLICKS or UNIQUE_VISITORS. COMPARE only. Channel-test default is CLICKS. |
Example request
This creates a bio campaign with a 10,000 click goal. Because templateKey is bio-evergreen and goalConfig is omitted, the stored config includes windowDays: 30.
Success response
Returns 201 Created with the new campaign, including templateKey, typed goal.config, attached links, and current progress.
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Campaign UUID. |
status | string | Always ACTIVE on create. |
goal.config | object | Typed settings for the stored goal. |
progress | object | Current vs target. percent is 0–100. reached is true when the target is met. |
links | object[] | Attached short links with slug, alias, and destination URL. |
Errors
| Status | Error | Description |
|---|---|---|
| 400 | Bad Request | Validation failed, a slug is unknown, or a template rule was broken. |
| 401 | Unauthorized | Missing, malformed, or invalid Bearer token. |
| 403 | Forbidden | Campaigns are not available on the current plan. |
| 429 | Too Many Requests | More than 10 requests per minute or 50 requests per day. |
| 500 | Internal Server Error | Unexpected server error. Retry the request. |