{
  "openapi": "3.1.0",
  "info": {
    "title": "Integrate API",
    "version": "0.1.0",
    "description": "Shared REST contract for agent-managed workflows and embedded customer automations."
  },
  "servers": [
    {
      "url": "https://integrate.dev/api/v1"
    }
  ],
  "paths": {
    "/actions": {
      "get": {
        "summary": "Discover native actions, schemas, pricing, and limits",
        "operationId": "get__actions",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/contexts": {
      "get": {
        "summary": "List isolated customer contexts",
        "operationId": "get__contexts",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      },
      "post": {
        "summary": "Create an isolated customer context",
        "operationId": "post__contexts",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/connections": {
      "get": {
        "summary": "List connections without credentials",
        "operationId": "get__connections",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/connections/link": {
      "post": {
        "summary": "Create a single-use 15-minute secure connection URL",
        "operationId": "post__connections_link",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "tally",
                      "airtable",
                      "slack",
                      "stripe",
                      "notion",
                      "linear"
                    ]
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "contextId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "provider",
                  "label"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/connections/{id}/resources": {
      "get": {
        "summary": "Discover resources allowed by this connection",
        "operationId": "get__connections_id_resources",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/connections/{id}/revoke": {
      "post": {
        "summary": "Revoke a connection",
        "operationId": "post__connections_id_revoke",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows": {
      "get": {
        "summary": "List workflow drafts and published status",
        "operationId": "get__workflows",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      },
      "post": {
        "summary": "Create a validated draft",
        "operationId": "post__workflows",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "spec": {
                    "$ref": "#/components/schemas/WorkflowSpec"
                  },
                  "contextId": {
                    "type": "string"
                  }
                },
                "required": [
                  "spec"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/{id}": {
      "get": {
        "summary": "Read a workflow definition",
        "operationId": "get__workflows_id_",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      },
      "patch": {
        "summary": "Update draft while retaining the active immutable version",
        "operationId": "patch__workflows_id_",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "spec": {
                    "$ref": "#/components/schemas/WorkflowSpec"
                  }
                },
                "required": [
                  "spec"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/validate": {
      "post": {
        "summary": "Validate ownership, mappings, references, and maximum cost",
        "operationId": "post__workflows_validate",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "spec": {
                    "$ref": "#/components/schemas/WorkflowSpec"
                  },
                  "contextId": {
                    "type": "string"
                  }
                },
                "required": [
                  "spec"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/{id}/dry-run": {
      "post": {
        "summary": "Inspect mapping with sample data without connector execution",
        "operationId": "post__workflows_id_dry_run",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/{id}/publish": {
      "post": {
        "summary": "Publish immutable version and activate triggers",
        "operationId": "post__workflows_id_publish",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "manualWebhook": {
                    "type": "boolean"
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/{id}/activate": {
      "post": {
        "summary": "Activate a manually configured webhook version",
        "operationId": "post__workflows_id_activate",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "versionId": {
                    "type": "string"
                  }
                },
                "required": [
                  "versionId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/{id}/pause": {
      "post": {
        "summary": "pause future execution",
        "operationId": "post__workflows_id_pause",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/{id}/resume": {
      "post": {
        "summary": "resume future execution",
        "operationId": "post__workflows_id_resume",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/workflows/{id}/run": {
      "post": {
        "summary": "Enqueue an idempotent billable run",
        "operationId": "post__workflows_id_run",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/runs": {
      "get": {
        "summary": "List recent runs",
        "operationId": "get__runs",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/runs/{id}": {
      "get": {
        "summary": "Read step receipts, optional payload=true to retrieve private payload",
        "operationId": "get__runs_id_",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/runs/{id}/retry": {
      "post": {
        "summary": "Retry failed or credit-blocked run without repeating successful steps",
        "operationId": "post__runs_id_retry",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/runs/{id}/reconcile": {
      "post": {
        "summary": "Confirm an ambiguous write succeeded using externally verified output",
        "operationId": "post__runs_id_reconcile",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stepKey": {
                    "type": "string"
                  },
                  "output": {}
                },
                "required": [
                  "stepKey",
                  "output"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/balance": {
      "get": {
        "summary": "Inspect available/reserved credit and ledger",
        "operationId": "get__balance",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/keys": {
      "get": {
        "summary": "List hashed-key metadata",
        "operationId": "get__keys",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      },
      "post": {
        "summary": "Create a scoped API key shown once",
        "operationId": "post__keys",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "enum": [
                        "read",
                        "manage",
                        "execute"
                      ]
                    }
                  },
                  "contextId": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "scopes"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/keys/{id}/revoke": {
      "post": {
        "summary": "Revoke a key",
        "operationId": "post__keys_id_revoke",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/billing/checkout": {
      "post": {
        "summary": "Create a Polar credit checkout",
        "operationId": "post__billing_checkout",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountCents": {
                    "enum": [
                      500,
                      2000,
                      5000
                    ]
                  }
                },
                "required": [
                  "amountCents"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/billing/portal": {
      "post": {
        "summary": "Open Polar payment history",
        "operationId": "post__billing_portal",
        "security": [
          {
            "BearerKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked authorization"
          },
          "402": {
            "description": "Insufficient credit"
          },
          "403": {
            "description": "Permission or context denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "State conflict or reconciliation required"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "int_ API key"
      }
    },
    "schemas": {
      "WorkflowSpec": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 1
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "default": "",
            "type": "string",
            "maxLength": 2000
          },
          "trigger": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "manual"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "webhook"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "tally"
                  },
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "formId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "type",
                  "connectionId",
                  "formId"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "stripe"
                  },
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "priceId": {
                    "type": "string",
                    "pattern": "^price_"
                  }
                },
                "required": [
                  "type",
                  "connectionId",
                  "priceId"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "schedule"
                  },
                  "timezone": {
                    "type": "string"
                  },
                  "weekdays": {
                    "minItems": 1,
                    "maxItems": 7,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 7
                    }
                  },
                  "hour": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 23
                  },
                  "minute": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 59
                  }
                },
                "required": [
                  "type",
                  "timezone",
                  "weekdays",
                  "hour",
                  "minute"
                ],
                "additionalProperties": false
              }
            ]
          },
          "steps": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[A-Za-z][\\w-]{0,63}$"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "airtable.upsert",
                    "airtable.read",
                    "slack.post",
                    "notion.create_page",
                    "notion.append_blocks",
                    "linear.completed_issues",
                    "stripe.read_session",
                    "core.group_markdown",
                    "core.pick"
                  ]
                },
                "connectionId": {
                  "type": "string",
                  "minLength": 1
                },
                "input": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/$defs/__schema0"
                  }
                },
                "when": {
                  "type": "object",
                  "properties": {
                    "left": {
                      "$ref": "#/$defs/__schema0"
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "eq",
                        "ne",
                        "contains",
                        "gt",
                        "exists"
                      ]
                    },
                    "right": {
                      "$ref": "#/$defs/__schema0"
                    }
                  },
                  "required": [
                    "left",
                    "op"
                  ],
                  "additionalProperties": false
                },
                "forEach": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "$ref": "#/$defs/__schema0"
                    },
                    "maxItems": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    }
                  },
                  "required": [
                    "items",
                    "maxItems"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "id",
                "action",
                "input"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "schemaVersion",
          "name",
          "description",
          "trigger",
          "steps"
        ],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100000
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "maxItems": 1000,
                "type": "array",
                "items": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema0"
                }
              }
            ]
          }
        }
      }
    }
  }
}