Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
{
"openapi": "3.1.0",
"info": {
"title": "scheduled_action",
"description": "API for managing scheduled actions",
"termsOfService": "https://macro.com/terms",
"license": {
"name": ""
},
"version": "0.1.0"
},
"paths": {
"/health": {
"get": {
"tags": ["scheduled actions"],
"operationId": "scheduled_action_health",
"responses": {
"200": {
"description": "health",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EmptyResponse"
}
}
}
}
}
}
},
"/scheduled-actions": {
"get": {
"tags": ["scheduled actions"],
"operationId": "list_scheduled_actions",
"parameters": [
{
"name": "include_events",
"in": "query",
"description": "Backend clients must opt in to event actions; defaults to false (cron-only).",
"required": false,
"schema": {
"type": ["boolean", "null"],
"default": false
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduledActionResponse"
}
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"tags": ["scheduled actions"],
"operationId": "create_scheduled_action",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ActionConfiguration"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledActionResponse"
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"403": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/scheduled-actions/code/starters": {
"get": {
"tags": ["scheduled actions"],
"operationId": "routine_code_starters",
"responses": {
"200": {
"description": "Starter routines whose step is code; empty where code steps aren't available",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/StarterRoutine"
}
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/scheduled-actions/drafts": {
"post": {
"tags": ["scheduled actions"],
"operationId": "draft_routine",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DraftRoutineRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "A routine or step to review before saving, with any code problems AI couldn't fix, or why AI couldn't draft it",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Draft"
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"402": {
"description": "AI usage limit reached",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AiAdmissionErrorBody"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"503": {
"description": "AI usage validation unavailable",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AiAdmissionErrorBody"
}
}
}
}
}
}
},
"/scheduled-actions/{id}": {
"get": {
"tags": ["scheduled actions"],
"operationId": "get_scheduled_action",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the scheduled action",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledActionResponse"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
},
"put": {
"tags": ["scheduled actions"],
"operationId": "update_scheduled_action",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the scheduled action",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ActionConfigurationUpdate"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledActionResponse"
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"409": {
"description": "Configuration changed or execution is active",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
},
"delete": {
"tags": ["scheduled actions"],
"operationId": "delete_scheduled_action",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the scheduled action",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": ""
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/scheduled-actions/{id}/code-upgrades": {
"get": {
"tags": ["scheduled actions"],
"operationId": "list_scheduled_action_code_upgrades",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the scheduled action",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "How the routine's code steps were brought to new SDKs, newest first",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CodeUpgrade"
}
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/scheduled-actions/{id}/enabled": {
"put": {
"tags": ["scheduled actions"],
"operationId": "set_scheduled_action_enabled",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the scheduled action",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SetScheduledActionEnabled"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledActionResponse"
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"409": {
"description": "Configuration changed or execution is active",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/scheduled-actions/{id}/execute": {
"post": {
"tags": ["scheduled actions"],
"operationId": "execute_scheduled_action_now",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the scheduled action",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InProgressExecution"
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"402": {
"description": "AI allowance exhausted",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AiAdmissionErrorBody"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"409": {
"description": "Action is already running",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"503": {
"description": "AI usage validation unavailable; retry later",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AiAdmissionErrorBody"
}
}
}
}
}
}
},
"/scheduled-actions/{id}/history": {
"get": {
"tags": ["scheduled actions"],
"operationId": "list_scheduled_action_history",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the scheduled action",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ActionExecutionRecord"
}
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/scheduled-actions/{id}/template": {
"get": {
"tags": ["scheduled actions"],
"operationId": "get_scheduled_action_template",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the shared routine",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RoutineTemplate"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "The routine is not shared",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
},
"put": {
"tags": ["scheduled actions"],
"operationId": "share_scheduled_action_template",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the routine to share",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ShareRoutineTemplate"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RoutineTemplate"
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
},
"delete": {
"tags": ["scheduled actions"],
"operationId": "unshare_scheduled_action_template",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the shared routine",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": ""
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/scheduled-actions/{id}/template/activate": {
"post": {
"tags": ["scheduled actions"],
"operationId": "activate_scheduled_action_template",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the shared routine",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ActionConfiguration"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledActionResponse"
}
}
}
},
"400": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"403": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "The routine is not shared",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ActionConfiguration": {
"type": "object",
"description": "Client configuration, the create body. Ownership and execution state are\nserver-owned.",
"required": ["name", "trigger", "kind", "task", "enabled"],
"properties": {
"description": {
"type": "string",
"description": "What the routine is for, in the owner's words; empty when unset."
},
"enabled": {
"type": "boolean"
},
"kind": {
"$ref": "#/components/schemas/ActionKind"
},
"name": {
"type": "string"
},
"run_visibility": {
"$ref": "#/components/schemas/RunVisibility",
"description": "Omitted by clients that predate the setting; runs then start unlisted."
},
"task": {
"type": "object"
},
"trigger": {
"$ref": "#/components/schemas/ActionTrigger"
}
},
"additionalProperties": false
},
"ActionConfigurationUpdate": {
"type": "object",
"description": "Configuration replacement, the update body. Activation has its own endpoint, so\nomitting `enabled` keeps the stored value; omitting `run_visibility` or\n`description` keeps them too, so clients that predate them do not reset them.",
"required": ["name", "trigger", "kind", "task"],
"properties": {
"description": {
"type": ["string", "null"],
"description": "An empty string clears it."
},
"enabled": {
"type": ["boolean", "null"],
"description": "Still sent by clients deployed before the activation endpoint.",
"deprecated": true
},
"kind": {
"$ref": "#/components/schemas/ActionKind"
},
"name": {
"type": "string"
},
"run_visibility": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/RunVisibility"
}
]
},
"task": {
"type": "object"
},
"trigger": {
"$ref": "#/components/schemas/ActionTrigger"
}
},
"additionalProperties": false
},
"ActionExecutionRecord": {
"type": "object",
"required": [
"action_id",
"start_time",
"end_time",
"is_success",
"result",
"created_at"
],
"properties": {
"action_id": {
"type": "string",
"format": "uuid"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"end_time": {
"type": "string",
"format": "date-time"
},
"id": {
"type": ["string", "null"],
"format": "uuid"
},
"is_success": {
"type": "boolean"
},
"resource_id": {
"type": ["string", "null"],
"description": "ID of the primary resource produced by this run. Its type is recorded in\n`result`, independently of the routine's current configuration."
},
"result": {
"type": "object"
},
"start_time": {
"type": "string",
"format": "date-time"
}
}
},
"ActionKind": {
"type": "string",
"enum": ["Agent"]
},
"ActionTrigger": {
"oneOf": [
{
"type": "object",
"required": ["schedule", "timezone", "type"],
"properties": {
"schedule": {
"$ref": "#/components/schemas/Schedule"
},
"timezone": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["cron"]
}
}
},
{
"type": "object",
"required": ["filters", "type"],
"properties": {
"filters": {
"$ref": "#/components/schemas/EventFilters"
},
"type": {
"type": "string",
"enum": ["events"]
}
}
},
{
"type": "object",
"description": "Fires once at `at`, or as soon as it is saved when `at` has passed.",
"required": ["at", "type"],
"properties": {
"at": {
"type": "string",
"format": "date-time"
},
"type": {
"type": "string",
"enum": ["once"]
}
}
},
{
"type": "object",
"required": ["triggers", "type"],
"properties": {
"triggers": {
"$ref": "#/components/schemas/RoutineTriggers"
},
"type": {
"type": "string",
"enum": ["multiple"]
}
}
}
],
"description": "A routine may run on one trigger or any of several schedules and Macro events."
},
"AgentMcpServer": {
"type": "object",
"description": "One Pipedream app an agent lists under [`AgentMcpServers::Selected`].\n\nOnly the catalog identity is stored. Whether a given person has connected\nthe app is theirs, resolved at call time by the egress proxy, never here.",
"required": ["app_slug", "server_name"],
"properties": {
"app_slug": {
"type": "string",
"description": "Pipedream app slug, e.g. `linear`."
},
"server_name": {
"type": "string",
"description": "Display name, e.g. `Linear`."
}
}
},
"AgentTask": {
"type": "object",
"description": "The single agent task: how routines were stored before they had steps,\nand still how a routine that is only an agent is saved.",
"required": ["prompt", "user_prompt"],
"properties": {
"agent": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/AgentTaskAgent",
"description": "Absent when using Macro's agent-session runtime with a selected model."
}
]
},
"mcp_servers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AgentMcpServer"
},
"description": "Apps the routine requires on top of the agent's own. The owner must\nhave each one connected to save the routine and for it to run."
},
"model": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/RoutineModelId",
"description": "Required for model targets; overrides the persona default for agent targets."
}
]
},
"prompt": {
"type": "string",
"description": "Instructions placed before the user's."
},
"user_prompt": {
"type": "string",
"description": "What the agent should do."
}
}
},
"AgentTaskAgent": {
"type": "object",
"description": "A persona selection, independent of its runtime and current default model.",
"required": ["bot_id"],
"properties": {
"bot_id": {
"type": "string",
"format": "uuid",
"description": "The agent's bot id."
}
},
"additionalProperties": false
},
"AiAdmissionErrorBody": {
"type": "object",
"description": "Public admission error payload. Handlers with additional fields can reuse the\ndomain error's code and message and [`admission_status`].",
"required": ["error", "code"],
"properties": {
"code": {
"type": "string",
"description": "Stable denial or unavailability code."
},
"error": {
"type": "string",
"description": "Human-readable explanation, without internal billing diagnostics."
}
}
},
"CodeUpgrade": {
"type": "object",
"description": "One time a routine's code was brought to a new SDK.",
"required": [
"id",
"toSdk",
"outcome",
"previousTask",
"createdAt",
"updatedAt"
],
"properties": {
"createdAt": {
"type": "string",
"format": "date-time"
},
"fromSdk": {
"type": ["string", "null"],
"description": "The SDK the code was checked against before; none when it never was."
},
"id": {
"type": "string",
"format": "uuid"
},
"outcome": {
"$ref": "#/components/schemas/UpgradeOutcome"
},
"previousTask": {
"type": "object",
"description": "The task before."
},
"reason": {
"type": ["string", "null"],
"description": "Why the routine needs its owner."
},
"task": {
"type": ["object", "null"],
"description": "The saved rewrite, or the rewrite that failed its checks."
},
"toSdk": {
"type": "string",
"description": "The SDK it was brought to."
},
"updatedAt": {
"type": "string",
"format": "date-time"
}
}
},
"ConditionResult": {
"oneOf": [
{
"type": "object",
"description": "The triggering content answered the condition with no.",
"required": ["probability", "status"],
"properties": {
"probability": {
"type": "number",
"format": "float",
"description": "The classifier's probability, from 0 to 1, that the answer was yes."
},
"status": {
"type": "string",
"enum": ["not_met"]
}
}
},
{
"type": "object",
"description": "The condition could not be checked before the retry window closed.",
"required": ["status"],
"properties": {
"status": {
"type": "string",
"enum": ["unavailable"]
}
}
}
],
"description": "Why an event-triggered run was skipped before it started."
},
"Draft": {
"oneOf": [
{
"allOf": [
{
"$ref": "#/components/schemas/DraftedRoutine",
"description": "A routine to review before saving."
},
{
"type": "object",
"required": ["outcome"],
"properties": {
"outcome": {
"type": "string",
"enum": ["routine"]
}
}
}
],
"description": "A routine to review before saving."
},
{
"allOf": [
{
"$ref": "#/components/schemas/DraftedStep",
"description": "A step to add, or to put in place of the one changed."
},
{
"type": "object",
"required": ["outcome"],
"properties": {
"outcome": {
"type": "string",
"enum": ["step"]
}
}
}
],
"description": "A step to add, or to put in place of the one changed."
},
{
"type": "object",
"description": "Why there's no draft, for the person.",
"required": ["message", "outcome"],
"properties": {
"message": {
"type": "string"
},
"outcome": {
"type": "string",
"enum": ["failed"]
}
}
}
],
"description": "What AI drafted, or why it couldn't."
},
"DraftContext": {
"type": "object",
"description": "What the drafter may write, and the person's workspace by name and id.",
"required": ["timezone", "agentModel"],
"properties": {
"agentModel": {
"type": "string",
"description": "The model Ask AI steps it writes run on."
},
"code": {
"type": "boolean",
"description": "Whether it may write code steps; otherwise it writes Ask AI steps.\nChanging a code step needs no permission."
},
"conditions": {
"type": "boolean",
"description": "Whether triggers may ask AI a yes/no question before a run. This host\nmust also be able to answer it."
},
"timezone": {
"type": "string",
"description": "IANA time zone schedules are written in, e.g. `America/New_York`."
},
"workspace": {
"$ref": "#/components/schemas/Workspace"
}
},
"additionalProperties": false
},
"DraftRequest": {
"oneOf": [
{
"type": "object",
"description": "A new routine, from what it should do and when.",
"required": ["description", "type"],
"properties": {
"description": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["routine"]
}
}
},
{
"type": "object",
"description": "One step to add at the end of `routine`. `kind` makes it code or Ask\nAI; without it, AI makes it code whenever code can do the job.",
"required": ["description", "routine", "type"],
"properties": {
"description": {
"type": "string"
},
"kind": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/StepKind"
}
]
},
"routine": {
"$ref": "#/components/schemas/RoutineSoFar"
},
"type": {
"type": "string",
"enum": ["add_step"]
}
}
},
{
"type": "object",
"description": "The code step at `index` in `routine`'s steps, rewritten as\n`instruction` says. It keeps its place and output name.",
"required": ["instruction", "routine", "index", "type"],
"properties": {
"index": {
"type": "integer",
"minimum": 0
},
"instruction": {
"type": "string"
},
"routine": {
"$ref": "#/components/schemas/RoutineSoFar"
},
"type": {
"type": "string",
"enum": ["change_step"]
}
}
}
],
"description": "What to draft."
},
"DraftRoutineRequest": {
"type": "object",
"description": "What to draft, and what the drafter may write and name.",
"required": ["draft", "context"],
"properties": {
"context": {
"$ref": "#/components/schemas/DraftContext"
},
"draft": {
"$ref": "#/components/schemas/DraftRequest"
}
},
"additionalProperties": false
},
"DraftedRoutine": {
"type": "object",
"description": "A drafted routine.",
"required": ["name", "steps", "problems"],
"properties": {
"name": {
"type": "string"
},
"problems": {
"type": "array",
"items": {
"$ref": "#/components/schemas/StepProblem"
},
"description": "Steps whose code still fails the type checker."
},
"steps": {
"type": "array",
"items": {
"type": "object"
},
"description": "What it does, in the shape a routine's task holds steps, each code\nstep named as saving names it."
},
"trigger": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ActionTrigger",
"description": "When it runs; absent when AI found no trigger it could use."
}
]
}
}
},
"DraftedStep": {
"type": "object",
"description": "A drafted step.",
"required": ["step", "reason", "problems"],
"properties": {
"problems": {
"type": "array",
"items": {
"type": "string"
},
"description": "What the type checker still finds in its code."
},
"reason": {
"type": "string",
"description": "Why AI made a step it chose code or Ask AI, in a few words; empty\nwhen it gave no short reason or didn't choose."
},
"step": {
"type": "object",
"description": "The step, in the shape a routine's task holds it."
}
}
},
"EmptyResponse": {
"type": "object",
"description": "Empty response is required due to custom fetch forcing `response.json()`"
},
"EventFilter": {
"type": "object",
"description": "An event name AND an entity ID must match within the same filter. A\ncondition further requires the event's content to answer it with yes.\n\n`github` comes from outside Macro and carries its payload: it stands\nalone in its filter, takes no ids, and may require\nexact payload values with `match`. A `github` filter narrows deliveries\nwith its `github` selector.",
"required": ["events"],
"properties": {
"condition": {
"type": ["string", "null"],
"description": "Yes/no question about the triggering content, e.g. \"Is this email an\ninvoice?\". The routine runs only when the answer is yes.",
"maxLength": 500
},
"events": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EventName"
}
},
"github": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/GithubSelector",
"description": "Which GitHub deliveries match; required for, and only for, `github`."
}
]
},
"ids": {
"type": ["array", "null"],
"items": {
"type": "string"
}
},
"match": {
"type": ["array", "null"],
"items": {
"$ref": "#/components/schemas/PayloadCondition"
},
"description": "Exact tests on the payload, all of which must pass."
},
"property": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/PropertySelector",
"description": "The task property that must have changed, and the values it must gain."
}
]
}
}
},
"EventFilters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EventFilter"
},
"description": "Bounded nonempty OR of filters, canonicalized to remove duplicates."
},
"EventName": {
"type": "string",
"description": "Closed allowlist: unknown names, deletions and ambiguous attribution are not\nselectors. Adding a broker variant does not automatically enable routines.",
"enum": [
"document.created",
"document.updated",
"document.deleted",
"task.created",
"task.status_changed",
"task.priority_changed",
"task.property_changed",
"email.message_received",
"channel.created",
"channel.message_posted",
"channel.mentioned",
"channel.message_patched",
"channel.message_attachment_created",
"call.started",
"call.ended",
"github"
]
},
"ExecutionResource": {
"type": "object",
"description": "Transcript resource created by a run. Never infer this from current task configuration.",
"required": ["type", "id"],
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/ExecutionResourceType"
}
}
},
"ExecutionResourceType": {
"type": "string",
"description": "Closed set of transcript destinations understood by routine clients.",
"enum": ["chat", "agent"]
},
"ExecutionResult": {
"type": "object",
"description": "Version 1 execution metadata stored in the existing JSON result column.\nNull/string column values predate this envelope and refer to legacy chats.",
"required": ["version"],
"properties": {
"condition": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ConditionResult",
"description": "Present when an event trigger's condition stopped the run from starting."
}
]
},
"configuration_revision": {
"type": ["integer", "null"],
"format": "int64",
"description": "The routine configuration the run used. Step paths only name the same\nsteps in that configuration; a later edit can put another step there."
},
"error": {
"type": ["string", "null"]
},
"resource": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ExecutionResource"
}
]
},
"run": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/RunInfo",
"description": "What started the run and when, for runs of programs."
}
]
},
"steps": {
"type": "array",
"items": {
"type": "object"
},
"description": "What each step that ran did, in order: decisions, tool calls, the agent."
},
"version": {
"type": "integer",
"format": "int32",
"minimum": 0
}
}
},
"GithubSelector": {
"type": "object",
"description": "Which GitHub deliveries match.",
"properties": {
"actions": {
"type": "array",
"items": {
"type": "string"
},
"description": "Payload actions, such as `completed` or `opened`; any when empty."
},
"events": {
"type": "array",
"items": {
"type": "string"
},
"description": "GitHub event names, such as `workflow_run` or `pull_request`; any when empty."
},
"includeBots": {
"type": "boolean",
"description": "Also run for deliveries caused by bots and apps, including Macro's own."
},
"repositories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Repositories as `owner/name`, matched without regard to case; every\nrepository the owner's installations cover when empty. A renamed\nrepository stops matching until it is chosen again."
}
},
"additionalProperties": false
},
"InProgressExecution": {
"type": "object",
"required": ["action_id"],
"properties": {
"action_id": {
"type": "string",
"format": "uuid"
},
"chat_id": {
"type": ["string", "null"]
},
"resource": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ExecutionResource",
"description": "Absent only in responses from legacy workers."
}
]
}
}
},
"NamedItem": {
"type": "object",
"description": "An item and its name.",
"required": ["name", "id"],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"additionalProperties": false
},
"PayloadCondition": {
"type": "object",
"description": "`path` walks objects by key; `*` steps into every element of an array and\na number into one. Give exactly one test. `notIn` also passes when the\npath finds nothing.",
"required": ["path"],
"properties": {
"equals": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/PayloadScalar",
"description": "Some value found equals this."
}
]
},
"exists": {
"type": ["boolean", "null"],
"description": "Whether the path finds a non-null value."
},
"glob": {
"type": ["string", "null"],
"description": "Some text found matches this glob; `*` matches any run of characters."
},
"in": {
"type": ["array", "null"],
"items": {
"$ref": "#/components/schemas/PayloadScalar"
},
"description": "Some value found is one of these."
},
"notIn": {
"type": ["array", "null"],
"items": {
"$ref": "#/components/schemas/PayloadScalar"
},
"description": "No value found is one of these."
},
"path": {
"type": "array",
"items": {
"type": "string"
},
"description": "Keys from the payload's root, e.g. `[\"workflow_run\", \"conclusion\"]`."
}
},
"additionalProperties": false
},
"PayloadScalar": {
"oneOf": [
{
"type": "null",
"default": null
},
{
"type": "boolean"
},
{
"type": "number",
"format": "double"
},
{
"type": "string"
}
],
"description": "A JSON text, number, boolean or null that payload values are compared with."
},
"PropertySelector": {
"type": "object",
"description": "Narrows a task property change filter to one property and, optionally, the\nvalues it must gain.",
"required": ["definitionId"],
"properties": {
"definitionId": {
"type": "string",
"description": "The property definition that must have changed."
},
"values": {
"type": "array",
"items": {
"type": "string"
},
"description": "Select option ids or referenced entity ids, one of which the change must\nadd. Any change to the property matches when empty."
}
},
"additionalProperties": false
},
"RoutineModelId": {
"type": "string",
"description": "A nonblank model identifier. Runtime catalogs, not the scheduler, own availability."
},
"RoutineSoFar": {
"type": "object",
"description": "The routine a step is added to or changed in.",
"required": ["steps"],
"properties": {
"steps": {
"type": "array",
"items": {
"type": "object"
},
"description": "Its steps, in the shape a routine's task holds them."
},
"trigger": {
"type": ["object", "null"],
"description": "Its trigger as it would be saved, for AI to read; absent while it has none."
}
},
"additionalProperties": false
},
"RoutineTemplate": {
"type": "object",
"description": "A shared routine's snapshot, readable by signed-in users with sharing enabled.",
"required": [
"id",
"author",
"name",
"description",
"trigger",
"task",
"variables",
"active_count",
"created_at",
"updated_at"
],
"properties": {
"active_count": {
"type": "integer",
"format": "int32",
"description": "Routines activated from this template, including stopped ones.",
"minimum": 0
},
"author": {
"type": "string",
"description": "Who shared it: the source routine's owner."
},
"created_at": {
"type": "string",
"format": "date-time"
},
"description": {
"type": "string"
},
"id": {
"type": "string",
"format": "uuid",
"description": "The routine it was shared from."
},
"name": {
"type": "string"
},
"task": {
"type": "object"
},
"trigger": {
"$ref": "#/components/schemas/ActionTrigger"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"variables": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TemplateVariable"
}
}
}
},
"RoutineTrigger": {
"oneOf": [
{
"type": "object",
"required": ["schedule", "timezone", "type"],
"properties": {
"schedule": {
"$ref": "#/components/schemas/Schedule"
},
"timezone": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["cron"]
}
}
},
{
"type": "object",
"required": ["filters", "type"],
"properties": {
"filters": {
"$ref": "#/components/schemas/EventFilters"
},
"type": {
"type": "string",
"enum": ["events"]
}
}
},
{
"type": "object",
"description": "Fires once at `at`, or as soon as it is saved when `at` has passed.",
"required": ["at", "type"],
"properties": {
"at": {
"type": "string",
"format": "date-time"
},
"type": {
"type": "string",
"enum": ["once"]
}
}
}
],
"description": "An individual trigger in a routine's trigger list."
},
"RoutineTriggers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RoutineTrigger"
},
"description": "Bounded schedules and one combined set of event filters."
},
"RunInfo": {
"type": "object",
"description": "What the run page says about a run: what started it, when it counts as\nhappening, and since when.",
"required": ["at", "started_by"],
"properties": {
"at": {
"type": "string",
"format": "date-time",
"description": "When the run counts as happening: its trigger's time."
},
"previous_at": {
"type": ["string", "null"],
"format": "date-time",
"description": "When the routine's previous finished run started."
},
"started_by": {
"$ref": "#/components/schemas/RunStart",
"description": "What started it."
},
"timezone": {
"type": ["string", "null"],
"description": "The IANA time zone code reads `at` in, when the run had one."
}
}
},
"RunStart": {
"oneOf": [
{
"type": "object",
"description": "One of its schedules came due.",
"required": ["schedule", "timezone", "kind"],
"properties": {
"kind": {
"type": "string",
"enum": ["schedule"]
},
"schedule": {
"type": "string",
"description": "The cron expression."
},
"timezone": {
"type": "string",
"description": "Its IANA time zone."
}
}
},
{
"type": "object",
"description": "An event it watches happened.",
"required": ["event", "kind"],
"properties": {
"entity_id": {
"type": ["string", "null"],
"description": "The item the event is about."
},
"event": {
"type": "string",
"description": "The event's name, e.g. `email.message_received`."
},
"kind": {
"type": "string",
"enum": ["event"]
}
}
},
{
"type": "object",
"description": "Its owner started it by hand.",
"required": ["by", "kind"],
"properties": {
"by": {
"type": "string",
"description": "Who started it."
},
"kind": {
"type": "string",
"enum": ["manual"]
}
}
}
],
"description": "What started a run, for its page."
},
"RunVisibility": {
"type": "string",
"description": "Whether a routine's runs are listed in Home and the Agents list. Routines\nthat run often would bury the owner's own work, so runs start unlisted;\neither way they stay in the routine's history. The string form is the\n`scheduled_action.run_visibility` column's.",
"enum": ["listed", "unlisted"]
},
"Schedule": {
"type": "string"
},
"ScheduledAction": {
"type": "object",
"required": [
"owner",
"name",
"trigger",
"kind",
"created_at",
"updated_at",
"configuration_revision",
"task",
"enabled",
"run_visibility"
],
"properties": {
"claimed": {
"type": ["string", "null"],
"format": "date-time"
},
"configuration_revision": {
"type": "integer",
"format": "int64",
"description": "Independent of execution bookkeeping in `updated_at`."
},
"created_at": {
"type": "string",
"format": "date-time"
},
"description": {
"type": "string",
"description": "What the routine is for, in the owner's words; empty when unset."
},
"enabled": {
"type": "boolean",
"description": "When false, automatic dispatch skips this action. `run_now` remains\navailable regardless."
},
"event_activated_at": {
"type": ["string", "null"],
"format": "date-time",
"description": "Event publication boundary; absent for cron actions."
},
"id": {
"type": ["string", "null"],
"format": "uuid"
},
"kind": {
"$ref": "#/components/schemas/ActionKind"
},
"name": {
"type": "string"
},
"next_run_at": {
"type": ["string", "null"],
"format": "date-time",
"description": "Next cron firing, absent for event-triggered actions."
},
"owner": {
"type": "string",
"description": "Who the action belongs to. Every action is user-owned today, but the\ntype no longer says so: the principal string on the wire and in the\n`owner` column is the same, and a bot- or team-owned row decodes\nrather than failing to parse."
},
"run_visibility": {
"$ref": "#/components/schemas/RunVisibility",
"description": "Whether the action's runs are listed in Home and the Agents list."
},
"task": {
"type": "object"
},
"template_id": {
"type": ["string", "null"],
"format": "uuid",
"description": "The shared template this routine was activated from, if any."
},
"trigger": {
"$ref": "#/components/schemas/ActionTrigger"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
}
},
"ScheduledActionResponse": {
"allOf": [
{
"$ref": "#/components/schemas/ScheduledAction"
},
{
"type": "object",
"properties": {
"last_run": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ActionExecutionRecord",
"description": "The latest finished run, with what each step did. Present only in\nlists, and only once the routine has finished a run."
}
]
},
"schedule": {
"type": ["string", "null"],
"description": "Deprecated: use `trigger.schedule`. Present only for cron actions.",
"deprecated": true
},
"timezone": {
"type": ["string", "null"],
"description": "Deprecated: use `trigger.timezone`. Present only for cron actions.",
"deprecated": true
}
}
}
],
"description": "Canonical trigger plus deprecated cron fields for existing clients. Event\nresponses omit legacy fields rather than inventing a schedule or timezone."
},
"ScheduledActionUpdate": {
"oneOf": [
{
"type": "object",
"required": ["owner", "action_id", "type"],
"properties": {
"action_id": {
"type": "string",
"format": "uuid"
},
"chat_id": {
"type": ["string", "null"]
},
"owner": {
"type": "string"
},
"resource": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ExecutionResource"
}
]
},
"type": {
"type": "string",
"enum": ["started"]
}
}
},
{
"type": "object",
"required": ["owner", "action_id", "is_success", "type"],
"properties": {
"action_id": {
"type": "string",
"format": "uuid"
},
"chat_id": {
"type": ["string", "null"]
},
"is_success": {
"type": "boolean"
},
"owner": {
"type": "string"
},
"resource": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ExecutionResource"
}
]
},
"type": {
"type": "string",
"enum": ["stopped"]
}
}
}
],
"description": "Live status update for a scheduled-action run, broadcast via the connection\ngateway to the owner. Clients use the typed resource to navigate to the run\ntranscript and the variant tag to toggle the running indicator. `chat_id`\nremains populated only for chat runs, for older clients.\n\nSerialized with a `type` tag (`started`/`stopped`) and delivered over the\nsingle `scheduled_action_update` message type on the gateway."
},
"SetScheduledActionEnabled": {
"type": "object",
"required": ["enabled"],
"properties": {
"enabled": {
"type": "boolean"
}
},
"additionalProperties": false
},
"ShareRoutineTemplate": {
"type": "object",
"description": "What the owner supplies when sharing; the rest is snapshotted from the routine.",
"required": ["description", "variables"],
"properties": {
"description": {
"type": "string"
},
"variables": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TemplateVariable"
}
}
},
"additionalProperties": false
},
"StarterRoutine": {
"type": "object",
"description": "A starter routine whose step is code: offered when a routine is created,\nand shown to the drafter as a worked example.",
"required": ["key", "request", "steps"],
"properties": {
"key": {
"type": "string",
"description": "Names it, e.g. `inbox`."
},
"request": {
"type": "string",
"description": "What someone asks for, with when it runs."
},
"steps": {
"type": "array",
"items": {
"type": "object"
},
"description": "Its steps, in the shape a routine's task holds them."
}
}
},
"StepKind": {
"type": "string",
"description": "Code written once, or Ask AI each run.",
"enum": ["code", "agent"]
},
"StepProblem": {
"type": "object",
"description": "A drafted step whose code still fails the type checker.",
"required": ["index", "problems"],
"properties": {
"index": {
"type": "integer",
"description": "Its place among the steps, from zero.",
"minimum": 0
},
"problems": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"TemplateVariable": {
"oneOf": [
{
"type": "object",
"description": "A person mentioned in the instructions, by their user ID.",
"required": ["id", "label", "fill", "kind"],
"properties": {
"fill": {
"$ref": "#/components/schemas/VariableFill"
},
"id": {
"type": "string"
},
"kind": {
"type": "string",
"enum": ["user"]
},
"label": {
"type": "string"
}
}
},
{
"type": "object",
"description": "A document, channel or other item mentioned in the instructions.",
"required": ["id", "block_name", "label", "fill", "kind"],
"properties": {
"block_name": {
"type": "string",
"description": "The mention's block name, such as `channel` or `md`."
},
"fill": {
"$ref": "#/components/schemas/VariableFill"
},
"id": {
"type": "string"
},
"kind": {
"type": "string",
"enum": ["item"]
},
"label": {
"type": "string"
}
}
},
{
"type": "object",
"description": "The time zone of the routine's schedules.",
"required": ["timezone", "fill", "kind"],
"properties": {
"fill": {
"$ref": "#/components/schemas/VariableFill"
},
"kind": {
"type": "string",
"enum": ["time_zone"]
},
"timezone": {
"type": "string"
}
}
}
],
"description": "A user-specific part of a shared routine."
},
"UpgradeOutcome": {
"type": "string",
"description": "How an upgrade went.",
"enum": ["running", "checked", "rewritten", "needs_update"]
},
"VariableFill": {
"type": "string",
"description": "How a variable is filled when someone activates the template.",
"enum": ["activator", "shared", "choice"]
},
"Workspace": {
"type": "object",
"description": "The items AI may name in a draft. They are data for the model; saving\nchecks every id the draft uses.",
"properties": {
"agents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/WorkspaceAgent"
},
"description": "Agents a step may hand the run to."
},
"channels": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NamedItem"
}
},
"folders": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NamedItem"
},
"description": "Projects."
},
"labels": {
"type": "array",
"items": {
"type": "string"
},
"description": "Email label names."
},
"people": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NamedItem"
}
},
"tags": {
"type": "array",
"items": {
"$ref": "#/components/schemas/WorkspaceTag"
},
"description": "Tag options, by the property definition they belong to."
}
},
"additionalProperties": false
},
"WorkspaceAgent": {
"type": "object",
"description": "An agent and its bot id.",
"required": ["name", "botId"],
"properties": {
"botId": {
"type": "string"
},
"name": {
"type": "string"
}
},
"additionalProperties": false
},
"WorkspaceTag": {
"type": "object",
"description": "A tag: one option of a property.",
"required": ["label", "definitionId", "optionId"],
"properties": {
"definitionId": {
"type": "string"
},
"label": {
"type": "string"
},
"optionId": {
"type": "string"
}
},
"additionalProperties": false
}
}
},
"tags": [
{
"name": "scheduled actions",
"description": "Scheduled action service"
}
]
}