{
  "openapi": "3.1.0",
  "info": {
    "title": "InterMIND API",
    "version": "1.0.0",
    "summary": "Meeting links, recaps and recap-ready webhooks of an InterMIND account.",
    "description": "InterMIND is a communication space where every meeting is understood in 20+ languages. This API lets a tool create meeting links on behalf of a user, read the recaps of meetings they hosted, and subscribe a webhook that fires the moment a recap is ready. Authenticate with a personal API key (InterMIND → Settings → API keys) as a bearer token. Keys work on these endpoints only.",
    "contact": { "name": "InterMIND", "url": "https://intermind.com/docs/integrations/api-zapier", "email": "support@intermind.com" }
  },
  "servers": [{ "url": "https://intermind.com/api/v1" }],
  "security": [{ "apiKey": [] }],
  "tags": [
    { "name": "account" },
    { "name": "meetings" },
    { "name": "recaps" },
    { "name": "webhooks" }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getMe",
        "tags": ["account"],
        "summary": "Who owns this key",
        "responses": {
          "200": { "description": "The key's owner.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Me" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/meetings": {
      "post": {
        "operationId": "createMeeting",
        "tags": ["meetings"],
        "summary": "Create an ad-hoc meeting link",
        "description": "Creates a meeting owned by the key's user. Anyone with the link knocks; the owner approves them in the room. The room attaches on first join.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": { "type": "string", "maxLength": 512, "description": "Shown in the room and in the recap." },
                  "source": { "type": "string", "maxLength": 32, "description": "Name of the calling integration (zapier, mcp, …). Usage label only." }
                }
              }
            }
          }
        },
        "responses": {
          "201": { "description": "Created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Meeting" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/recaps": {
      "get": {
        "operationId": "listRecaps",
        "tags": ["recaps"],
        "summary": "Newest recaps of meetings the key's user hosted",
        "description": "Finalized sessions with a non-empty summary, newest first, in exactly the shape the `recap.ready` webhook delivers.",
        "parameters": [
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 10, "default": 3 } },
          { "name": "source", "in": "query", "schema": { "type": "string", "maxLength": 32 }, "description": "Name of the calling integration. Usage label only." }
        ],
        "responses": {
          "200": { "description": "Recaps, newest first.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Recap" } } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": ["webhooks"],
        "summary": "List webhook subscriptions",
        "responses": {
          "200": { "description": "Subscriptions of the key's user.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/WebhookSubscription" } } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      },
      "post": {
        "operationId": "subscribeWebhook",
        "tags": ["webhooks"],
        "summary": "Subscribe a URL to an event (REST hook)",
        "description": "`target_url` must be https and publicly reachable; private-network addresses are refused at delivery time. At most 20 subscriptions per account. A 410 or 404 from the target deletes the subscription.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["target_url", "event"],
                "properties": {
                  "target_url": { "type": "string", "format": "uri", "maxLength": 2048, "pattern": "^https://" },
                  "event": { "type": "string", "enum": ["recap.ready"] }
                }
              }
            }
          }
        },
        "responses": {
          "201": { "description": "Subscribed. `secret` signs every delivery (see the `recap.ready` webhook).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionWithSecret" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "422": { "description": "Subscription cap reached." }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "operationId": "unsubscribeWebhook",
        "tags": ["webhooks"],
        "summary": "Delete a webhook subscription",
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "204": { "description": "Deleted." },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "description": "Not this user's subscription, or already gone." }
        }
      }
    }
  },
  "webhooks": {
    "recap.ready": {
      "post": {
        "summary": "A recap of a meeting the user hosted is ready",
        "description": "Sent once per finished meeting session, the moment the summary exists. Headers: `X-InterMIND-Event: recap.ready`, `X-InterMIND-Delivery` (the payload `id`, deduplicate on it), `X-InterMIND-Signature: sha256=<HMAC-SHA256 of the raw body with the subscription secret>`, `User-Agent: InterMIND-Webhooks/1`. Answer 2xx within 8 seconds; a network error, 5xx or 429 is retried once immediately; 410 or 404 deletes the subscription; anything else is logged and not resent.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Recap" } } } },
        "responses": { "2xx": { "description": "Received." } }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": { "type": "http", "scheme": "bearer", "bearerFormat": "imk_… (InterMIND → Settings → API keys)" }
    },
    "responses": {
      "Unauthorized": { "description": "Missing, malformed or revoked API key." },
      "BadRequest": { "description": "Validation failed." }
    },
    "schemas": {
      "Me": {
        "type": "object",
        "required": ["id", "email", "name"],
        "properties": { "id": { "type": "string" }, "email": { "type": "string", "format": "email" }, "name": { "type": "string" } }
      },
      "Meeting": {
        "type": "object",
        "required": ["id", "url", "title", "created_at"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z]{3}-[a-z]{3}-[a-z]{3}$" },
          "url": { "type": "string", "format": "uri" },
          "title": { "type": ["string", "null"] },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "Participant": {
        "type": "object",
        "required": ["name", "email"],
        "properties": { "name": { "type": "string" }, "email": { "type": "string" } }
      },
      "Recap": {
        "type": "object",
        "required": ["id", "event", "occurred_at", "meeting", "recap", "session", "participants", "host"],
        "properties": {
          "id": { "type": "string", "description": "`<meeting id>.<session id>` — unique per delivery." },
          "event": { "type": "string", "enum": ["recap.ready"] },
          "occurred_at": { "type": "string", "format": "date-time" },
          "meeting": {
            "type": "object",
            "required": ["id", "title", "url", "type"],
            "properties": { "id": { "type": "string" }, "title": { "type": ["string", "null"] }, "url": { "type": "string", "format": "uri" }, "type": { "type": "string", "enum": ["adhoc", "channel"] } }
          },
          "recap": {
            "type": "object",
            "required": ["url", "transcript_url", "summary_md", "language"],
            "properties": {
              "url": { "type": ["string", "null"], "format": "uri", "description": "Full recap page; opens for signed-in participants." },
              "transcript_url": { "type": ["string", "null"], "format": "uri" },
              "summary_md": { "type": "string", "description": "The summary in Markdown." },
              "language": { "type": ["string", "null"], "description": "BCP-47 language of the summary." }
            }
          },
          "session": {
            "type": "object",
            "required": ["started_at", "ended_at"],
            "properties": { "started_at": { "type": ["string", "null"], "format": "date-time" }, "ended_at": { "type": ["string", "null"], "format": "date-time" } }
          },
          "participants": { "type": "array", "items": { "$ref": "#/components/schemas/Participant" } },
          "host": {
            "type": "object",
            "required": ["name", "email"],
            "properties": { "name": { "type": ["string", "null"] }, "email": { "type": ["string", "null"] } }
          }
        }
      },
      "WebhookSubscription": {
        "type": "object",
        "required": ["id", "event", "target_url", "created_at"],
        "properties": {
          "id": { "type": "string" },
          "event": { "type": "string", "enum": ["recap.ready"] },
          "target_url": { "type": "string", "format": "uri" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "WebhookSubscriptionWithSecret": {
        "allOf": [
          { "$ref": "#/components/schemas/WebhookSubscription" },
          { "type": "object", "required": ["secret"], "properties": { "secret": { "type": "string", "description": "HMAC key for `X-InterMIND-Signature`. Returned once." } } }
        ]
      }
    }
  }
}
