Back to Content Management API

scheduleAddContent

Adds content to a schedule by ID.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the schedule.

  • Name
    input
    Type
    AddContentToScheduleInput!
    Description

    An object.

    • content: [ContentToSchedule!]!

    The ContentToSchedule object format is:

    • contentId: ID!
    • contentType: ContentType!
    • action: String publish or unpublish

Returns

  • Name
    Schedule.*
    Type
    Schedule
    Description

    Any requested field from the Schedule object.

Request

import { PackClient } from '@pack/client'
const packClient = new PackClient({
  token: 'YOUR-PACK-TOKEN'
});

const query = `
  mutation ScheduleAddContent($id: ID!, $input: AddContentToScheduleInput!) {
    scheduleAddContent(id: $id, input: $input) {
      id
      title
      description
      executeAt
      timezone
      state
      content {
        __typename
        ... on Page {
          id
          title
          handle
        }
        ... on Section {
          id
          title
        }
      }
    }
  }
`;

const variables = {
  id: 'YOUR-SCHEDULE-ID',
  input: {
    content: [
      { contentId: 'YOUR-SECTION-ID', contentType: 'section', action: 'publish' }
    ]
  }
};

const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "scheduleAddContent": {
            "id": "YOUR-SCHEDULE-ID",
            "title": "Holiday launch",
            "description": "Publish the holiday homepage and hero section",
            "executeAt": "2026-11-27T08:00:00Z",
            "timezone": "America/New_York",
            "state": "scheduled",
            "content": [
                {
                    "__typename": "Page",
                    "id": "YOUR-PAGE-ID",
                    "title": "Holiday Homepage",
                    "handle": "holiday"
                },
                {
                    "__typename": "Section",
                    "id": "YOUR-SECTION-ID",
                    "title": "Holiday Hero"
                }
            ]
        }
    }
}

Was this page helpful?