{
  "openapi": "3.1.0",
  "info": {
    "title": "Call Recordings",
    "description": "Call recordings and AI summaries.\n\nRecordings reach the inbox from the call tools connected to the account — Zoom, Fathom, JustCall and Sendblue — and are stored against the chat for the contact on the call. Playback URLs are signed and short-lived: fetch the recording again rather than storing a URL. Recordings and transcripts are deleted within 180 days, as committed in the Data Processing Agreement. **Obtaining consent to record a call is the account's responsibility, not iClosed's**, and local law on that varies. `generateSummary` sends the transcript, or the audio where no transcript exists, to an AI subprocessor listed in the DPA; do not generate summaries for calls whose participants have not consented to that processing.",
    "version": "1.0.0",
    "contact": {
      "name": "iClosed.io Support",
      "url": "https://app.iclosed.io/support"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://app.iclosed.io/terms"
    }
  },
  "servers": [
    {
      "url": "https://uinboxpub.api.iclosed.io",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "API key required in Authorization header. Format: `iclosed_<token>`"
      },
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.1 authorization code with PKCE. Tokens are issued by the iClosed authorization server and accepted by the Unified Inbox API.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.iclosed.io/oauth/authorize",
            "tokenUrl": "https://public.api.iclosed.io/v1/oauth/token",
            "refreshUrl": "https://public.api.iclosed.io/v1/oauth/token",
            "scopes": {
              "inbox.chats:read": "Read inbox chats",
              "inbox.chats:write": "Create, update and assign inbox chats",
              "inbox.messages:read": "Read inbox messages",
              "inbox.messages:write": "Send and retry inbox messages",
              "inbox.connections:read": "Read channel connections",
              "inbox.analytics:read": "Read inbox analytics",
              "inbox.recordings:read": "Read call recordings",
              "inbox.recordings:write": "Generate call recording summaries",
              "inbox.workflows:read": "Read inbox workflows"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/v1/callRecordings": {
      "get": {
        "operationId": "getCallRecording",
        "security": [
          {
            "bearerAuth": [
              "inbox.recordings:read"
            ]
          },
          {
            "oauth2": [
              "inbox.recordings:read"
            ]
          }
        ],
        "summary": "Get call recording",
        "description": "Returns one call recording by its id, with its transcript, any stored summary and a short-lived playback URL.",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{24}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The recording, with its transcript and any stored summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "chatId": {
                          "type": "string"
                        },
                        "connectionId": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "timestamp": {
                          "description": "When the call took place.",
                          "type": "string"
                        },
                        "duration": {
                          "description": "Call length in seconds.",
                          "type": "number"
                        },
                        "source": {
                          "description": "Where the recording came from: zoom, fathom, justcall or sendblue.",
                          "type": "string"
                        },
                        "mediaStatus": {
                          "description": "Whether the audio is ready to play.",
                          "type": "string"
                        },
                        "audioPath": {
                          "type": "string"
                        },
                        "recordingPath": {
                          "type": "string"
                        },
                        "audioUrl": {
                          "description": "Short-lived signed URL. Re-fetch the recording once it expires.",
                          "type": "string"
                        },
                        "recordingUrl": {
                          "description": "Short-lived signed URL. Re-fetch the recording once it expires.",
                          "type": "string"
                        },
                        "transcript": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "speaker": {
                                "type": "string"
                              },
                              "text": {
                                "type": "string"
                              },
                              "time": {
                                "description": "Offset into the recording.",
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  }
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "summary": {
                          "description": "Present only once a summary has been generated.",
                          "type": "object",
                          "properties": {
                            "content": {
                              "description": "The generated summary text.",
                              "type": "string"
                            },
                            "toneId": {
                              "description": "The summary tone it was written in.",
                              "type": "string"
                            },
                            "generatedAt": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "_id",
                        "chatId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request or validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "The first problem, as \"field: reason\". It is one of the entries in details, not a separate sentence.",
                      "type": "string"
                    },
                    "details": {
                      "description": "Present on a validation failure.",
                      "type": "object",
                      "properties": {
                        "formErrors": {
                          "description": "Problems with the request as a whole, which no single field accounts for.",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "fieldErrors": {
                          "description": "Field name to the problems with it. A field the endpoint does not accept is listed here under its own name, with \"Unrecognized key\".",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "formErrors",
                        "fieldErrors"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "invalidValue": {
                    "summary": "A field was out of range",
                    "value": {
                      "message": "limit: Too big: expected number to be <=500",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "limit": [
                            "Too big: expected number to be <=500"
                          ]
                        }
                      }
                    }
                  },
                  "unknownField": {
                    "summary": "The body carried a field the endpoint does not accept",
                    "value": {
                      "message": "notAField: Unrecognized key",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "notAField": [
                            "Unrecognized key"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized – missing, invalid, or expired API key (Bearer token required). An expired key returns message \"API key expired\".",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"API key is required\", \"Invalid API key\", or \"API key expired\"",
                      "type": "string"
                    },
                    "code": {
                      "description": "Optional code e.g. MISSING_API_KEY when rate limiter runs before valid auth",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "missing": {
                    "summary": "Missing API key",
                    "value": {
                      "message": "API key is required"
                    }
                  },
                  "invalid": {
                    "summary": "Invalid API key",
                    "value": {
                      "message": "Invalid API key"
                    }
                  },
                  "expired": {
                    "summary": "Expired API key",
                    "value": {
                      "message": "API key expired"
                    }
                  },
                  "missingFromRateLimiter": {
                    "summary": "Missing auth when rate limiter runs first",
                    "value": {
                      "code": "MISSING_API_KEY",
                      "message": "API key is required for this endpoint"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden – insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "message": "Forbidden access"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found (e.g. NOT_FOUND, RECORD_NOT_FOUND, EVENT_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"Resource not found!\" or \"Record not found!\"",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic not found",
                    "value": {
                      "message": "Resource not found!"
                    }
                  },
                  "record": {
                    "summary": "Record not found",
                    "value": {
                      "message": "Record not found!"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Each plan has its own allowance per endpoint per 10 seconds: Startup 20, Growth 50, Business 100. Response includes RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After headers.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Maximum requests allowed in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests remaining in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Reset": {
                "description": "ISO 8601 timestamp when the rate limit window resets",
                "schema": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "Retry-After": {
                "description": "Seconds until the client can retry (when applicable)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "code": {
                      "description": "Fixed code for rate limit responses",
                      "type": "string",
                      "const": "RATE_LIMIT_EXCEEDED"
                    },
                    "message": {
                      "description": "e.g. \"Too many requests, please try again later.\"",
                      "type": "string"
                    },
                    "retryAfter": {
                      "description": "Seconds until the rate limit window resets",
                      "type": "number"
                    },
                    "limit": {
                      "description": "The plan limit that was applied, per endpoint per 10 seconds: Startup 20, Growth 50, Business 100.",
                      "type": "object",
                      "properties": {
                        "points": {
                          "type": "number"
                        },
                        "windowSec": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "points",
                        "windowSec"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests, please try again later.",
                  "retryAfter": 10,
                  "limit": {
                    "points": 20,
                    "windowSec": 10
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Unhandled errors return a generic message; no stack trace is ever returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "Generic: \"Something went wrong\", or a safe error message",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic",
                    "value": {
                      "message": "Something went wrong"
                    }
                  },
                  "withMessage": {
                    "summary": "Error with message",
                    "value": {
                      "message": "Database connection failed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/callRecordings/list": {
      "get": {
        "operationId": "listCallRecordings",
        "security": [
          {
            "bearerAuth": [
              "inbox.recordings:read"
            ]
          },
          {
            "oauth2": [
              "inbox.recordings:read"
            ]
          }
        ],
        "summary": "List call recordings",
        "description": "Lists the call recordings attached to one chat. page is zero-based and defaults to 0. Omitting limit returns every recording on the chat; when set it cannot exceed 100. search matches the recording title literally, and channel narrows by recording source.",
        "parameters": [
          {
            "name": "chatId",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{24}$"
            },
            "required": true
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "description": "Zero-based page index. The first page is 0.",
              "example": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 2147483647
            },
            "description": "Zero-based page index. The first page is 0."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "description": "Number of recordings to return. Maximum 100.",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Number of recordings to return. Maximum 100."
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "description": "Title text to match. Special characters are matched literally.",
              "type": "string"
            },
            "description": "Title text to match. Special characters are matched literally."
          },
          {
            "name": "channel",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "zoom",
                "linq",
                "fathom",
                "sendblue",
                "microsoftTeams",
                "twilio",
                "justcall",
                "whatsappCloudApi",
                "facebookMessenger"
              ]
            },
            "description": "Recording source. Allowed values: zoom, linq, fathom, sendblue, microsoftTeams, twilio, justcall, whatsappCloudApi, facebookMessenger."
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the chat's recordings.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "list": {
                          "description": "The page of recordings.",
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "chatId": {
                                "type": "string"
                              },
                              "connectionId": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "timestamp": {
                                "type": "string"
                              },
                              "duration": {
                                "type": "number"
                              },
                              "source": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "mediaStatus": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "string"
                              },
                              "updatedAt": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "_id",
                              "chatId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "count": {
                          "description": "Total recordings on the chat.",
                          "type": "integer"
                        },
                        "currentPage": {
                          "description": "Zero-based index of the page returned.",
                          "type": "integer"
                        },
                        "hasMore": {
                          "description": "True when a later page exists.",
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "list",
                        "count",
                        "currentPage",
                        "hasMore"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request or validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "The first problem, as \"field: reason\". It is one of the entries in details, not a separate sentence.",
                      "type": "string"
                    },
                    "details": {
                      "description": "Present on a validation failure.",
                      "type": "object",
                      "properties": {
                        "formErrors": {
                          "description": "Problems with the request as a whole, which no single field accounts for.",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "fieldErrors": {
                          "description": "Field name to the problems with it. A field the endpoint does not accept is listed here under its own name, with \"Unrecognized key\".",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "formErrors",
                        "fieldErrors"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "invalidValue": {
                    "summary": "A field was out of range",
                    "value": {
                      "message": "limit: Too big: expected number to be <=500",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "limit": [
                            "Too big: expected number to be <=500"
                          ]
                        }
                      }
                    }
                  },
                  "unknownField": {
                    "summary": "The body carried a field the endpoint does not accept",
                    "value": {
                      "message": "notAField: Unrecognized key",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "notAField": [
                            "Unrecognized key"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized – missing, invalid, or expired API key (Bearer token required). An expired key returns message \"API key expired\".",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"API key is required\", \"Invalid API key\", or \"API key expired\"",
                      "type": "string"
                    },
                    "code": {
                      "description": "Optional code e.g. MISSING_API_KEY when rate limiter runs before valid auth",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "missing": {
                    "summary": "Missing API key",
                    "value": {
                      "message": "API key is required"
                    }
                  },
                  "invalid": {
                    "summary": "Invalid API key",
                    "value": {
                      "message": "Invalid API key"
                    }
                  },
                  "expired": {
                    "summary": "Expired API key",
                    "value": {
                      "message": "API key expired"
                    }
                  },
                  "missingFromRateLimiter": {
                    "summary": "Missing auth when rate limiter runs first",
                    "value": {
                      "code": "MISSING_API_KEY",
                      "message": "API key is required for this endpoint"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden – insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "message": "Forbidden access"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found (e.g. NOT_FOUND, RECORD_NOT_FOUND, EVENT_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"Resource not found!\" or \"Record not found!\"",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic not found",
                    "value": {
                      "message": "Resource not found!"
                    }
                  },
                  "record": {
                    "summary": "Record not found",
                    "value": {
                      "message": "Record not found!"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Each plan has its own allowance per endpoint per 10 seconds: Startup 20, Growth 50, Business 100. Response includes RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After headers.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Maximum requests allowed in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests remaining in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Reset": {
                "description": "ISO 8601 timestamp when the rate limit window resets",
                "schema": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "Retry-After": {
                "description": "Seconds until the client can retry (when applicable)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "code": {
                      "description": "Fixed code for rate limit responses",
                      "type": "string",
                      "const": "RATE_LIMIT_EXCEEDED"
                    },
                    "message": {
                      "description": "e.g. \"Too many requests, please try again later.\"",
                      "type": "string"
                    },
                    "retryAfter": {
                      "description": "Seconds until the rate limit window resets",
                      "type": "number"
                    },
                    "limit": {
                      "description": "The plan limit that was applied, per endpoint per 10 seconds: Startup 20, Growth 50, Business 100.",
                      "type": "object",
                      "properties": {
                        "points": {
                          "type": "number"
                        },
                        "windowSec": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "points",
                        "windowSec"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests, please try again later.",
                  "retryAfter": 10,
                  "limit": {
                    "points": 20,
                    "windowSec": 10
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Unhandled errors return a generic message; no stack trace is ever returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "Generic: \"Something went wrong\", or a safe error message",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic",
                    "value": {
                      "message": "Something went wrong"
                    }
                  },
                  "withMessage": {
                    "summary": "Error with message",
                    "value": {
                      "message": "Database connection failed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/callRecordings/summaryTones": {
      "get": {
        "operationId": "listSummaryTones",
        "security": [
          {
            "bearerAuth": [
              "inbox.recordings:read"
            ]
          },
          {
            "oauth2": [
              "inbox.recordings:read"
            ]
          }
        ],
        "summary": "List summary tones",
        "description": "Lists the summary tones for the authenticated account. Use an _id as summaryToneId when generating a summary.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "The summary tones on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "description": "Pass this as summaryToneId when generating a summary.",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "prompt": {
                            "description": "The instruction the tone applies.",
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "_id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request or validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "The first problem, as \"field: reason\". It is one of the entries in details, not a separate sentence.",
                      "type": "string"
                    },
                    "details": {
                      "description": "Present on a validation failure.",
                      "type": "object",
                      "properties": {
                        "formErrors": {
                          "description": "Problems with the request as a whole, which no single field accounts for.",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "fieldErrors": {
                          "description": "Field name to the problems with it. A field the endpoint does not accept is listed here under its own name, with \"Unrecognized key\".",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "formErrors",
                        "fieldErrors"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "invalidValue": {
                    "summary": "A field was out of range",
                    "value": {
                      "message": "limit: Too big: expected number to be <=500",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "limit": [
                            "Too big: expected number to be <=500"
                          ]
                        }
                      }
                    }
                  },
                  "unknownField": {
                    "summary": "The body carried a field the endpoint does not accept",
                    "value": {
                      "message": "notAField: Unrecognized key",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "notAField": [
                            "Unrecognized key"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized – missing, invalid, or expired API key (Bearer token required). An expired key returns message \"API key expired\".",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"API key is required\", \"Invalid API key\", or \"API key expired\"",
                      "type": "string"
                    },
                    "code": {
                      "description": "Optional code e.g. MISSING_API_KEY when rate limiter runs before valid auth",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "missing": {
                    "summary": "Missing API key",
                    "value": {
                      "message": "API key is required"
                    }
                  },
                  "invalid": {
                    "summary": "Invalid API key",
                    "value": {
                      "message": "Invalid API key"
                    }
                  },
                  "expired": {
                    "summary": "Expired API key",
                    "value": {
                      "message": "API key expired"
                    }
                  },
                  "missingFromRateLimiter": {
                    "summary": "Missing auth when rate limiter runs first",
                    "value": {
                      "code": "MISSING_API_KEY",
                      "message": "API key is required for this endpoint"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden – insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "message": "Forbidden access"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found (e.g. NOT_FOUND, RECORD_NOT_FOUND, EVENT_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"Resource not found!\" or \"Record not found!\"",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic not found",
                    "value": {
                      "message": "Resource not found!"
                    }
                  },
                  "record": {
                    "summary": "Record not found",
                    "value": {
                      "message": "Record not found!"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Each plan has its own allowance per endpoint per 10 seconds: Startup 20, Growth 50, Business 100. Response includes RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After headers.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Maximum requests allowed in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests remaining in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Reset": {
                "description": "ISO 8601 timestamp when the rate limit window resets",
                "schema": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "Retry-After": {
                "description": "Seconds until the client can retry (when applicable)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "code": {
                      "description": "Fixed code for rate limit responses",
                      "type": "string",
                      "const": "RATE_LIMIT_EXCEEDED"
                    },
                    "message": {
                      "description": "e.g. \"Too many requests, please try again later.\"",
                      "type": "string"
                    },
                    "retryAfter": {
                      "description": "Seconds until the rate limit window resets",
                      "type": "number"
                    },
                    "limit": {
                      "description": "The plan limit that was applied, per endpoint per 10 seconds: Startup 20, Growth 50, Business 100.",
                      "type": "object",
                      "properties": {
                        "points": {
                          "type": "number"
                        },
                        "windowSec": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "points",
                        "windowSec"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests, please try again later.",
                  "retryAfter": 10,
                  "limit": {
                    "points": 20,
                    "windowSec": 10
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Unhandled errors return a generic message; no stack trace is ever returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "Generic: \"Something went wrong\", or a safe error message",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic",
                    "value": {
                      "message": "Something went wrong"
                    }
                  },
                  "withMessage": {
                    "summary": "Error with message",
                    "value": {
                      "message": "Database connection failed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/callRecordings/generateSummary": {
      "post": {
        "operationId": "generateRecordingSummary",
        "security": [
          {
            "bearerAuth": [
              "inbox.recordings:write"
            ]
          },
          {
            "oauth2": [
              "inbox.recordings:write"
            ]
          }
        ],
        "summary": "Generate recording summary",
        "description": "Returns immediately. summaryToneId comes from GET /v1/callRecordings/summaryTones for this account. status ready means this body includes the summary already stored for that tone. status processing means generation was queued; poll GET /v1/callRecordings/?id={recordingId} until summary.toneId matches the requested tone.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. A unique value of your own, up to 255 printable characters without spaces — a UUID is ideal. The first request carrying it is processed; any later request with the same key returns that first response instead of repeating the work, for 24 hours. A replayed response carries Idempotency-Replayed: true. Reuse the key when you retry after a timeout, and change it when you mean to send again.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "http://json-schema.org/draft-07/schema#",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "chatId": {
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "summaryToneId": {
                    "description": "Id from GET /v1/callRecordings/summaryTones. The tone must belong to this account.",
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{24}$"
                  }
                },
                "required": [
                  "id",
                  "chatId",
                  "summaryToneId"
                ],
                "additionalProperties": false,
                "example": {
                  "id": "507f1f77bcf86cd799439011",
                  "chatId": "507f1f77bcf86cd799439012",
                  "summaryToneId": "507f1f77bcf86cd799439013"
                }
              },
              "example": {
                "id": "507f1f77bcf86cd799439011",
                "chatId": "507f1f77bcf86cd799439012",
                "summaryToneId": "507f1f77bcf86cd799439013"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cached summary, or an accepted generation job",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "const": "ready"
                            },
                            "summary": {
                              "type": "object",
                              "properties": {
                                "toneId": {
                                  "type": "string"
                                },
                                "content": {
                                  "type": "string"
                                },
                                "generatedAt": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": false
                            },
                            "transcript": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "speaker": {
                                    "type": "string"
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "time": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "recordingUrl": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "status"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "const": "processing"
                            },
                            "recordingId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "status",
                            "recordingId"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "ready": {
                    "summary": "Summary already stored for this tone",
                    "value": {
                      "data": {
                        "status": "ready",
                        "summary": {
                          "toneId": "507f1f77bcf86cd799439013",
                          "content": "Agreed Thursday at 3pm.",
                          "generatedAt": "2026-03-15T15:10:00.000Z"
                        },
                        "transcript": [
                          {
                            "speaker": "Alex",
                            "text": "Thursday works.",
                            "time": "00:01:20"
                          }
                        ]
                      }
                    }
                  },
                  "processing": {
                    "summary": "Generation queued",
                    "description": "Poll GET /v1/callRecordings/?id={recordingId} until summary.toneId matches the requested tone.",
                    "value": {
                      "data": {
                        "status": "processing",
                        "recordingId": "507f1f77bcf86cd799439011"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request or validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "The first problem, as \"field: reason\". It is one of the entries in details, not a separate sentence.",
                      "type": "string"
                    },
                    "details": {
                      "description": "Present on a validation failure.",
                      "type": "object",
                      "properties": {
                        "formErrors": {
                          "description": "Problems with the request as a whole, which no single field accounts for.",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "fieldErrors": {
                          "description": "Field name to the problems with it. A field the endpoint does not accept is listed here under its own name, with \"Unrecognized key\".",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "formErrors",
                        "fieldErrors"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "invalidValue": {
                    "summary": "A field was out of range",
                    "value": {
                      "message": "limit: Too big: expected number to be <=500",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "limit": [
                            "Too big: expected number to be <=500"
                          ]
                        }
                      }
                    }
                  },
                  "unknownField": {
                    "summary": "The body carried a field the endpoint does not accept",
                    "value": {
                      "message": "notAField: Unrecognized key",
                      "details": {
                        "formErrors": [],
                        "fieldErrors": {
                          "notAField": [
                            "Unrecognized key"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized – missing, invalid, or expired API key (Bearer token required). An expired key returns message \"API key expired\".",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"API key is required\", \"Invalid API key\", or \"API key expired\"",
                      "type": "string"
                    },
                    "code": {
                      "description": "Optional code e.g. MISSING_API_KEY when rate limiter runs before valid auth",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "missing": {
                    "summary": "Missing API key",
                    "value": {
                      "message": "API key is required"
                    }
                  },
                  "invalid": {
                    "summary": "Invalid API key",
                    "value": {
                      "message": "Invalid API key"
                    }
                  },
                  "expired": {
                    "summary": "Expired API key",
                    "value": {
                      "message": "API key expired"
                    }
                  },
                  "missingFromRateLimiter": {
                    "summary": "Missing auth when rate limiter runs first",
                    "value": {
                      "code": "MISSING_API_KEY",
                      "message": "API key is required for this endpoint"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden – insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "message": "Forbidden access"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found (e.g. NOT_FOUND, RECORD_NOT_FOUND, EVENT_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"Resource not found!\" or \"Record not found!\"",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic not found",
                    "value": {
                      "message": "Resource not found!"
                    }
                  },
                  "record": {
                    "summary": "Record not found",
                    "value": {
                      "message": "Record not found!"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "A request with the same Idempotency-Key is still in progress. Wait for it to finish and read the replayed response, rather than sending again.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "e.g. \"A request with this Idempotency-Key is still in progress.\"",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "message": "A request with this Idempotency-Key is still in progress. Retry once it finishes."
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Each plan has its own allowance per endpoint per 10 seconds: Startup 20, Growth 50, Business 100. Response includes RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After headers.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Maximum requests allowed in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests remaining in the current window",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Reset": {
                "description": "ISO 8601 timestamp when the rate limit window resets",
                "schema": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "Retry-After": {
                "description": "Seconds until the client can retry (when applicable)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "code": {
                      "description": "Fixed code for rate limit responses",
                      "type": "string",
                      "const": "RATE_LIMIT_EXCEEDED"
                    },
                    "message": {
                      "description": "e.g. \"Too many requests, please try again later.\"",
                      "type": "string"
                    },
                    "retryAfter": {
                      "description": "Seconds until the rate limit window resets",
                      "type": "number"
                    },
                    "limit": {
                      "description": "The plan limit that was applied, per endpoint per 10 seconds: Startup 20, Growth 50, Business 100.",
                      "type": "object",
                      "properties": {
                        "points": {
                          "type": "number"
                        },
                        "windowSec": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "points",
                        "windowSec"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests, please try again later.",
                  "retryAfter": 10,
                  "limit": {
                    "points": 20,
                    "windowSec": 10
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Unhandled errors return a generic message; no stack trace is ever returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "message": {
                      "description": "Generic: \"Something went wrong\", or a safe error message",
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                },
                "examples": {
                  "generic": {
                    "summary": "Generic",
                    "value": {
                      "message": "Something went wrong"
                    }
                  },
                  "withMessage": {
                    "summary": "Error with message",
                    "value": {
                      "message": "Database connection failed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}