openapi: 3.0.3
info:
  title: Notably customer API
  version: '1.0.0'
  description: |
    Read access to an organization's finished meetings, plus webhook subscriptions
    for integrations. Available to Team and Enterprise organizations;
    an owner or admin opens it under
    Settings → Connections → For developers and picks what it exposes. Human-readable guide: https://notably.no/developers.

    Webhook messages are thin (ids and a link, never content). They are signed with
    `Notably-Signature: t=<unix>,v1=<hex HMAC_SHA256(secret, t + "." + raw_body)>`.
servers:
  - url: https://api.notably.no/public/v1
security:
  - bearerAuth: []
tags:
  - name: Organization
  - name: Meetings
  - name: Webhooks
paths:
  /organization:
    get:
      operationId: getOrganization
      tags: [Organization]
      summary: Who the key belongs to
      description: 'Use this to test a key. Returns the organization and what is switched on; no meeting data and no secrets.'
      responses:
        '200':
          description: The organization behind the key.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Organization' }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /meetings:
    get:
      operationId: listMeetings
      tags: [Meetings]
      summary: Finished meetings in scope, newest first
      description: 'Needs the `meetings` data type on the key.'
      parameters:
        - {
            name: limit,
            in: query,
            schema: { type: integer, minimum: 1, maximum: 100, default: 25 },
          }
        - {
            name: cursor,
            in: query,
            description: 'Opaque. Use `next_cursor` from the previous page.',
            schema: { type: string },
          }
        - {
            name: from,
            in: query,
            description: 'ISO date or time. Meetings starting at or after.',
            schema: { type: string },
          }
        - {
            name: to,
            in: query,
            description: 'ISO date or time. Meetings starting at or before.',
            schema: { type: string },
          }
      responses:
        '200':
          description: A page of meetings.
          content:
            application/json:
              schema:
                type: object
                required: [data, next_cursor]
                properties:
                  data:
                    type: array
                    items: { $ref: '#/components/schemas/Meeting' }
                  next_cursor: { type: string, nullable: true }
        '400': { $ref: '#/components/responses/Error' }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /meetings/{id}:
    get:
      operationId: getMeeting
      tags: [Meetings]
      summary: One meeting (metadata, no content)
      parameters: [{ $ref: '#/components/parameters/MeetingId' }]
      responses:
        '200':
          description: The meeting.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Meeting' }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '404': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /meetings/{id}/summary:
    get:
      operationId: getMeetingSummary
      tags: [Meetings]
      summary: The summary as markdown
      description: 'Needs the `summary` data type on the key and on the organization.'
      parameters: [{ $ref: '#/components/parameters/MeetingId' }]
      responses:
        '200':
          description: The summary.
          content:
            application/json:
              schema:
                type: object
                required: [meeting_id, format, content, language, generated_at]
                properties:
                  meeting_id: { type: string, format: uuid }
                  format: { type: string, enum: [markdown] }
                  content: { type: string }
                  language: { type: string, nullable: true }
                  generated_at: { type: string, format: date-time }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '404': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /meetings/{id}/action-items:
    get:
      operationId: getMeetingActionItems
      tags: [Meetings]
      summary: Action items and decisions
      description: 'Needs the `action_items` data type on the key and on the organization.'
      parameters: [{ $ref: '#/components/parameters/MeetingId' }]
      responses:
        '200':
          description: Action items and decisions.
          content:
            application/json:
              schema:
                type: object
                required: [meeting_id, action_items, decisions]
                properties:
                  meeting_id: { type: string, format: uuid }
                  action_items:
                    type: array
                    items:
                      type: object
                      properties:
                        id: { type: string, format: uuid }
                        description: { type: string }
                        owner: { type: string, nullable: true }
                        due: { type: string, nullable: true }
                        status: { type: string }
                  decisions:
                    type: array
                    items:
                      type: object
                      properties:
                        id: { type: string, format: uuid }
                        description: { type: string }
                        decided_by: { type: string, nullable: true }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '404': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /meetings/{id}/transcript:
    get:
      operationId: getMeetingTranscript
      tags: [Meetings]
      summary: Full transcript with speakers
      description: 'Needs the `transcript` data type on the key and on the organization. An Enterprise policy can hide it from administrators (403 policy_denied).'
      parameters: [{ $ref: '#/components/parameters/MeetingId' }]
      responses:
        '200':
          description: The transcript.
          content:
            application/json:
              schema:
                type: object
                required: [meeting_id, language, segments]
                properties:
                  meeting_id: { type: string, format: uuid }
                  language: { type: string, nullable: true }
                  segments:
                    type: array
                    items:
                      type: object
                      properties:
                        speaker: { type: string, nullable: true }
                        start_seconds: { type: number, nullable: true }
                        end_seconds: { type: number, nullable: true }
                        text: { type: string }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '404': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /webhooks:
    post:
      operationId: subscribeWebhook
      tags: [Webhooks]
      summary: Subscribe an https address to events
      description: |
        For "REST hook" style integrations. Needs the `meetings` data type on the key.
        The address goes through the same checks as one added in the app (https, no
        credentials, public host, port 443 or 8443), is signed the same way and counts
        toward the same limit of 5 addresses. The `secret` is returned only here.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/WebhookSubscribeRequest' }
      responses:
        '201':
          description: Subscribed.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WebhookSubscription' }
        '400': { $ref: '#/components/responses/Error' }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '409': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /webhooks/{id}:
    delete:
      operationId: unsubscribeWebhook
      tags: [Webhooks]
      summary: Remove a subscription created through the API
      description: 'Idempotent, so an address that is already gone is also 204. An address an admin added in the app can never be removed with a key (404).'
      parameters:
        - { name: id, in: path, required: true, schema: { type: string, format: uuid } }
      responses:
        '204': { description: 'Removed, or already gone.' }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '404': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
  /webhooks/{id}/deliveries/{deliveryId}/redeliver:
    post:
      operationId: redeliverWebhook
      tags: [Webhooks]
      summary: Send a finished delivery again
      description: 'Starts a fresh retry series with the same event id, so the receiver can deduplicate. Works for failed and delivered events on addresses created through the API. The delivery id is the Notably-Delivery-Id header of the delivery.'
      parameters:
        - { name: id, in: path, required: true, schema: { type: string, format: uuid } }
        - { name: deliveryId, in: path, required: true, schema: { type: string, format: uuid } }
      responses:
        '202':
          description: Queued.
          content:
            application/json:
              schema:
                type: object
                required: [queued]
                properties:
                  queued: { type: boolean, enum: [true] }
        '401': { $ref: '#/components/responses/Error' }
        '403': { $ref: '#/components/responses/Error' }
        '404': { $ref: '#/components/responses/Error' }
        '429': { $ref: '#/components/responses/Error' }
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Organization API key, shaped like ntbk_live_<8 hex>_<43 chars>.'
  parameters:
    MeetingId:
      name: id
      in: path
      required: true
      schema: { type: string, format: uuid }
  responses:
    Error:
      description: |
        Error. 401 invalid_key. 403 plan_required, api_disabled, scope_missing,
        datatype_disabled or policy_denied. 404 not_found. 400 invalid_query,
        invalid_cursor, invalid_webhook or invalid_url. 409 webhook_limit or
        webhook_exists. 429 rate_limited (60 requests per minute per key; see Retry-After).
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
  schemas:
    Error:
      type: object
      required: [code, message]
      properties:
        code: { type: string }
        message: { type: string }
    DataType:
      type: string
      enum: [summary, action_items, transcript, participants]
    Organization:
      type: object
      required:
        [
          id,
          name,
          plan,
          data_types,
          key_data_types,
          meeting_scope,
          include_older_meetings,
          enabled_at,
        ]
      properties:
        id: { type: string, format: uuid }
        name: { type: string }
        plan: { type: string, enum: [team, enterprise] }
        data_types:
          description: 'What the organization has switched on.'
          type: array
          items: { $ref: '#/components/schemas/DataType' }
        key_data_types:
          description: 'What this key may read (meetings is metadata only).'
          type: array
          items: { type: string, enum: [meetings, summary, action_items, transcript, participants] }
        meeting_scope: { type: string, enum: [all, external_only] }
        include_older_meetings: { type: boolean }
        enabled_at: { type: string, format: date-time }
    Participant:
      type: object
      properties:
        name: { type: string, nullable: true }
        email: { type: string, nullable: true }
    Meeting:
      type: object
      required: [id, title, starts_at, available]
      properties:
        id: { type: string, format: uuid }
        title: { type: string }
        starts_at: { type: string, format: date-time }
        ended_at: { type: string, format: date-time, nullable: true }
        available:
          type: array
          items: { $ref: '#/components/schemas/DataType' }
        participants:
          description: 'Present when participants is switched on for key and organization.'
          type: array
          items: { $ref: '#/components/schemas/Participant' }
    WebhookEvent:
      type: string
      enum: [meeting.summary_ready, meeting.transcript_ready, meeting.deleted]
    WebhookSubscribeRequest:
      type: object
      additionalProperties: false
      required: [url, events]
      properties:
        url:
          {
            type: string,
            format: uri,
            maxLength: 2048,
            example: 'https://hooks.example.com/notably',
          }
        events:
          type: array
          minItems: 1
          items: { $ref: '#/components/schemas/WebhookEvent' }
    WebhookSubscription:
      type: object
      required: [id, url, events, secret, created_at]
      properties:
        id: { type: string, format: uuid }
        url: { type: string }
        events:
          type: array
          items: { $ref: '#/components/schemas/WebhookEvent' }
        secret:
          type: string
          description: 'Signing secret (whsec_...). Shown only in this response.'
        created_at: { type: string, format: date-time }
    WebhookMessage:
      description: |
        The body Notably POSTs to a subscribed address. Thin by design, so fetch content with your key.
        meeting_url and available are present for meeting.summary_ready and meeting.transcript_ready;
        meeting.deleted has only meeting_id; webhook.test has an empty data object.
      type: object
      required: [id, type, created_at, organization_id, data]
      properties:
        id: { type: string, example: evt_4f2c0a9d7e1b4c3a8d5e6f708192a3b4 }
        type:
          type: string
          enum: [meeting.summary_ready, meeting.transcript_ready, meeting.deleted, webhook.test]
        created_at: { type: string, format: date-time }
        organization_id: { type: string, format: uuid }
        data:
          type: object
          properties:
            meeting_id: { type: string, format: uuid }
            meeting_url: { type: string, format: uri }
            available:
              type: array
              items: { $ref: '#/components/schemas/DataType' }
