POST
/
v1
/
teams
/
{teamId}
/
campaigns
TypeScript client
import { OctosparkClient } from '@octospark/sdk'

const client = new OctosparkClient({
  token: process.env.OCTOSPARK_TOKEN
})

const response = await client.campaigns.createCampaign({
  teamId: process.env.OCTOSPARK_TEAM_ID ?? "teamId",
  body: {},
})
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "description": "<string>",
  "agents": [
    {
      "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "currentVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "archived": true,
      "prompt": "<string>",
      "instructions": "<string>",
      "perRunCreditCeilingDecimillicents": 123,
      "maxPostsPerRun": 123,
      "addedAt": "<string>",
      "promptRevision": 123,
      "targetSocialAccountIds": [
        "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      ],
      "effectivePerRunCreditCeilingDecimillicents": 123
    }
  ],
  "workflowScheduleIds": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "createdAt": "<string>",
  "updatedAt": "<string>",
  "revision": 1,
  "effectiveDailyBudgetDecimillicents": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

idempotency-key
string

Reuse this key with the same creation request after a lost response. The original resource is returned; a different request is rejected with 409.

Required string length: 1 - 200

Path Parameters

teamId
string
required

Team (workspace) id (UUID). Discover ids via the list teams endpoint or the agent context.

Body

application/json
name
string
required

Campaign name, 1-120 characters, unique within the team.

Required string length: 1 - 120
accountPostingLimits
maxItems(1000) · object[]

Optional changed account limits to save atomically with this configuration. Accounts must be distinct selected destinations of this workspace. A nonempty array additionally requires manage_integrations. Any invalid, stale or unsafe reduction rejects every change. Omit or send [] to leave all shared limits unchanged.

Maximum array length: 1000
configurationVersion
enum<number>

Use version 2 for the simplified campaign model; legacy clients may omit this while they upgrade.

Available options:
1,
2
description
string | null

Legacy optional description retained for API compatibility. Campaign setup uses the campaign name only.

Maximum string length: 2000
agents
maxItems(50) · object[]

an array of at most 50 item(s)

Maximum array length: 50
schedule
object

The campaign’s single shared schedule, created atomically and always paused. Omit for a paused 09:00-18:00 UTC window with one daily run, max concurrency 1 and no daily limit or targets.

agentIds
string<uuid>[]

Managed agents of this team to add to the campaign, up to 50. Omit to start empty.

Maximum array length: 50

a Universally Unique Identifier

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}$

Response

Success

id
string<uuid>
required

a Universally Unique Identifier

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}$
teamId
string<uuid>
required

a Universally Unique Identifier

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}$
name
string
required

Campaign name, 1-120 characters, unique within the team.

Required string length: 1 - 120
description
string | null
required

Legacy optional description retained for API compatibility. Campaign setup uses the campaign name only.

Maximum string length: 2000
agents
object[]
required

Managed agents in the campaign (the optimiser pool).

workflowScheduleIds
string<uuid>[]
required

The canonical optimised schedule for a managed campaign. Legacy campaigns may have multiple attachments until explicitly reconciled.

a Universally Unique Identifier

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}$
createdBy
string<uuid>
required

a Universally Unique Identifier

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}$
createdAt
string
required
updatedAt
string
required
revision
integer

a non-negative number

Required range: x >= 0
configurationVersion
enum<number>

Version 1 preserves legacy scheduling and optimiser behaviour. Version 2 uses explicit account bundles, shared posting caps and automatic exploration.

Available options:
1,
2
effectiveDailyBudgetDecimillicents
number | null