Skip to content

Docs

schedule_versions

Schedule several channel versions of one content item in one action, after one confirmation: each item `{ postId, expectedVersion, when }`, `when` being "now", "queue" (the channel's next free queue slot) or an ISO 8601 time at least a minute ahead. `expectedVersion` is the `version` you showed (get_publish_plan); a version changed since is refused (`version_conflict`). Each version gets its own result and partial success is normal: one failing (`invalid_post`, `signoff_required`, `channel_unavailable`, `skipped`, `time_in_past`, `no_queue_slots`, `not_schedulable`...) never stops the others. `confirmationToken` is a fresh random id per confirmation: the same request again with it returns the first results (`replayed: true`) and never schedules twice; reused for a different request it is refused (`token_reused`). People put versions live directly. An agent without Autopilot on a version's channel only requests: timed versions wait in `awaiting_confirmation` for a person (`needsYouUrl`, `autopilotNotice` says why), and "now" is refused (`confirmation_required`). Follow each version with get_post_status.

Schedule several channel versions of one content item in one action, after one confirmation: each item { postId, expectedVersion, when }, when being "now", "queue" (the channel's next free queue slot) or an ISO 8601 time at least a minute ahead. expectedVersion is the version you showed (get_publish_plan); a version changed since is refused (version_conflict). Each version gets its own result and partial success is normal: one failing (invalid_post, signoff_required, channel_unavailable, skipped, time_in_past, no_queue_slots, not_schedulable...) never stops the others. confirmationToken is a fresh random id per confirmation: the same request again with it returns the first results (replayed: true) and never schedules twice; reused for a different request it is refused (token_reused). People put versions live directly. An agent without Autopilot on a version's channel only requests: timed versions wait in awaiting_confirmation for a person (needsYouUrl, autopilotNotice says why), and "now" is refused (confirmation_required). Follow each version with get_post_status.

A human confirms the result in heyeveryone's Updates unless a workspace owner put this agent on Autopilot for the post's channel (see whoami).

Access and cost

  • Kind: mutation
  • Scope: workspace
  • Actors: member, agent
  • Credits: Free
  • Requires confirmation: true
  • Accepts idempotency key: false

Input schema

{
  "properties": {
    "workspaceId": {
      "format": "uuid",
      "type": "string"
    },
    "pieceId": {
      "format": "uuid",
      "type": "string"
    },
    "confirmationToken": {
      "pattern": "^[A-Za-z0-9_-]{8,128}$",
      "type": "string"
    },
    "versions": {
      "items": {
        "properties": {
          "postId": {
            "format": "uuid",
            "type": "string"
          },
          "expectedVersion": {
            "minimum": 1,
            "type": "integer"
          },
          "when": {
            "anyOf": [
              {
                "const": "now",
                "type": "string"
              },
              {
                "const": "queue",
                "type": "string"
              },
              {
                "format": "date-time",
                "type": "string"
              }
            ]
          }
        },
        "required": [
          "postId",
          "expectedVersion",
          "when"
        ],
        "type": "object"
      },
      "maxItems": 25,
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "workspaceId",
    "pieceId",
    "confirmationToken",
    "versions"
  ],
  "type": "object"
}

Output schema

{
  "additionalProperties": false,
  "properties": {
    "confirmationToken": {
      "type": "string"
    },
    "replayed": {
      "type": "boolean"
    },
    "results": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "postId": {
            "format": "uuid",
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "scheduled",
              "awaiting_confirmation",
              "unchanged"
            ],
            "type": "string"
          },
          "post": {
            "additionalProperties": false,
            "properties": {
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "workspaceId": {
                "format": "uuid",
                "type": "string"
              },
              "pieceId": {
                "format": "uuid",
                "type": "string"
              },
              "channelAccountId": {
                "format": "uuid",
                "type": "string"
              },
              "format": {
                "pattern": "^[a-z][a-z0-9_]*$",
                "type": "string"
              },
              "segments": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "text": {
                      "type": "string"
                    },
                    "media": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "mediaAssetId": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "altText": {
                            "maxLength": 2000,
                            "type": "string"
                          }
                        },
                        "required": [
                          "mediaAssetId"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "text",
                    "media"
                  ],
                  "type": "object"
                },
                "minItems": 1,
                "type": "array"
              },
              "settings": {
                "type": "object"
              },
              "state": {
                "enum": [
                  "draft",
                  "ready",
                  "awaiting_confirmation",
                  "scheduled",
                  "publishing",
                  "published",
                  "failed_retrying",
                  "needs_attention",
                  "failed",
                  "manual",
                  "removed"
                ],
                "type": "string"
              },
              "scheduledAt": {
                "anyOf": [
                  {
                    "format": "date-time",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "scheduleSource": {
                "anyOf": [
                  {
                    "enum": [
                      "manual",
                      "queue",
                      "recurrence",
                      "evergreen"
                    ],
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isSkipped": {
                "type": "boolean"
              },
              "version": {
                "minimum": 1,
                "type": "integer"
              },
              "followsOriginal": {
                "type": "boolean"
              },
              "followIssue": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "requestedByAgentClientId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "confirmedByAccountId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "confirmedAt": {
                "anyOf": [
                  {
                    "format": "date-time",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastError": {
                "anyOf": [
                  {
                    "additionalProperties": false,
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      },
                      "fix": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "message"
                    ],
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "publishedAt": {
                "anyOf": [
                  {
                    "format": "date-time",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "permalink": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdByAccountId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdByAgentClientId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "format": "date-time",
                "type": "string"
              },
              "updatedAt": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "workspaceId",
              "pieceId",
              "channelAccountId",
              "format",
              "segments",
              "settings",
              "state",
              "scheduledAt",
              "scheduleSource",
              "isSkipped",
              "version",
              "followsOriginal",
              "followIssue",
              "requestedByAgentClientId",
              "confirmedByAccountId",
              "confirmedAt",
              "lastError",
              "publishedAt",
              "permalink",
              "createdByAccountId",
              "createdByAgentClientId",
              "createdAt",
              "updatedAt"
            ],
            "type": "object"
          },
          "scheduledAt": {
            "format": "date-time",
            "type": "string"
          },
          "queued": {
            "type": "boolean"
          },
          "needsConfirmation": {
            "type": "boolean"
          },
          "autopilotNotice": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "postId",
          "ok",
          "idempotencyKey"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "summary": {
      "additionalProperties": false,
      "properties": {
        "requested": {
          "minimum": 0,
          "type": "integer"
        },
        "succeeded": {
          "minimum": 0,
          "type": "integer"
        },
        "failed": {
          "minimum": 0,
          "type": "integer"
        },
        "needsConfirmation": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "requested",
        "succeeded",
        "failed",
        "needsConfirmation"
      ],
      "type": "object"
    },
    "needsYouUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "url": {
      "description": "The content page in heyeveryone. Give it to the person so they can open the draft.",
      "type": "string"
    }
  },
  "required": [
    "confirmationToken",
    "replayed",
    "results",
    "summary",
    "needsYouUrl"
  ],
  "type": "object"
}

Errors

[
  "token_reused"
]

Annotations

{
  "destructiveHint": true,
  "idempotentHint": true,
  "openWorldHint": true,
  "readOnlyHint": false,
  "title": "Schedule or post several channel versions"
}