# POST /get_publish_plan

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

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

## Operation

```json
{
  "post": {
    "description": "Everything needed to schedule a content item, per channel version: account, current `version` (pass as `expectedVersion` to schedule_versions), checks as `errors` (block) and `warnings`, the approval state (`voided` when edited after approval), state and time, next free queue slot, and whether it can be scheduled (`schedule`) or posted now (`postNow`) with reasons. `schedule.needsConfirmation`: an agent without Autopilot on that channel only asks a person. Approval is a state: with approval required, a version without approval of its current text can't be scheduled (`signoff_required`). `nearDuplicates`: similar text on the channel in the last 30 days or scheduled (warning only; tell the person). X versions warn `x_allowance`; the plan can block (`x_allowance`, `plan_limit_reached`). `rules` explains it in plain words: tell the person. `url` opens the content page. Read-only; act with schedule_versions.",
    "operationId": "get_publish_plan",
    "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"
              }
            },
            "required": [
              "workspaceId",
              "pieceId"
            ],
            "type": "object"
          }
        }
      },
      "required": true
    },
    "responses": {
      "200": {
        "content": {
          "application/json": {
            "schema": {
              "additionalProperties": false,
              "properties": {
                "piece": {
                  "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"
                    },
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "idea",
                        "drafting",
                        "in_review",
                        "scheduled",
                        "published"
                      ],
                      "type": "string"
                    },
                    "signoffRequired": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "url": {
                      "description": "The content page in heyeveryone. Give it to the person so they can open the draft.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "status",
                    "signoffRequired",
                    "archived"
                  ],
                  "type": "object"
                },
                "timeZone": {
                  "type": "string"
                },
                "callerMayPublish": {
                  "type": "boolean"
                },
                "rules": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "versions": {
                  "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"
                      },
                      "url": {
                        "description": "The content page in heyeveryone. Give it to the person so they can open the draft.",
                        "type": "string"
                      },
                      "version": {
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer"
                      },
                      "state": {
                        "enum": [
                          "draft",
                          "ready",
                          "awaiting_confirmation",
                          "scheduled",
                          "publishing",
                          "published",
                          "failed_retrying",
                          "needs_attention",
                          "failed",
                          "manual",
                          "removed"
                        ],
                        "type": "string"
                      },
                      "isSkipped": {
                        "type": "boolean"
                      },
                      "format": {
                        "type": "string"
                      },
                      "formatLabel": {
                        "type": "string"
                      },
                      "channel": {
                        "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"
                          },
                          "platform": {
                            "enum": [
                              "x",
                              "linkedin",
                              "threads",
                              "bluesky",
                              "instagram",
                              "facebook",
                              "tiktok",
                              "youtube",
                              "sandbox"
                            ],
                            "type": "string"
                          },
                          "platformLabel": {
                            "type": "string"
                          },
                          "handle": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "displayName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "avatarUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "enum": [
                              "active",
                              "reconnect_required",
                              "disconnected"
                            ],
                            "type": "string"
                          },
                          "statusReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "platform",
                          "platformLabel",
                          "handle",
                          "displayName",
                          "avatarUrl",
                          "status",
                          "statusReason"
                        ],
                        "type": "object"
                      },
                      "preview": {
                        "type": "string"
                      },
                      "titles": {
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "key": {
                              "type": "string"
                            },
                            "label": {
                              "type": "string"
                            },
                            "value": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "key",
                            "label",
                            "value"
                          ],
                          "type": "object"
                        },
                        "type": "array"
                      },
                      "mediaCount": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "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"
                          }
                        ]
                      },
                      "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"
                          }
                        ]
                      },
                      "nextQueueSlot": {
                        "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"
                          }
                        ]
                      },
                      "checks": {
                        "additionalProperties": false,
                        "properties": {
                          "errors": {
                            "items": {
                              "additionalProperties": false,
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                },
                                "severity": {
                                  "enum": [
                                    "error",
                                    "warning"
                                  ],
                                  "type": "string"
                                },
                                "segmentIndex": {
                                  "maximum": 9007199254740991,
                                  "minimum": 0,
                                  "type": "integer"
                                },
                                "field": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "code",
                                "message",
                                "severity"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "warnings": {
                            "items": {
                              "additionalProperties": false,
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                },
                                "severity": {
                                  "enum": [
                                    "error",
                                    "warning"
                                  ],
                                  "type": "string"
                                },
                                "segmentIndex": {
                                  "maximum": 9007199254740991,
                                  "minimum": 0,
                                  "type": "integer"
                                },
                                "field": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "code",
                                "message",
                                "severity"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "errors",
                          "warnings"
                        ],
                        "type": "object"
                      },
                      "approval": {
                        "additionalProperties": false,
                        "properties": {
                          "required": {
                            "type": "boolean"
                          },
                          "state": {
                            "enum": [
                              "approved",
                              "changes_requested",
                              "voided",
                              "none"
                            ],
                            "type": "string"
                          },
                          "signedOff": {
                            "type": "boolean"
                          },
                          "verdicts": {
                            "items": {
                              "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"
                                },
                                "reviewer": {
                                  "additionalProperties": false,
                                  "properties": {
                                    "kind": {
                                      "enum": [
                                        "member",
                                        "guest",
                                        "agent",
                                        "system"
                                      ],
                                      "type": "string"
                                    },
                                    "accountId": {
                                      "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"
                                        }
                                      ]
                                    },
                                    "agentClientId": {
                                      "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"
                                        }
                                      ]
                                    },
                                    "guestId": {
                                      "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"
                                        }
                                      ]
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "accountId",
                                    "agentClientId",
                                    "guestId",
                                    "name"
                                  ],
                                  "type": "object"
                                },
                                "decision": {
                                  "enum": [
                                    "approved",
                                    "changes_requested"
                                  ],
                                  "type": "string"
                                },
                                "scope": {
                                  "enum": [
                                    "post",
                                    "piece"
                                  ],
                                  "type": "string"
                                },
                                "forVersion": {
                                  "anyOf": [
                                    {
                                      "maximum": 9007199254740991,
                                      "minimum": -9007199254740991,
                                      "type": "integer"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "voided": {
                                  "type": "boolean"
                                },
                                "counts": {
                                  "type": "boolean"
                                },
                                "at": {
                                  "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",
                                "reviewer",
                                "decision",
                                "scope",
                                "forVersion",
                                "voided",
                                "counts",
                                "at"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "required",
                          "state",
                          "signedOff",
                          "verdicts"
                        ],
                        "type": "object"
                      },
                      "nearDuplicates": {
                        "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"
                            },
                            "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"
                            },
                            "pieceTitle": {
                              "type": "string"
                            },
                            "state": {
                              "enum": [
                                "draft",
                                "ready",
                                "awaiting_confirmation",
                                "scheduled",
                                "publishing",
                                "published",
                                "failed_retrying",
                                "needs_attention",
                                "failed",
                                "manual",
                                "removed"
                              ],
                              "type": "string"
                            },
                            "at": {
                              "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"
                                }
                              ]
                            },
                            "similarity": {
                              "maximum": 1,
                              "minimum": 0,
                              "type": "number"
                            },
                            "url": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "postId",
                            "pieceId",
                            "pieceTitle",
                            "state",
                            "at",
                            "similarity",
                            "url"
                          ],
                          "type": "object"
                        },
                        "type": "array"
                      },
                      "schedule": {
                        "additionalProperties": false,
                        "properties": {
                          "allowed": {
                            "type": "boolean"
                          },
                          "needsConfirmation": {
                            "type": "boolean"
                          },
                          "autopilotNotice": {
                            "type": "string"
                          },
                          "reasons": {
                            "items": {
                              "additionalProperties": false,
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "code",
                                "message"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "allowed",
                          "needsConfirmation",
                          "reasons"
                        ],
                        "type": "object"
                      },
                      "postNow": {
                        "additionalProperties": false,
                        "properties": {
                          "allowed": {
                            "type": "boolean"
                          },
                          "alreadyDue": {
                            "type": "boolean"
                          },
                          "reasons": {
                            "items": {
                              "additionalProperties": false,
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "code",
                                "message"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "allowed",
                          "alreadyDue",
                          "reasons"
                        ],
                        "type": "object"
                      }
                    },
                    "required": [
                      "postId",
                      "version",
                      "state",
                      "isSkipped",
                      "format",
                      "formatLabel",
                      "channel",
                      "preview",
                      "titles",
                      "mediaCount",
                      "scheduledAt",
                      "scheduleSource",
                      "confirmedAt",
                      "nextQueueSlot",
                      "checks",
                      "approval",
                      "schedule",
                      "postNow"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "summary": {
                  "additionalProperties": false,
                  "properties": {
                    "total": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "schedulable": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "postableNow": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "blocked": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "skipped": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "total",
                    "schedulable",
                    "postableNow",
                    "blocked",
                    "skipped"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "piece",
                "timeZone",
                "callerMayPublish",
                "versions",
                "summary"
              ],
              "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"
      },
      "429": {
        "$ref": "#/components/responses/RateLimited"
      },
      "500": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "internal_error"
      }
    },
    "summary": "Get the publish plan of content",
    "tags": [
      "workspace"
    ],
    "x-heyeveryone-kind": "query"
  }
}
```

## 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"
    ]
  }
]
```
