API Docs

Content Versions API

Content versions define prompt templates and output format (single or multi) used to generate content pieces from a submission.

Endpoints

  • GET /api/v1/campaigns/:campaign_id/content_versions
  • POST /api/v1/campaigns/:campaign_id/content_versions
  • GET /api/v1/content_versions/:id
  • PATCH /api/v1/content_versions/:id

Delete: there is currently no DELETE /api/v1/content_versions/:id endpoint.

Filtering, Sorting, Include

  • Filters: name, output_type, active, position, campaign_id
  • Sort fields: id, name, output_type, active, position, created_at, updated_at
  • Include: campaign
  • Valid output_type values: single, multi

GET /api/v1/campaigns/:campaign_id/content_versions

curl -X GET "https://cases.shipmentbot.com/api/v1/campaigns/2/content_versions?filter[active]=true&sort=position" \
  -H "Accept: application/json" \
  -H "X-API-Key: csb_live_your_token_here"
{
  "data": [
    {
      "id": "7",
      "type": "content_versions",
      "attributes": {
        "name": "LinkedIn Single",
        "prompt_template": "Write a concise SPIN-style LinkedIn post from submission data.",
        "output_type": "single",
        "position": 0,
        "active": true,
        "created_at": "2026-03-02T09:17:00.000Z",
        "updated_at": "2026-03-02T09:17:00.000Z"
      },
      "relationships": {
        "campaign": {
          "links": {
            "self": "https://cases.shipmentbot.com/api/v1/content_versions/7/relationships/campaign",
            "related": "https://cases.shipmentbot.com/api/v1/campaigns/2"
          },
          "data": { "id": "2", "type": "campaigns" }
        }
      },
      "links": {
        "self": "https://cases.shipmentbot.com/api/v1/content_versions/7"
      }
    }
  ],
  "included": [],
  "links": {
    "self": "https://cases.shipmentbot.com/api/v1/campaigns/2/content_versions?page%5Bnumber%5D=1&page%5Bsize%5D=25",
    "first": "https://cases.shipmentbot.com/api/v1/campaigns/2/content_versions?page%5Bnumber%5D=1&page%5Bsize%5D=25",
    "last": "https://cases.shipmentbot.com/api/v1/campaigns/2/content_versions?page%5Bnumber%5D=1&page%5Bsize%5D=25",
    "next": null,
    "prev": null
  },
  "meta": {
    "page": {
      "number": 1,
      "size": 25,
      "total_records": 1,
      "total_pages": 1
    }
  }
}

POST /api/v1/campaigns/:campaign_id/content_versions

curl -X POST "https://cases.shipmentbot.com/api/v1/campaigns/2/content_versions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: csb_live_your_token_here" \
  -d '{
    "data": {
      "type": "content_versions",
      "attributes": {
        "name": "5-Slide Carousel",
        "prompt_template": "Generate five concise carousel cards based on SPIN.",
        "output_type": "multi",
        "position": 1,
        "active": true
      }
    }
  }'
{
  "data": {
    "id": "8",
    "type": "content_versions",
    "attributes": {
      "name": "5-Slide Carousel",
      "prompt_template": "Generate five concise carousel cards based on SPIN.",
      "output_type": "multi",
      "position": 1,
      "active": true,
      "created_at": "2026-03-05T18:50:00.000Z",
      "updated_at": "2026-03-05T18:50:00.000Z"
    },
    "relationships": {
      "campaign": {
        "links": {
          "self": "https://cases.shipmentbot.com/api/v1/content_versions/8/relationships/campaign",
          "related": "https://cases.shipmentbot.com/api/v1/campaigns/2"
        },
        "data": { "id": "2", "type": "campaigns" }
      }
    },
    "links": {
      "self": "https://cases.shipmentbot.com/api/v1/content_versions/8"
    }
  },
  "included": [],
  "links": {
    "self": "https://cases.shipmentbot.com/api/v1/content_versions/8"
  },
  "meta": {}
}

GET /api/v1/content_versions/:id

curl -X GET "https://cases.shipmentbot.com/api/v1/content_versions/8?include=campaign" \
  -H "Accept: application/json" \
  -H "X-API-Key: csb_live_your_token_here"
{
  "data": {
    "id": "8",
    "type": "content_versions",
    "attributes": {
      "name": "5-Slide Carousel",
      "prompt_template": "Generate five concise carousel cards based on SPIN.",
      "output_type": "multi",
      "position": 1,
      "active": true,
      "created_at": "2026-03-05T18:50:00.000Z",
      "updated_at": "2026-03-05T18:50:00.000Z"
    },
    "relationships": {
      "campaign": {
        "links": {
          "self": "https://cases.shipmentbot.com/api/v1/content_versions/8/relationships/campaign",
          "related": "https://cases.shipmentbot.com/api/v1/campaigns/2"
        },
        "data": { "id": "2", "type": "campaigns" }
      }
    },
    "links": {
      "self": "https://cases.shipmentbot.com/api/v1/content_versions/8"
    }
  },
  "included": [],
  "links": {
    "self": "https://cases.shipmentbot.com/api/v1/content_versions/8?include=campaign"
  },
  "meta": {}
}

PATCH /api/v1/content_versions/:id

curl -X PATCH "https://cases.shipmentbot.com/api/v1/content_versions/8" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: csb_live_your_token_here" \
  -d '{
    "data": {
      "type": "content_versions",
      "id": "8",
      "attributes": {
        "name": "5-Slide Carousel (Paused)",
        "active": false,
        "position": 2
      }
    }
  }'
{
  "data": {
    "id": "8",
    "type": "content_versions",
    "attributes": {
      "name": "5-Slide Carousel (Paused)",
      "prompt_template": "Generate five concise carousel cards based on SPIN.",
      "output_type": "multi",
      "position": 2,
      "active": false,
      "created_at": "2026-03-05T18:50:00.000Z",
      "updated_at": "2026-03-05T18:51:21.000Z"
    },
    "relationships": {
      "campaign": {
        "links": {
          "self": "https://cases.shipmentbot.com/api/v1/content_versions/8/relationships/campaign",
          "related": "https://cases.shipmentbot.com/api/v1/campaigns/2"
        },
        "data": { "id": "2", "type": "campaigns" }
      }
    },
    "links": {
      "self": "https://cases.shipmentbot.com/api/v1/content_versions/8"
    }
  },
  "included": [],
  "links": {
    "self": "https://cases.shipmentbot.com/api/v1/content_versions/8"
  },
  "meta": {}
}

Error Examples

404 Content Version Not Found

{
  "data": null,
  "included": [],
  "links": {
    "self": "https://cases.shipmentbot.com/api/v1/content_versions/999999"
  },
  "meta": {},
  "errors": [
    {
      "status": "404",
      "title": "Not Found",
      "detail": "Content version not found"
    }
  ]
}

422 Validation Error

{
  "data": null,
  "included": [],
  "links": {
    "self": "https://cases.shipmentbot.com/api/v1/campaigns/2/content_versions"
  },
  "meta": {},
  "errors": [
    {
      "status": "422",
      "title": "Validation Error",
      "detail": "Output type is not included in the list",
      "source": {
        "pointer": "/data/attributes/output_type"
      }
    }
  ]
}