{
  "openapi": "3.1.0",
  "info": {
    "title": "CoreDM API",
    "version": "1.1.0",
    "summary": "Create, edit and switch on Instagram DM automations without opening the editor.",
    "description": "Each API key belongs to ONE connected Instagram account and only sees that account. Create keys in CoreDM → Settings → API & agents.\n\nWrites need an `Idempotency-Key` header (repeat it when retrying). Edits, publish, pause and delete of flows also need `If-Match` with the flow's current `etag`.\n\nPublishing a flow runs the same pre-publish safety review as the editor. With findings it answers 409 `review_required` and the list; show it to the person and, if they accept, publish again with `acknowledge_warnings` naming every code.\n\nLimit: 120 requests per minute per account. Errors: `{ error: { code, message, request_id, details?, retryable } }`.\n\nHuman docs (ES/EN): https://coredm.app/docs/api — guide for language models: https://coredm.app/llms.txt",
    "contact": {
      "name": "CoreDM",
      "url": "https://coredm.app"
    }
  },
  "servers": [
    {
      "url": "https://coredm.app/api/external/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/account": {
      "get": {
        "summary": "The Instagram account and scopes of this key",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getAccount"
      }
    },
    "/posts": {
      "get": {
        "summary": "Recent Instagram posts and reels of this account (media_id, link, caption, date), newest first. Query: kind=reel|post, limit (1-50)",
        "security": [
          {
            "bearer": [
              "automations:read"
            ]
          }
        ],
        "x-coredm-scope": "automations:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getPosts"
      }
    },
    "/capabilities": {
      "get": {
        "summary": "What this account can do through the API (publishing, executions…)",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getCapabilities"
      }
    },
    "/node-schemas": {
      "get": {
        "summary": "JSON schema of every node type and its fields",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getNodeSchemas"
      }
    },
    "/templates": {
      "get": {
        "summary": "Ready-made flow templates to adapt",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getTemplates"
      }
    },
    "/flows": {
      "get": {
        "summary": "List flows",
        "security": [
          {
            "bearer": [
              "flows:read"
            ]
          }
        ],
        "x-coredm-scope": "flows:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Flow"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "operationId": "getFlows"
      },
      "post": {
        "summary": "Create a draft flow",
        "security": [
          {
            "bearer": [
              "flows:write"
            ]
          }
        ],
        "x-coredm-scope": "flows:write",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Flow"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlowInput"
              }
            }
          }
        },
        "operationId": "postFlows"
      }
    },
    "/flows/validate": {
      "post": {
        "summary": "Validate a graph without saving it: errors plus the safety review",
        "security": [
          {
            "bearer": [
              "flows:read"
            ]
          }
        ],
        "x-coredm-scope": "flows:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Validation"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Graph"
              }
            }
          }
        },
        "operationId": "postFlowsValidate"
      }
    },
    "/flows/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "summary": "Get a flow (its `etag` is also in the ETag header)",
        "security": [
          {
            "bearer": [
              "flows:read"
            ]
          }
        ],
        "x-coredm-scope": "flows:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Flow"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getFlowsById"
      },
      "patch": {
        "summary": "Edit a flow (fields omitted are kept)",
        "security": [
          {
            "bearer": [
              "flows:write"
            ]
          }
        ],
        "x-coredm-scope": "flows:write",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Flow"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlowPatch"
              }
            }
          }
        },
        "operationId": "patchFlowsById"
      },
      "delete": {
        "summary": "Delete a flow",
        "security": [
          {
            "bearer": [
              "flows:delete"
            ]
          }
        ],
        "x-coredm-scope": "flows:delete",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "operationId": "deleteFlowsById"
      }
    },
    "/flows/{id}/simulate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "summary": "Dry-run a flow against an event; sends nothing",
        "security": [
          {
            "bearer": [
              "flows:read"
            ]
          }
        ],
        "x-coredm-scope": "flows:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event",
                  "text"
                ],
                "additionalProperties": false,
                "properties": {
                  "event": {
                    "enum": [
                      "comment",
                      "dm",
                      "story"
                    ]
                  },
                  "text": {
                    "type": "string"
                  },
                  "isFirstMessage": {
                    "type": "boolean"
                  },
                  "postId": {
                    "type": "string"
                  },
                  "storyId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "operationId": "postFlowsByIdSimulate"
      }
    },
    "/flows/{id}/publish": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "summary": "Publish (switch on) a flow, after the safety review",
        "security": [
          {
            "bearer": [
              "flows:publish"
            ]
          }
        ],
        "x-coredm-scope": "flows:publish",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Flow"
                }
              }
            }
          },
          "409": {
            "description": "`review_required`: details.warnings lists the findings, details.missing the codes not yet acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "acknowledge_warnings": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Codes of every review finding the person accepted."
                  }
                }
              }
            }
          }
        },
        "operationId": "postFlowsByIdPublish"
      }
    },
    "/flows/{id}/pause": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "summary": "Pause a published flow",
        "security": [
          {
            "bearer": [
              "flows:publish"
            ]
          }
        ],
        "x-coredm-scope": "flows:publish",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "operationId": "postFlowsByIdPause"
      }
    },
    "/flows/{id}/executions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "summary": "Recent runs of a flow",
        "security": [
          {
            "bearer": [
              "executions:read"
            ]
          }
        ],
        "x-coredm-scope": "executions:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "operationId": "getFlowsByIdExecutions"
      }
    },
    "/automations": {
      "get": {
        "summary": "List Comment-to-DM automations",
        "security": [
          {
            "bearer": [
              "automations:read"
            ]
          }
        ],
        "x-coredm-scope": "automations:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "name": "media_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "post_url",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "operationId": "getAutomations"
      },
      "post": {
        "summary": "Create a Comment-to-DM automation on a post or Reel (shortcut over flows)",
        "security": [
          {
            "bearer": [
              "automations:write"
            ]
          }
        ],
        "x-coredm-scope": "automations:write",
        "responses": {
          "200": {
            "description": "Already existed (deduplicated)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationInput"
              }
            }
          }
        },
        "operationId": "postAutomations"
      }
    },
    "/automations/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "summary": "Get an automation",
        "security": [
          {
            "bearer": [
              "automations:read"
            ]
          }
        ],
        "x-coredm-scope": "automations:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getAutomationsById"
      },
      "patch": {
        "summary": "Edit an automation",
        "security": [
          {
            "bearer": [
              "automations:write"
            ]
          }
        ],
        "x-coredm-scope": "automations:write",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "operationId": "patchAutomationsById"
      },
      "delete": {
        "summary": "Delete an automation",
        "security": [
          {
            "bearer": [
              "automations:delete"
            ]
          }
        ],
        "x-coredm-scope": "automations:delete",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "deleteAutomationsById"
      }
    },
    "/automations/{id}/activate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "summary": "Activate an automation",
        "security": [
          {
            "bearer": [
              "automations:activate"
            ]
          }
        ],
        "x-coredm-scope": "automations:activate",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "postAutomationsByIdActivate"
      }
    },
    "/automations/{id}/pause": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "summary": "Pause an automation",
        "security": [
          {
            "bearer": [
              "automations:activate"
            ]
          }
        ],
        "x-coredm-scope": "automations:activate",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "postAutomationsByIdPause"
      }
    },
    "/automations/{id}/stats": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "summary": "Matching comments, DMs sent/failed and clicks",
        "security": [
          {
            "bearer": [
              "automations:read"
            ]
          }
        ],
        "x-coredm-scope": "automations:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getAutomationsByIdStats"
      }
    },
    "/resources": {
      "post": {
        "summary": "Register a link (JSON) or upload a PDF (multipart, max 4 MiB) to send by DM",
        "security": [
          {
            "bearer": [
              "resources:write"
            ]
          }
        ],
        "x-coredm-scope": "resources:write",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "url"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "file"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "operationId": "postResources"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "cdm_<64 hex>",
        "description": "Scopes: automations:read, automations:write, automations:activate, automations:delete, resources:write, flows:read, flows:write, flows:publish, flows:delete, executions:read."
      }
    },
    "parameters": {
      "id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50
        }
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "schema": {
          "type": "string"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 200
        },
        "description": "Repeat the same value when retrying the same write."
      },
      "IfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "The flow's current etag, e.g. \"flow:<id>:<revision>\"."
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "details": {},
              "retryable": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "Node": {
        "type": "object",
        "required": [
          "id",
          "type",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "See GET /node-schemas"
          },
          "position": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              }
            }
          },
          "data": {
            "type": "object"
          }
        }
      },
      "Edge": {
        "type": "object",
        "required": [
          "id",
          "source",
          "target"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "sourceHandle": {
            "type": "string"
          },
          "targetHandle": {
            "type": "string"
          }
        }
      },
      "Graph": {
        "type": "object",
        "required": [
          "nodes",
          "edges"
        ],
        "properties": {
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Node"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Edge"
            }
          }
        }
      },
      "FlowInput": {
        "type": "object",
        "required": [
          "name",
          "nodes",
          "edges"
        ],
        "additionalProperties": false,
        "properties": {
          "schema_version": {
            "const": 1
          },
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Node"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Edge"
            }
          }
        }
      },
      "FlowPatch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "schema_version": {
            "const": 1
          },
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Node"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Edge"
            }
          }
        }
      },
      "Flow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "enum": [
              "draft",
              "published",
              "paused"
            ]
          },
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Node"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Edge"
            }
          },
          "revision": {
            "type": "string"
          },
          "etag": {
            "type": "string"
          },
          "url_panel": {
            "type": "string",
            "format": "uri"
          },
          "redacted": {
            "type": "boolean"
          }
        }
      },
      "ReviewWarning": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "risk",
              "delivery",
              "content"
            ]
          },
          "node_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "message_es": {
            "type": "string"
          },
          "message_en": {
            "type": "string"
          }
        }
      },
      "Validation": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "errors": {
            "type": "array"
          },
          "warnings": {
            "type": "array"
          },
          "review": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReviewWarning"
            }
          }
        }
      },
      "AutomationInput": {
        "type": "object",
        "required": [
          "name",
          "keywords",
          "dm_text"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "media_id": {
            "type": "string",
            "description": "Instagram media ID (numeric string)"
          },
          "post_url": {
            "type": "string",
            "format": "uri"
          },
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 20
          },
          "dm_text": {
            "type": "string",
            "maxLength": 1000
          },
          "public_reply": {
            "type": [
              "string",
              "null"
            ]
          },
          "resource_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "button_text": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 20
          },
          "status": {
            "enum": [
              "active",
              "paused"
            ]
          }
        }
      }
    }
  }
}