# POST /schedule_versions

Source: https://heyeveryone.ai/docs/api/schedule_versions

> https://heyeveryone.ai/api/v1/schedule_versions

## Operation

```json
{
  "post": {
    "description": "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.\n\nA human confirms the result in heyeveryone's Updates unless a workspace owner put this agent on Autopilot for the post's channel (see whoami).",
    "operationId": "schedule_versions",
    "requestBody": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "workspaceId": {
                "format": "uuid",
                "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})$",
                "type": "string"
              },
              "pieceId": {
                "format": "uuid",
                "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})$",
                "type": "string"
              },
              "confirmationToken": {
                "pattern": "^[A-Za-z0-9_-]{8,128}$",
                "type": "string"
              },
              "versions": {
                "items": {
                  "properties": {
                    "postId": {
                      "format": "uuid",
                      "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})$",
                      "type": "string"
                    },
                    "expectedVersion": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "when": {
                      "anyOf": [
                        {
                          "const": "now",
                          "type": "string"
                        },
                        {
                          "const": "queue",
                          "type": "string"
                        },
                        {
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                          "type": "string"
                        }
                      ]
                    }
                  },
                  "required": [
                    "postId",
                    "expectedVersion",
                    "when"
                  ],
                  "type": "object"
                },
                "maxItems": 25,
                "minItems": 1,
                "type": "array"
              }
            },
            "required": [
              "workspaceId",
              "pieceId",
              "confirmationToken",
              "versions"
            ],
            "type": "object"
          }
        }
      },
      "required": true
    },
    "responses": {
      "200": {
        "content": {
          "application/json": {
            "schema": {
              "additionalProperties": false,
              "properties": {
                "confirmationToken": {
                  "type": "string"
                },
                "replayed": {
                  "type": "boolean"
                },
                "results": {
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "postId": {
                        "format": "uuid",
                        "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})$",
                        "type": "string"
                      },
                      "ok": {
                        "type": "boolean"
                      },
                      "status": {
                        "enum": [
                          "scheduled",
                          "awaiting_confirmation",
                          "unchanged"
                        ],
                        "type": "string"
                      },
                      "post": {
                        "additionalProperties": false,
                        "properties": {
                          "id": {
                            "format": "uuid",
                            "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})$",
                            "type": "string"
                          },
                          "workspaceId": {
                            "format": "uuid",
                            "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})$",
                            "type": "string"
                          },
                          "pieceId": {
                            "format": "uuid",
                            "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})$",
                            "type": "string"
                          },
                          "channelAccountId": {
                            "format": "uuid",
                            "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})$",
                            "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",
                                        "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})$",
                                        "type": "string"
                                      },
                                      "altText": {
                                        "maxLength": 2000,
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "mediaAssetId"
                                    ],
                                    "type": "object"
                                  },
                                  "type": "array"
                                }
                              },
                              "required": [
                                "text",
                                "media"
                              ],
                              "type": "object"
                            },
                            "minItems": 1,
                            "type": "array"
                          },
                          "settings": {
                            "additionalProperties": {},
                            "propertyNames": {
                              "type": "string"
                            },
                            "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",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "scheduleSource": {
                            "anyOf": [
                              {
                                "enum": [
                                  "manual",
                                  "queue",
                                  "recurrence",
                                  "evergreen"
                                ],
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "isSkipped": {
                            "type": "boolean"
                          },
                          "version": {
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991,
                            "type": "integer"
                          },
                          "followsOriginal": {
                            "type": "boolean"
                          },
                          "followIssue": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "requestedByAgentClientId": {
                            "anyOf": [
                              {
                                "format": "uuid",
                                "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})$",
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "confirmedByAccountId": {
                            "anyOf": [
                              {
                                "format": "uuid",
                                "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})$",
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "confirmedAt": {
                            "anyOf": [
                              {
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                                "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",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "permalink": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdByAccountId": {
                            "anyOf": [
                              {
                                "format": "uuid",
                                "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})$",
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdByAgentClientId": {
                            "anyOf": [
                              {
                                "format": "uuid",
                                "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})$",
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                            "type": "string"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                            "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",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                        "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": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "succeeded": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "failed": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "needsConfirmation": {
                      "maximum": 9007199254740991,
                      "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"
            }
          }
        },
        "description": "Success"
      },
      "400": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "invalid_input: the body does not match the schema"
      },
      "401": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "unauthenticated: missing, invalid, expired or revoked token"
      },
      "403": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "forbidden: the agent may not do this (for example, another workspace)"
      },
      "404": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "not_found"
      },
      "409": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "conflict"
      },
      "422": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Service-specific errors: token_reused"
      },
      "429": {
        "$ref": "#/components/responses/RateLimited"
      },
      "500": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "internal_error"
      }
    },
    "summary": "Schedule or post several channel versions",
    "tags": [
      "workspace"
    ],
    "x-heyeveryone-kind": "mutation",
    "x-heyeveryone-requires-confirmation": true
  }
}
```

## Referenced definitions

```json
{
  "schemas": {
    "Error": {
      "properties": {
        "error": {
          "description": "A stable error code, for example forbidden.",
          "type": "string"
        },
        "message": {
          "description": "What went wrong, in plain words.",
          "type": "string"
        }
      },
      "required": [
        "error",
        "message"
      ],
      "type": "object"
    }
  },
  "responses": {
    "RateLimited": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "description": "rate_limited: too many requests from this agent, account or address (docs/setup/agents.md, Rate limits); wait the Retry-After seconds, then retry",
      "headers": {
        "Retry-After": {
          "description": "Seconds to wait before retrying.",
          "schema": {
            "minimum": 1,
            "type": "integer"
          }
        }
      }
    }
  }
}
```

## Authentication

```json
{
  "bearer": {
    "description": "Personal access token (hey_pat_...)",
    "scheme": "bearer",
    "type": "http"
  },
  "oauth": {
    "flows": {
      "authorizationCode": {
        "authorizationUrl": "https://heyeveryone.ai/oauth/authorize",
        "refreshUrl": "https://heyeveryone.ai/oauth/token",
        "scopes": {
          "agent": "Act as your agent in the workspaces you choose"
        },
        "tokenUrl": "https://heyeveryone.ai/oauth/token"
      }
    },
    "type": "oauth2"
  }
}
```

## Security requirements

```json
[
  {
    "bearer": []
  },
  {
    "oauth": [
      "agent"
    ]
  }
]
```
