{
  "openapi": "3.1.0",
  "info": {
    "title": "Cradle API",
    "version": "2026-10-17",
    "description": "Read-only access to your organisation's Cradle calls, transcripts, summaries, recording audio and reports, for your own systems and integrations.\n\n**Private beta.** Your organisation must be added to the API private beta by Cradle. Paths and fields may change before general release.\n\nAuthenticate with an organisation API key, created by an organisation admin on the access page (/cli/access): `Authorization: Bearer cr_org_…`. A key only reaches the routes and content its scopes allow, and a key that can read call content only works from its IP allowlist. A personal Cradle Calls CLI token (`cr_pat_…`) works on the same routes, acting as its user.\n\nErrors are JSON: `{ \"error\": { \"code\": \"…\", \"message\": \"…\" } }`. Switch on `code`; `message` may change. Responses are never cacheable (`Cache-Control: no-store`).\n\nGuides: https://www.cradle.io/knowledge/cradle-api-private-beta"
  },
  "servers": [
    {
      "url": "https://reporting-api.cradle.io"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "Who the credential acts as"
    },
    {
      "name": "Calls",
      "description": "Calls, transcripts and summaries, and the change feed"
    },
    {
      "name": "Audio",
      "description": "Recording audio, served from where each recording is stored"
    },
    {
      "name": "Reports",
      "description": "Call statistics, the same numbers as the Cradle web app"
    },
    {
      "name": "API keys",
      "description": "Managed by a signed-in organisation admin on the access page; a key cannot manage keys"
    }
  ],
  "paths": {
    "/api/v1/me": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Who this credential acts as",
        "description": "Needs no scope. Useful to check a key: its scopes, expiry, allowlist, and the address the allowlist sees for you (client_ip).",
        "operationId": "getMe",
        "responses": {
          "200": {
            "description": "The credential",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calls": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "List calls, or follow the change feed",
        "description": "Needs conversations:read. Content fields (summary, has_transcript) are filled only for the kinds the key may read.\n\n**List a window:** send since (and optionally until), page with cursor. A window is at most 93 days.\n\n**Follow changes:** send updated_since instead. A call changes when it is created or completes, or when its transcript, summary or recording is stored. Changes appear about two minutes after they happen. Store next_updated_since and send it next time; if has_more is true, ask again straight away. Deduplicate on id: a call can come back more than once. Deletions are not reported yet.\n\nResponses carry a weak ETag. Send it back as If-None-Match and an unchanged answer is a 304 with no body, so polling costs almost nothing.",
        "operationId": "listCalls",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Start of the window: a date (2026-10-01), a date and time, or relative (today, yesterday, 7d)",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "description": "Change feed: a date/time, or the next_updated_since value from your last response. Returns calls that changed after it, oldest change first. Send it on its own, without since, until or cursor",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "End of the window, same forms as since. Defaults to now (calls) or today (reports)",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "tz",
            "in": "query",
            "description": "IANA timezone for dates in and out, e.g. Pacific/Auckland or Australia/Sydney",
            "schema": {
              "default": "Pacific/Auckland",
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "query",
            "description": "An email in your organisation, or me. Organisation-wide credentials list everyone when omitted",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The next_cursor value from the previous page",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Find calls with this phone number (any common format)",
            "schema": {
              "type": "string",
              "minLength": 6,
              "maxLength": 40
            }
          },
          {
            "name": "contact",
            "in": "query",
            "description": "A contact id from a call list",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F-]{36}$"
            }
          },
          {
            "name": "crm",
            "in": "query",
            "description": "CRM type for crm_id, e.g. hubspot",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z_]{1,19}$"
            }
          },
          {
            "name": "crm_id",
            "in": "query",
            "description": "The contact's id in that CRM (with crm)",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:-]{1,50}$"
            }
          },
          {
            "name": "contact_name",
            "in": "query",
            "description": "Find calls with a contact whose name contains this",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 80
            }
          },
          {
            "name": "hubspot_engagement",
            "in": "query",
            "description": "Find the call logged as this HubSpot engagement",
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,25}$"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "Only inbound, outbound or internal calls",
            "schema": {
              "type": "string",
              "enum": [
                "inbound",
                "outbound",
                "internal"
              ]
            }
          },
          {
            "name": "crm_logged",
            "in": "query",
            "description": "Only calls logged to this CRM, or none for calls logged nowhere",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z_]{1,19}$"
            }
          },
          {
            "name": "min_duration",
            "in": "query",
            "description": "Shortest call, in seconds",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 86400
            }
          },
          {
            "name": "max_duration",
            "in": "query",
            "description": "Longest call, in seconds",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 86400
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of calls (CallList), or of changes when updated_since was sent (CallFeed)",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CallList"
                    },
                    {
                      "$ref": "#/components/schemas/CallFeed"
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "Unchanged since the ETag you sent"
          },
          "400": {
            "description": "Bad parameters, e.g. VALIDATION_ERROR, INVALID_DATE_RANGE, DATE_RANGE_TOO_LARGE, UPDATED_SINCE_TOO_OLD, INVALID_PARAMS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "USER_NOT_FOUND: no user with that email in your organisation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calls/{callId}": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "One call, optionally with its transcript",
        "description": "Needs conversations:read, and transcripts:read for transcript=true. A call you can't see is a 404, the same as one that doesn't exist. Responses carry a weak ETag. Send it back as If-None-Match and an unchanged answer is a 304 with no body, so polling costs almost nothing.",
        "operationId": "getCall",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call id (UUID)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "description": "IANA timezone for dates in and out, e.g. Pacific/Auckland or Australia/Sydney",
            "schema": {
              "default": "Pacific/Auckland",
              "type": "string"
            }
          },
          {
            "name": "transcript",
            "in": "query",
            "description": "Include the transcript (needs transcripts:read)",
            "schema": {
              "default": "false",
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "max_chars",
            "in": "query",
            "description": "Cut the transcript at this many characters (transcript_truncated says if it was cut)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 2000000
            }
          },
          {
            "name": "hubspot_engagement_id",
            "in": "query",
            "description": "Include the id of the HubSpot call record",
            "schema": {
              "default": "false",
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallResponse"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged since the ETag you sent"
          },
          "400": {
            "description": "Bad parameters, e.g. INVALID_CALL_ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "UPSTREAM_UNAVAILABLE: try again shortly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calls/{callId}/audio": {
      "get": {
        "tags": [
          "Audio"
        ],
        "summary": "List a call's recordings and where to download them",
        "description": "Needs conversations:read and audio:read. Returns no audio: each recording with stored audio has a download_path. Download each from that path with the same credential.",
        "operationId": "listCallAudio",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call id (UUID)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recording",
            "in": "query",
            "description": "Only this recording",
            "schema": {
              "type": "string",
              "pattern": "^(?:\\d{1,20}|[0-9a-fA-F-]{36})$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The recordings (an empty list when the call has none)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioManifest"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_CALL_ID or a bad recording id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/audio/{region}/calls/{callId}/recordings/{recordingId}": {
      "get": {
        "tags": [
          "Audio"
        ],
        "summary": "Download a recording's audio",
        "description": "Use the download_path from the audio list rather than building this path. Needs conversations:read and audio:read. Large files are streamed: Content-Length may be absent, and X-Object-Size gives the size.",
        "operationId": "downloadRecording",
        "parameters": [
          {
            "name": "region",
            "in": "path",
            "required": true,
            "description": "Where the recording is stored (from download_path)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call id (UUID)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordingId",
            "in": "path",
            "required": true,
            "description": "Recording id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The audio file",
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "NOT_FOUND: no such recording, or no stored audio",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cli/reports": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "The report catalogue",
        "description": "Needs reports:read. The reports (views) and parts of reports (slices) you can run, and at which scopes.",
        "operationId": "listReports",
        "responses": {
          "200": {
            "description": "The catalogue",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportCatalogue"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cli/reports/{report}": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Run a report",
        "description": "Needs reports:read; the presence report also needs presence:read. Scope: the organisation (no user, team or number), a team, a user or a number. Reports carry numbers and configuration, never call content.",
        "operationId": "runReport",
        "parameters": [
          {
            "name": "report",
            "in": "path",
            "required": true,
            "description": "A view or slice name from the catalogue",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Start of the window: a date (2026-10-01), a date and time, or relative (today, yesterday, 7d)",
            "schema": {
              "default": "7d",
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "End of the window, same forms as since. Defaults to now (calls) or today (reports)",
            "schema": {
              "default": "today",
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "tz",
            "in": "query",
            "description": "IANA timezone for dates in and out, e.g. Pacific/Auckland or Australia/Sydney",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "query",
            "description": "An email in your organisation, or me. Organisation-wide credentials list everyone when omitted",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "name": "team",
            "in": "query",
            "description": "A team id or name (organisation admins and organisation-wide keys)",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Find calls with this phone number (any common format)",
            "schema": {
              "type": "string",
              "pattern": "^\\+[1-9]\\d{1,14}$"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "Only inbound, outbound or internal calls",
            "schema": {
              "type": "string",
              "enum": [
                "inbound",
                "outbound",
                "internal"
              ]
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "description": "Only answered, missed or voicemail calls",
            "schema": {
              "type": "string",
              "enum": [
                "answered",
                "missed",
                "voicemail"
              ]
            }
          },
          {
            "name": "business_hours",
            "in": "query",
            "description": "Only calls within the organisation's business hours",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "description": "Add the same-length window before, for comparison",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "sla_seconds",
            "in": "query",
            "description": "Answer-time target in seconds, for reports with an SLA slice",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3600
            }
          },
          {
            "name": "abandoned_after_seconds",
            "in": "query",
            "description": "Treat a missed call shorter than this as abandoned",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 600
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters, e.g. INVALID_SCOPE, or sla_seconds missing for an SLA report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "REPORT_NOT_FOUND, USER_NOT_FOUND, TEAM_NOT_FOUND or NUMBER_NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "UPSTREAM_UNAVAILABLE: try again shortly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cli-access/keys": {
      "get": {
        "tags": [
          "API keys"
        ],
        "summary": "List the organisation's API keys",
        "description": "Signed-in organisation admins only (the access page uses this). Never returns a key itself.",
        "operationId": "listOrgKeys",
        "responses": {
          "200": {
            "description": "Every key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OrgKey"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "API keys"
        ],
        "summary": "Create an API key",
        "description": "Signed-in organisation admins only. The key is returned once.\n\n- Content scopes (transcripts:read, summaries:read, recordings:read, audio:read) need conversations:read as well, and an ip_allowlist.\n- presence:read (staff presence, through the presence report) needs reports:read as well, and an ip_allowlist.\n- A key that can read the whole organisation's content needs acknowledgement set to \"grant org access\". A key limited to one user (restrict_user) doesn't.\n- A key with presence:read, including one limited to one user, needs staff_notified set to true, confirming: \"My organisation has told the staff whose presence this key can read that their availability, including its history, may be read by our organisation's own systems, and for what purposes.\"\n- accepted_terms_version must be the current Private Beta Terms version (/cli/terms).\n- expires_in_days defaults to 365, at most 730.",
        "operationId": "createOrgKey",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "scopes": {
                    "minItems": 1,
                    "maxItems": 7,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "conversations:read",
                        "transcripts:read",
                        "summaries:read",
                        "recordings:read",
                        "audio:read",
                        "reports:read",
                        "presence:read"
                      ]
                    }
                  },
                  "restrict_user": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "ip_allowlist": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expires_in_days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "accepted_terms_version": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "acknowledgement": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "staff_notified": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "scopes"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgKeyCreated"
                }
              }
            }
          },
          "400": {
            "description": "TERMS_NOT_ACCEPTED, INVALID_SCOPES, IP_RESTRICTION_REQUIRED, ACKNOWLEDGEMENT_REQUIRED, INVALID_EXPIRY, INVALID_IP_ALLOWLIST or VALIDATION_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "USER_NOT_FOUND: no active user with that email (restrict_user)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "TOO_MANY_KEYS: revoke one first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cli-access/keys/{id}": {
      "delete": {
        "tags": [
          "API keys"
        ],
        "summary": "Revoke an API key",
        "description": "Signed-in organisation admins only. Takes effect straight away.",
        "operationId": "revokeOrgKey",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Key id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "revoked": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked credential (INVALID_TOKEN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: IP_NOT_ALLOWED (outside the key's allowlist), SCOPE_DENIED (the key lacks a scope), API_BETA_NOT_ENABLED or CLI_BETA_NOT_ENABLED (organisation not in the private beta)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: slow down; wait for the Retry-After header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An organisation API key (cr_org_…), or a Cradle Calls CLI token (cr_pat_…)"
      }
    },
    "schemas": {
      "Error": {
        "$id": "#/components/schemas/Error",
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable, machine-readable code, e.g. SCOPE_DENIED"
              },
              "message": {
                "type": "string",
                "description": "Readable explanation; may change"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "id": "Error"
      },
      "CallContact": {
        "$id": "#/components/schemas/CallContact",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "organisation": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "number": {
            "type": "string"
          },
          "crm": {
            "type": "string",
            "description": "The CRM the contact is in, e.g. hubspot, or cradle"
          },
          "crm_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "selected": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the user picked this contact on the call; null when unknown"
          }
        },
        "required": [
          "id",
          "name",
          "organisation",
          "number",
          "crm",
          "crm_url",
          "selected"
        ],
        "additionalProperties": false,
        "id": "CallContact"
      },
      "CallParticipant": {
        "$id": "#/components/schemas/CallParticipant",
        "type": "object",
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "description": "How the call went for this person, e.g. answered or missed"
          }
        },
        "required": [
          "email",
          "name",
          "status"
        ],
        "additionalProperties": false,
        "id": "CallParticipant"
      },
      "CallSummary": {
        "$id": "#/components/schemas/CallSummary",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Call id (UUID)"
          },
          "started_at": {
            "type": "string",
            "description": "ISO 8601, in the requested timezone"
          },
          "ended_at": {
            "type": "string"
          },
          "duration_s": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "direction": {
            "type": "string",
            "description": "inbound, outbound or internal"
          },
          "status": {
            "type": "string"
          },
          "user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Email of the user the call belongs to"
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallParticipant"
            }
          },
          "counterparty": {
            "type": "object",
            "properties": {
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "number": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "organisation": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "name",
              "number",
              "organisation"
            ],
            "additionalProperties": false
          },
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallContact"
            }
          },
          "crm_logged": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "CRMs the call was logged to, e.g. [\"hubspot\"]; null when unknown"
          },
          "own": {
            "type": "boolean",
            "description": "Whether the call is the caller's own"
          },
          "has_transcript": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "null when the caller may not read transcripts for this call"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "AI summary, when the credential may read summaries for this call"
          },
          "via_org_grant": {
            "description": "Present when content came through organisation-wide access",
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id",
          "started_at",
          "ended_at",
          "duration_s",
          "direction",
          "status",
          "user",
          "participants",
          "counterparty",
          "contacts",
          "crm_logged",
          "own",
          "has_transcript",
          "summary"
        ],
        "additionalProperties": false,
        "id": "CallSummary"
      },
      "CallFeedItem": {
        "$id": "#/components/schemas/CallFeedItem",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Call id (UUID)"
          },
          "started_at": {
            "type": "string",
            "description": "ISO 8601, in the requested timezone"
          },
          "ended_at": {
            "type": "string"
          },
          "duration_s": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "direction": {
            "type": "string",
            "description": "inbound, outbound or internal"
          },
          "status": {
            "type": "string"
          },
          "user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Email of the user the call belongs to"
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallParticipant"
            }
          },
          "counterparty": {
            "type": "object",
            "properties": {
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "number": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "organisation": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "name",
              "number",
              "organisation"
            ],
            "additionalProperties": false
          },
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallContact"
            }
          },
          "crm_logged": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "CRMs the call was logged to, e.g. [\"hubspot\"]; null when unknown"
          },
          "own": {
            "type": "boolean",
            "description": "Whether the call is the caller's own"
          },
          "has_transcript": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "null when the caller may not read transcripts for this call"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "AI summary, when the credential may read summaries for this call"
          },
          "via_org_grant": {
            "description": "Present when content came through organisation-wide access",
            "type": "boolean",
            "const": true
          },
          "changed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the call last changed (change feed only)"
          }
        },
        "required": [
          "id",
          "started_at",
          "ended_at",
          "duration_s",
          "direction",
          "status",
          "user",
          "participants",
          "counterparty",
          "contacts",
          "crm_logged",
          "own",
          "has_transcript",
          "summary",
          "changed_at"
        ],
        "additionalProperties": false,
        "id": "CallFeedItem"
      },
      "CallRecording": {
        "$id": "#/components/schemas/CallRecording",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "duration_s": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "has_transcript": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "type",
          "duration_s",
          "has_transcript"
        ],
        "additionalProperties": false,
        "id": "CallRecording"
      },
      "TranscriptSegment": {
        "$id": "#/components/schemas/TranscriptSegment",
        "type": "object",
        "properties": {
          "recording_id": {
            "type": "string"
          },
          "speaker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "start_s": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "recording_id",
          "speaker",
          "start_s",
          "text"
        ],
        "additionalProperties": false,
        "id": "TranscriptSegment"
      },
      "CallDetail": {
        "$id": "#/components/schemas/CallDetail",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Call id (UUID)"
          },
          "started_at": {
            "type": "string",
            "description": "ISO 8601, in the requested timezone"
          },
          "ended_at": {
            "type": "string"
          },
          "duration_s": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "direction": {
            "type": "string",
            "description": "inbound, outbound or internal"
          },
          "status": {
            "type": "string"
          },
          "user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Email of the user the call belongs to"
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallParticipant"
            }
          },
          "counterparty": {
            "type": "object",
            "properties": {
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "number": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "organisation": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "name",
              "number",
              "organisation"
            ],
            "additionalProperties": false
          },
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallContact"
            }
          },
          "crm_logged": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "CRMs the call was logged to, e.g. [\"hubspot\"]; null when unknown"
          },
          "own": {
            "type": "boolean",
            "description": "Whether the call is the caller's own"
          },
          "has_transcript": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "null when the caller may not read transcripts for this call"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "AI summary, when the credential may read summaries for this call"
          },
          "via_org_grant": {
            "description": "Present when content came through organisation-wide access",
            "type": "boolean",
            "const": true
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "recordings": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CallRecording"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "transcript": {
            "description": "Present with transcript=true",
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TranscriptSegment"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "transcript_truncated": {
            "type": "boolean"
          },
          "hubspot_engagement_id": {
            "description": "Present with hubspot_engagement_id=true",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "started_at",
          "ended_at",
          "duration_s",
          "direction",
          "status",
          "user",
          "participants",
          "counterparty",
          "contacts",
          "crm_logged",
          "own",
          "has_transcript",
          "summary",
          "title",
          "recordings"
        ],
        "additionalProperties": false,
        "id": "CallDetail"
      },
      "Me": {
        "$id": "#/components/schemas/Me",
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "description": "'0' for an organisation-wide API key"
          },
          "email": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "is_admin": {
            "type": "boolean"
          },
          "credential": {
            "type": "string",
            "enum": [
              "org_key",
              "cli_token",
              "firebase"
            ],
            "description": "org_key: an organisation API key; cli_token: a Cradle Calls CLI token; firebase: signed in to Cradle in a browser"
          },
          "token_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "client_ip": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The address an IP allowlist sees for this request"
          },
          "org_content": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "api_key": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "conversations:read",
                        "transcripts:read",
                        "summaries:read",
                        "recordings:read",
                        "audio:read",
                        "reports:read",
                        "presence:read"
                      ]
                    }
                  },
                  "restricted_to_user": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expires_at": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ip_allowlist": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "scopes",
                  "restricted_to_user",
                  "expires_at",
                  "ip_allowlist"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "token": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "expires_at": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ip_allowlist": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "org_content": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "expires_at",
                  "ip_allowlist",
                  "org_content"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "user_id",
          "email",
          "org_id",
          "is_admin",
          "credential",
          "token_id",
          "client_ip",
          "org_content",
          "api_key",
          "token"
        ],
        "additionalProperties": false,
        "id": "Me"
      },
      "CallList": {
        "$id": "#/components/schemas/CallList",
        "type": "object",
        "properties": {
          "calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallSummary"
            }
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as cursor for the next page; null on the last page"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Parts of the answer that could not be completed; the rest is still valid"
          },
          "meta": {
            "type": "object",
            "properties": {
              "scope": {
                "type": "string",
                "enum": [
                  "user",
                  "org"
                ]
              },
              "user": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "since": {
                "type": "string"
              },
              "until": {
                "type": "string"
              },
              "tz": {
                "type": "string"
              },
              "filters": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "scope",
              "user",
              "since",
              "until",
              "tz",
              "filters"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "calls",
          "next_cursor",
          "warnings",
          "meta"
        ],
        "additionalProperties": false,
        "id": "CallList"
      },
      "CallFeed": {
        "$id": "#/components/schemas/CallFeed",
        "type": "object",
        "properties": {
          "calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallFeedItem"
            }
          },
          "next_cursor": {
            "type": "null"
          },
          "next_updated_since": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Store it and send it as updated_since next time"
          },
          "has_more": {
            "type": "boolean",
            "description": "More changes are waiting; ask again straight away with next_updated_since"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Parts of the answer that could not be completed; the rest is still valid"
          },
          "meta": {
            "type": "object",
            "properties": {
              "scope": {
                "type": "string",
                "enum": [
                  "user",
                  "org"
                ]
              },
              "user": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "updated_since": {
                "type": "string"
              },
              "settled_before": {
                "type": "string",
                "description": "Changes newer than this appear on a later request"
              },
              "tz": {
                "type": "string"
              },
              "filters": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "scope",
              "user",
              "updated_since",
              "settled_before",
              "tz",
              "filters"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "calls",
          "next_cursor",
          "next_updated_since",
          "has_more",
          "warnings",
          "meta"
        ],
        "additionalProperties": false,
        "id": "CallFeed"
      },
      "CallResponse": {
        "$id": "#/components/schemas/CallResponse",
        "type": "object",
        "properties": {
          "call": {
            "$ref": "#/components/schemas/CallDetail"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Parts of the answer that could not be completed; the rest is still valid"
          }
        },
        "required": [
          "call",
          "warnings"
        ],
        "additionalProperties": false,
        "id": "CallResponse"
      },
      "AudioManifest": {
        "$id": "#/components/schemas/AudioManifest",
        "type": "object",
        "properties": {
          "call_id": {
            "type": "string"
          },
          "recordings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "duration_s": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "available": {
                  "type": "boolean"
                },
                "download_path": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Path to download the audio from, with the same credential"
                },
                "warning": {
                  "type": "string",
                  "const": "no_stored_audio"
                },
                "via_org_grant": {
                  "type": "boolean",
                  "const": true
                }
              },
              "required": [
                "id",
                "type",
                "duration_s",
                "available",
                "download_path"
              ],
              "additionalProperties": false
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Parts of the answer that could not be completed; the rest is still valid"
          }
        },
        "required": [
          "call_id",
          "recordings",
          "warnings"
        ],
        "additionalProperties": false,
        "id": "AudioManifest"
      },
      "ReportCatalogue": {
        "$id": "#/components/schemas/ReportCatalogue",
        "type": "object",
        "properties": {
          "views": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "name",
                "description",
                "scopes"
              ],
              "additionalProperties": false
            }
          },
          "slices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "scope"
              ],
              "additionalProperties": false
            }
          },
          "scopes": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "views",
          "slices",
          "scopes"
        ],
        "additionalProperties": false,
        "id": "ReportCatalogue"
      },
      "Report": {
        "$id": "#/components/schemas/Report",
        "type": "object",
        "properties": {
          "report": {
            "type": "string"
          },
          "scope": {
            "type": "object",
            "properties": {
              "level": {
                "type": "string"
              },
              "user": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "team": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "number": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "level",
              "user",
              "team",
              "number"
            ],
            "additionalProperties": false
          },
          "window": {
            "type": "object",
            "properties": {
              "since": {
                "type": "string"
              },
              "until": {
                "type": "string"
              },
              "tz": {
                "type": "string"
              },
              "days": {
                "type": "number"
              }
            },
            "required": [
              "since",
              "until",
              "tz",
              "days"
            ],
            "additionalProperties": false
          },
          "compare": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "since": {
                    "type": "string"
                  },
                  "until": {
                    "type": "string"
                  }
                },
                "required": [
                  "since",
                  "until"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "filters": {
            "type": "object",
            "properties": {
              "direction": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outcome": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "business_hours": {
                "type": "boolean"
              }
            },
            "required": [
              "direction",
              "outcome",
              "business_hours"
            ],
            "additionalProperties": false
          },
          "data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "One entry per slice, keyed by slice name"
          },
          "errors": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            },
            "description": "Slices that failed, with the reason; the others are still valid"
          },
          "meta": {
            "type": "object",
            "properties": {
              "slices": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "generated_at": {
                "type": "string"
              }
            },
            "required": [
              "slices",
              "generated_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "report",
          "scope",
          "window",
          "compare",
          "filters",
          "data",
          "errors",
          "meta"
        ],
        "additionalProperties": false,
        "id": "Report"
      },
      "OrgKey": {
        "$id": "#/components/schemas/OrgKey",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "conversations:read",
                "transcripts:read",
                "summaries:read",
                "recordings:read",
                "audio:read",
                "reports:read",
                "presence:read"
              ]
            }
          },
          "restricted_to_user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "ip_allowlist": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "created_by_is_admin": {
            "type": "boolean",
            "description": "false when the creator is no longer an admin; the key keeps working"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "live",
              "revoked",
              "expired"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "scopes",
          "restricted_to_user",
          "ip_allowlist",
          "created_at",
          "created_by",
          "created_by_is_admin",
          "expires_at",
          "revoked_at",
          "last_used_at",
          "status"
        ],
        "additionalProperties": false,
        "id": "OrgKey"
      },
      "OrgKeyCreated": {
        "$id": "#/components/schemas/OrgKeyCreated",
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The key itself (cr_org_…). Shown once; store it securely"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "conversations:read",
                "transcripts:read",
                "summaries:read",
                "recordings:read",
                "audio:read",
                "reports:read",
                "presence:read"
              ]
            }
          },
          "restricted_to_user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "ip_allowlist": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "created_by_is_admin": {
            "type": "boolean",
            "description": "false when the creator is no longer an admin; the key keeps working"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "live",
              "revoked",
              "expired"
            ]
          }
        },
        "required": [
          "key",
          "id",
          "name",
          "scopes",
          "restricted_to_user",
          "ip_allowlist",
          "created_at",
          "created_by",
          "created_by_is_admin",
          "expires_at",
          "revoked_at",
          "last_used_at",
          "status"
        ],
        "additionalProperties": false,
        "id": "OrgKeyCreated"
      }
    }
  }
}