{
  "openapi": "3.0.1",
  "info": {
    "title": "Gmail Inbox Intelligence",
    "description": "Friday triage list of client emails gone cold — over-SLA Gmail threads bucketed HOT / WARM / COLD by days silent vs SLA. Try the demo (no OAuth, tick \"Try demo\" → synthetic sample). Then paste 3 OAuth fields for real Gmail. MIT, gmail.readonly. $19 self-host / $99 done-for-you on Gumroad.",
    "version": "0.1",
    "x-build-id": "SY0uurSTGCaUPRv1T"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/foxck~gmail-inbox-intel/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-foxck-gmail-inbox-intel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/foxck~gmail-inbox-intel/runs": {
      "post": {
        "operationId": "runs-sync-foxck-gmail-inbox-intel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/foxck~gmail-inbox-intel/run-sync": {
      "post": {
        "operationId": "run-sync-foxck-gmail-inbox-intel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "feature"
        ],
        "properties": {
          "feature": {
            "title": "Feature",
            "enum": [
              "thread_search",
              "reply_metrics",
              "summarizer",
              "unread_digest",
              "reengage_angle"
            ],
            "type": "string",
            "description": "Choose which workflow to run.",
            "default": "thread_search"
          },
          "dry_run": {
            "title": "Try demo (no OAuth needed)",
            "type": "boolean",
            "description": "Check this on your first run. Returns a synthetic 5-thread output sample so you can see exactly what the Actor produces before setting up Gmail OAuth. Uncheck once OAuth is configured.",
            "default": false
          },
          "query": {
            "title": "Gmail Query",
            "type": "string",
            "description": "Gmail search query syntax, e.g. newer_than:7d in:inbox"
          },
          "max_results": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of threads to inspect in this run.",
            "default": 50
          },
          "oauth_token": {
            "title": "OAuth Config",
            "required": [
              "refresh_token",
              "client_id",
              "client_secret"
            ],
            "type": "object",
            "description": "Your own Gmail OAuth values. We do not persist your Gmail data or token secrets.",
            "properties": {
              "refresh_token": {
                "title": "Refresh Token",
                "type": "string",
                "description": "OAuth refresh token for Gmail API",
                "editor": "textfield"
              },
              "client_id": {
                "title": "Client ID",
                "type": "string",
                "description": "Google OAuth client ID",
                "editor": "textfield"
              },
              "client_secret": {
                "title": "Client Secret",
                "type": "string",
                "description": "Google OAuth client secret",
                "editor": "textfield"
              }
            }
          },
          "openai_api_key": {
            "title": "LLM API Key (Optional)",
            "type": "string",
            "description": "Optional API key for `summarizer` (thread summaries) and `reengage_angle` (drafts 3 re-engage email options per cold thread grounded in recent news). Both features work without a key — summarizer skips, reengage_angle still returns news headlines."
          },
          "summary_model": {
            "title": "Summary Model",
            "type": "string",
            "description": "Optional model name for summarizer feature.",
            "default": "gpt-4o-mini"
          },
          "free_tier_user_id": {
            "title": "Free Tier User ID",
            "type": "string",
            "description": "Stable identifier for monthly free quota tracking in KeyValueStore."
          },
          "sla_days": {
            "title": "SLA Days (reply_metrics / reengage_angle)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Days of silence after which a thread is flagged as over-SLA / cold (cold tier).",
            "default": 14
          },
          "dormant_days": {
            "title": "Dormant Days (reengage_angle)",
            "minimum": 30,
            "maximum": 365,
            "type": "integer",
            "description": "Threads silent this long enter the 'dormant' tier — context has faded, fresh news-grounded re-entry required (matches the 6-month-cold scenario in r/sales 1tdngew).",
            "default": 90
          },
          "include_reengage_angles": {
            "title": "Include Re-engage News Angles (reply_metrics only)",
            "type": "boolean",
            "description": "When running `reply_metrics`, append Google News headlines about each over-SLA thread's counterparty as suggested re-engage angles. Same data the standalone `reengage_angle` feature returns, but inline. No API key required.",
            "default": false
          },
          "news_lookback_days": {
            "title": "News Lookback Days (reengage_angle)",
            "minimum": 7,
            "maximum": 365,
            "type": "integer",
            "description": "How far back to search Google News for re-engage angle headlines.",
            "default": 90
          },
          "max_news_per_thread": {
            "title": "Max News Items Per Thread (reengage_angle)",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Cap on how many Google News headlines to return per cold thread.",
            "default": 5
          },
          "from_domains": {
            "title": "Filter by Sender Domains (reply_metrics only)",
            "type": "array",
            "description": "Optional list of sender domains to restrict reply_metrics scope. Empty = all domains.",
            "default": [],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}