Skip to content

Campaigns API

Campaign management endpoints for organizing your tabletop RPG content.

Get all campaigns for the authenticated user.

Response:

[
{
"id": 1,
"slug": "lost-mine-of-phandelver",
"name": "Lost Mine of Phandelver",
"description": null,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:15:00Z",
"userId": "user_123"
}
]

Create a new campaign.

Request Body:

{
"newCampaign": {
"name": "Dragon Heist Campaign"
}
}

Response:

{
"id": 2,
"slug": "dragon-heist-campaign",
"name": "Dragon Heist Campaign",
"description": null,
"createdAt": "2024-01-21T09:00:00Z",
"updatedAt": "2024-01-21T09:00:00Z",
"userId": "user_123"
}

Get a specific campaign by slug.

Parameters:

  • campaignSlug (string) - URL-safe campaign identifier

Response:

{
"id": 1,
"slug": "lost-mine-of-phandelver",
"name": "Lost Mine of Phandelver",
"description": [
{
"type": "paragraph",
"children": [{ "text": "A classic D&D starter adventure..." }]
}
],
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:15:00Z",
"userId": "user_123"
}

Update an existing campaign.

Request Body:

{
"updatedCampaign": {
"slug": "lost-mine-of-phandelver",
"name": "Lost Mine of Phandelver - Updated",
"description": "Updated description"
}
}

Delete a campaign and all associated data.

Response:

{
"success": true
}
  • Campaign slugs are automatically generated from names
  • Deleting a campaign cascades to all associated arcs, things, and relationships
  • Campaign ownership is enforced - users can only access their own campaigns