{
  "openapi": "3.1.1",
  "info": {
    "title": "Parley Chat Transcript API",
    "version": "1.0.0",
    "summary": "Turn a Parley channel export into a readable Markdown, HTML or text transcript.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://parleytranscript.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Turn a Parley channel export into a readable Markdown, HTML or text transcript.",
        "description": "Converts a Parley channel export (JSON, format “parley-channel”) into a clean transcript: messages grouped by day, replies nested under their thread or in time order, mentions shown as @names, links kept, edited/pinned marks, reactions, attachments and linked items listed. Also counts messages, threads, replies and messages per person. Deterministic: times use a fixed UTC offset you choose.\n\nMethodology:\n- The export is validated first: format “parley-channel” version 1, unique message ids, ISO times, replies only to earlier messages, at most 20,000 messages and 4,000 characters per message.\n- Each message body is parsed with Parley’s chat Markdown subset (bold, italic, code, links, lists, quotes, code blocks). Raw HTML is never passed through: in the HTML transcript every character is escaped and links are limited to http(s) and mailto.\n- Mentions are stored as user ids and printed as @name from the export’s member list; unknown ids print as “@former member”.\n- Times are formatted from the stored UTC times plus the fixed offset you give, so the same export always gives the same transcript (no daylight-saving guess).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "parley_transcript",
        "x-owner-app": "parley",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ParleyTranscriptInput"
              },
              "examples": {
                "example1": {
                  "summary": "Launch channel as Markdown (CET)",
                  "value": {
                    "export": "{\"format\":\"parley-channel\",\"version\":1,\"exportedAt\":\"2026-12-02T10:00:00Z\",\"workspace\":{\"id\":\"ws_demo01\",\"name\":\"Studio Nord\"},\"channel\":{\"id\":\"ch_launch1\",\"name\":\"launch\",\"kind\":\"public\",\"topic\":\"Website relaunch on 15 December\"},\"members\":[{\"id\":\"u_ana0001\",\"name\":\"Ana\"},{\"id\":\"u_ben0002\",\"name\":\"Ben\"},{\"id\":\"u_cleo003\",\"name\":\"Cleo\"}],\"messages\":[{\"id\":\"m1\",\"threadId\":null,\"author\":\"u_ana0001\",\"authorName\":\"Ana\",\"at\":\"2026-12-01T08:58:00Z\",\"body\":\"Morning! Staging is up: https://staging.example.com\\n**Please test** the checkout before noon.\",\"pinned\":true,\"reactions\":[{\"emoji\":\"👍\",\"users\":[\"Ben\",\"Cleo\"]}]},{\"id\":\"m2\",\"threadId\":\"m1\",\"author\":\"u_ben0002\",\"authorName\":\"Ben\",\"at\":\"2026-12-01T09:12:00Z\",\"body\":\"Found one bug: the coupon field accepts `-10`. \u003c@u_ana0001\u003e shall I file it?\"},{\"id\":\"m3\",\"threadId\":\"m1\",\"author\":\"u_ana0001\",\"authorName\":\"Ana\",\"at\":\"2026-12-01T09:15:00Z\",\"body\":\"Yes please, and assign it to \u003c@u_cleo003\u003e.\",\"editedAt\":\"2026-12-01T09:16:00Z\"},{\"id\":\"m4\",\"threadId\":null,\"author\":\"u_cleo003\",\"authorName\":\"Cleo\",\"at\":\"2026-12-01T13:40:00Z\",\"body\":\"Checklist for go-live:\\n- DNS switch\\n- redirects for old URLs\\n- *announce* in @channel\"},{\"id\":\"m5\",\"threadId\":null,\"author\":\"u_ben0002\",\"authorName\":\"Ben\",\"at\":\"2026-12-02T07:05:00Z\",\"body\":\"Coupon bug fixed ✅\"}]}",
                    "format": "markdown",
                    "threads": "nested",
                    "utcOffset": 1
                  }
                },
                "example2": {
                  "summary": "Same channel as an HTML page",
                  "value": {
                    "export": "{\"format\":\"parley-channel\",\"version\":1,\"exportedAt\":\"2026-12-02T10:00:00Z\",\"workspace\":{\"id\":\"ws_demo01\",\"name\":\"Studio Nord\"},\"channel\":{\"id\":\"ch_launch1\",\"name\":\"launch\",\"kind\":\"public\",\"topic\":\"Website relaunch on 15 December\"},\"members\":[{\"id\":\"u_ana0001\",\"name\":\"Ana\"},{\"id\":\"u_ben0002\",\"name\":\"Ben\"},{\"id\":\"u_cleo003\",\"name\":\"Cleo\"}],\"messages\":[{\"id\":\"m1\",\"threadId\":null,\"author\":\"u_ana0001\",\"authorName\":\"Ana\",\"at\":\"2026-12-01T08:58:00Z\",\"body\":\"Morning! Staging is up: https://staging.example.com\\n**Please test** the checkout before noon.\",\"pinned\":true,\"reactions\":[{\"emoji\":\"👍\",\"users\":[\"Ben\",\"Cleo\"]}]},{\"id\":\"m2\",\"threadId\":\"m1\",\"author\":\"u_ben0002\",\"authorName\":\"Ben\",\"at\":\"2026-12-01T09:12:00Z\",\"body\":\"Found one bug: the coupon field accepts `-10`. \u003c@u_ana0001\u003e shall I file it?\"},{\"id\":\"m3\",\"threadId\":\"m1\",\"author\":\"u_ana0001\",\"authorName\":\"Ana\",\"at\":\"2026-12-01T09:15:00Z\",\"body\":\"Yes please, and assign it to \u003c@u_cleo003\u003e.\",\"editedAt\":\"2026-12-01T09:16:00Z\"},{\"id\":\"m4\",\"threadId\":null,\"author\":\"u_cleo003\",\"authorName\":\"Cleo\",\"at\":\"2026-12-01T13:40:00Z\",\"body\":\"Checklist for go-live:\\n- DNS switch\\n- redirects for old URLs\\n- *announce* in @channel\"},{\"id\":\"m5\",\"threadId\":null,\"author\":\"u_ben0002\",\"authorName\":\"Ben\",\"at\":\"2026-12-02T07:05:00Z\",\"body\":\"Coupon bug fixed ✅\"}]}",
                    "format": "html",
                    "threads": "nested",
                    "utcOffset": 0
                  }
                },
                "example3": {
                  "summary": "Plain text in time order",
                  "value": {
                    "export": "{\"format\":\"parley-channel\",\"version\":1,\"exportedAt\":\"2026-12-02T10:00:00Z\",\"workspace\":{\"id\":\"ws_demo01\",\"name\":\"Studio Nord\"},\"channel\":{\"id\":\"ch_launch1\",\"name\":\"launch\",\"kind\":\"public\",\"topic\":\"Website relaunch on 15 December\"},\"members\":[{\"id\":\"u_ana0001\",\"name\":\"Ana\"},{\"id\":\"u_ben0002\",\"name\":\"Ben\"},{\"id\":\"u_cleo003\",\"name\":\"Cleo\"}],\"messages\":[{\"id\":\"m1\",\"threadId\":null,\"author\":\"u_ana0001\",\"authorName\":\"Ana\",\"at\":\"2026-12-01T08:58:00Z\",\"body\":\"Morning! Staging is up: https://staging.example.com\\n**Please test** the checkout before noon.\",\"pinned\":true,\"reactions\":[{\"emoji\":\"👍\",\"users\":[\"Ben\",\"Cleo\"]}]},{\"id\":\"m2\",\"threadId\":\"m1\",\"author\":\"u_ben0002\",\"authorName\":\"Ben\",\"at\":\"2026-12-01T09:12:00Z\",\"body\":\"Found one bug: the coupon field accepts `-10`. \u003c@u_ana0001\u003e shall I file it?\"},{\"id\":\"m3\",\"threadId\":\"m1\",\"author\":\"u_ana0001\",\"authorName\":\"Ana\",\"at\":\"2026-12-01T09:15:00Z\",\"body\":\"Yes please, and assign it to \u003c@u_cleo003\u003e.\",\"editedAt\":\"2026-12-01T09:16:00Z\"},{\"id\":\"m4\",\"threadId\":null,\"author\":\"u_cleo003\",\"authorName\":\"Cleo\",\"at\":\"2026-12-01T13:40:00Z\",\"body\":\"Checklist for go-live:\\n- DNS switch\\n- redirects for old URLs\\n- *announce* in @channel\"},{\"id\":\"m5\",\"threadId\":null,\"author\":\"u_ben0002\",\"authorName\":\"Ben\",\"at\":\"2026-12-02T07:05:00Z\",\"body\":\"Coupon bug fixed ✅\"}]}",
                    "format": "text",
                    "threads": "flat",
                    "utcOffset": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ParleyTranscriptResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ParleyTranscriptInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "export": {
            "title": "Channel export (JSON)",
            "description": "In Parley: channel menu → Export channel (JSON). The file is read, not uploaded anywhere else.",
            "type": "string",
            "maxLength": 5000000,
            "default": "{\n  \"format\": \"parley-channel\",\n  \"version\": 1,\n  \"exportedAt\": \"2026-12-02T10:00:00Z\",\n  \"workspace\": {\n    \"id\": \"ws_demo01\",\n    \"name\": \"Studio Nord\"\n  },\n  \"channel\": {\n    \"id\": \"ch_launch1\",\n    \"name\": \"launch\",\n    \"kind\": \"public\",\n    \"topic\": \"Website relaunch on 15 December\"\n  },\n  \"members\": [\n    {\n      \"id\": \"u_ana0001\",\n      \"name\": \"Ana\"\n    },\n    {\n      \"id\": \"u_ben0002\",\n      \"name\": \"Ben\"\n    },\n    {\n      \"id\": \"u_cleo003\",\n      \"name\": \"Cleo\"\n    }\n  ],\n  \"messages\": [\n    {\n      \"id\": \"m1\",\n      \"threadId\": null,\n      \"author\": \"u_ana0001\",\n      \"authorName\": \"Ana\",\n      \"at\": \"2026-12-01T08:58:00Z\",\n      \"body\": \"Morning! Staging is up: https://staging.example.com\\n**Please test** the checkout before noon.\",\n      \"pinned\": true,\n      \"reactions\": [\n        {\n          \"emoji\": \"👍\",\n          \"users\": [\n            \"Ben\",\n            \"Cleo\"\n          ]\n        }\n      ]\n    },\n    {\n      \"id\": \"m2\",\n      \"threadId\": \"m1\",\n      \"author\": \"u_ben0002\",\n      \"authorName\": \"Ben\",\n      \"at\": \"2026-12-01T09:12:00Z\",\n      \"body\": \"Found one bug: the coupon field accepts `-10`. \u003c@u_ana0001\u003e shall I file it?\"\n    },\n    {\n      \"id\": \"m3\",\n      \"threadId\": \"m1\",\n      \"author\": \"u_ana0001\",\n      \"authorName\": \"Ana\",\n      \"at\": \"2026-12-01T09:15:00Z\",\n      \"body\": \"Yes please, and assign it to \u003c@u_cleo003\u003e.\",\n      \"editedAt\": \"2026-12-01T09:16:00Z\"\n    },\n    {\n      \"id\": \"m4\",\n      \"threadId\": null,\n      \"author\": \"u_cleo003\",\n      \"authorName\": \"Cleo\",\n      \"at\": \"2026-12-01T13:40:00Z\",\n      \"body\": \"Checklist for go-live:\\n- DNS switch\\n- redirects for old URLs\\n- *announce* in @channel\"\n    },\n    {\n      \"id\": \"m5\",\n      \"threadId\": null,\n      \"author\": \"u_ben0002\",\n      \"authorName\": \"Ben\",\n      \"at\": \"2026-12-02T07:05:00Z\",\n      \"body\": \"Coupon bug fixed ✅\"\n    }\n  ]\n}"
          },
          "format": {
            "title": "Transcript format",
            "type": "string",
            "enum": [
              "markdown",
              "html",
              "text"
            ],
            "default": "markdown"
          },
          "threads": {
            "title": "Thread replies",
            "type": "string",
            "enum": [
              "nested",
              "flat",
              "skip"
            ],
            "default": "nested"
          },
          "utcOffset": {
            "title": "Time zone offset (hours from UTC)",
            "description": "For example 1 for CET, -5 for New York in winter. Times are printed with this fixed offset.",
            "type": "number",
            "minimum": -14,
            "maximum": 14,
            "default": 0
          },
          "includeDeleted": {
            "title": "Show deleted messages as “Message deleted”",
            "type": "boolean",
            "default": false
          }
        },
        "required": []
      },
      "ParleyTranscriptResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "format",
              "filename",
              "mime",
              "content",
              "stats"
            ],
            "properties": {
              "format": {
                "enum": [
                  "markdown",
                  "html",
                  "text"
                ]
              },
              "filename": {
                "type": "string"
              },
              "mime": {
                "type": "string"
              },
              "content": {
                "type": "string"
              },
              "stats": {
                "type": "object",
                "properties": {
                  "messages": {
                    "type": "integer"
                  },
                  "topLevel": {
                    "type": "integer"
                  },
                  "replies": {
                    "type": "integer"
                  },
                  "threads": {
                    "type": "integer"
                  },
                  "participants": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "messages": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "first": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "last": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "days": {
                    "type": "integer"
                  },
                  "pinned": {
                    "type": "integer"
                  },
                  "reactions": {
                    "type": "integer"
                  },
                  "links": {
                    "type": "integer"
                  },
                  "mentions": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}