Skip to content

Docs

POST /suggest_posting_slots

https://heyeveryone.ai/api/v1/suggest_posting_slots

Operation

{
  "post": {
    "description": "Suggest weekly posting times per channel account (or one, `channelAccountId`) from the workspace's own results: published posts of the last 180 days, averaged by weekday and by hour in the workspace's time zone (`metric`, default engagements). A channel needs 15 posts with results; until then it gets common weekday times with `source: \"default\"` and no numbers. Each slot has `nextAt` (next occurrence) and `inQueue`; add slots with set_queue_slots. Read-only.",
    "operationId": "suggest_posting_slots",
    "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"
              },
              "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"
              },
              "perWeek": {
                "default": 5,
                "maximum": 14,
                "minimum": 1,
                "type": "integer"
              },
              "metric": {
                "default": "engagements",
                "enum": [
                  "impressions",
                  "views",
                  "likes",
                  "comments",
                  "shares",
                  "saves",
                  "clicks",
                  "engagements"
                ],
                "type": "string"
              }
            },
            "required": [
              "workspaceId"
            ],
            "type": "object"
          }
        }
      },
      "required": true
    },
    "responses": {
      "200": {
        "content": {
          "application/json": {
            "schema": {
              "additionalProperties": false,
              "properties": {
                "metric": {
                  "enum": [
                    "impressions",
                    "views",
                    "likes",
                    "comments",
                    "shares",
                    "saves",
                    "clicks",
                    "engagements"
                  ],
                  "type": "string"
                },
                "timeZone": {
                  "type": "string"
                },
                "since": {
                  "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"
                },
                "method": {
                  "type": "string"
                },
                "channels": {
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "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"
                      },
                      "platform": {
                        "enum": [
                          "x",
                          "linkedin",
                          "threads",
                          "bluesky",
                          "instagram",
                          "facebook",
                          "tiktok",
                          "youtube",
                          "sandbox"
                        ],
                        "type": "string"
                      },
                      "source": {
                        "enum": [
                          "results",
                          "default"
                        ],
                        "type": "string"
                      },
                      "postsWithResults": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "minimumPosts": {
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer"
                      },
                      "slots": {
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "dayOfWeek": {
                              "maximum": 6,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "day": {
                              "type": "string"
                            },
                            "localTime": {
                              "type": "string"
                            },
                            "nextAt": {
                              "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"
                            },
                            "inQueue": {
                              "type": "boolean"
                            },
                            "evidence": {
                              "anyOf": [
                                {
                                  "additionalProperties": false,
                                  "properties": {
                                    "dayAverage": {
                                      "minimum": 0,
                                      "type": "number"
                                    },
                                    "dayPosts": {
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991,
                                      "type": "integer"
                                    },
                                    "hourAverage": {
                                      "minimum": 0,
                                      "type": "number"
                                    },
                                    "hourPosts": {
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991,
                                      "type": "integer"
                                    }
                                  },
                                  "required": [
                                    "dayAverage",
                                    "dayPosts",
                                    "hourAverage",
                                    "hourPosts"
                                  ],
                                  "type": "object"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "dayOfWeek",
                            "day",
                            "localTime",
                            "nextAt",
                            "inQueue",
                            "evidence"
                          ],
                          "type": "object"
                        },
                        "type": "array"
                      },
                      "note": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "channelAccountId",
                      "platform",
                      "source",
                      "postsWithResults",
                      "minimumPosts",
                      "slots",
                      "note"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              },
              "required": [
                "metric",
                "timeZone",
                "since",
                "method",
                "channels"
              ],
              "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": "Suggest posting times",
    "tags": [
      "workspace"
    ],
    "x-heyeveryone-kind": "query"
  }
}

Referenced definitions

{
  "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

{
  "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

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