openapi: 3.1.0
info:
  title: Video Bricks API
  version: 0.1-draft
  summary: Footage in, a clean index out, finished videos pushed to channels.
  description: >-
    Every call is JSON over HTTPS with a key or a session token sent as a bearer token. Times are seconds on the
    recording's own clock, written to the microsecond. Work that takes time never blocks a call:
    the object carries a state, and a notice is sent when the state moves. A POST may carry an
    Idempotency-Key header so a retry never does the work twice. Lists return `data` and `next`,
    and `next` is passed back as `after` to read on.
servers:
  - url: https://api.videobricks.app/v1
    description: The live API

tags:
  - {name: Footage, x-layer: 1, x-agent: true, description: 'Recordings a workspace has stored and measured.'}
  - {name: Index, x-layer: 1, x-agent: true, description: 'What was found in a recording, in words an editor uses.'}
  - {name: Search, x-layer: 1, x-agent: true, description: 'Finding moments across every recording in a workspace.'}
  - {name: Notices, x-layer: 1, description: 'Messages sent to your server when a state moves.'}
  - {name: People, x-layer: 1, description: 'Signing up, signing in, and the sessions a person holds.'}
  - {name: Keys, x-layer: 1, description: 'API keys and the scopes each one carries.'}
  - {name: Usage, x-layer: 1, description: 'What the workspace has used on each meter.'}
  - {name: Billing, x-layer: 1, description: 'The trial, the plans, and what the workspace pays for its minutes.'}
  - {name: Kits, x-layer: 2, description: 'A brand''s fonts, colours, logo, captions and music rules.'}
  - {name: Recipes, x-layer: 2, description: 'Named sets of edit settings that stack in layers under a video''s own values.'}
  - {name: Briefs, x-layer: 2, x-agent: true, description: 'An ask in plain words that becomes drafted videos.'}
  - {name: Videos, x-layer: 2, x-agent: true, description: 'One video, its revisions and its renders.'}
  - {name: Review, x-layer: 3, description: 'Comments, proposed changes and approvals.'}
  - {name: Pushes, x-layer: 3, description: 'Publishing an approved video to connected channels.'}
  - {name: Workspace, x-layer: 3, description: 'The team account and the people in it.'}
  - {name: Staff, x-layer: 3, description: 'For Video Bricks staff only: what each workspace used, what it cost us, what it paid and what broke for it.'}

x-layers:
  - {layer: 1, name: Store and measure, stops_here: Companies with their own editing process}
  - {layer: 2, name: Edit and render, stops_here: Other products that sell video under their own name}
  - {layer: 3, name: The workspace, stops_here: Marketing teams using the app}

x-agents:
  url: https://api.videobricks.app/mcp
  says: >-
    An AI agent reaches the API through an MCP server, over Streamable HTTP, with a key sent as a
    bearer token. Every call of a part marked for agents is a tool named by its operationId, with
    the call's path and query fields as arguments and its body as `body`. The tools listed are the
    ones the key's scopes allow, and each call is held to them as any other call is. A tool's answer
    is the call's JSON answer, and a refusal comes back as an error result holding the refusal.
    Footage is added as an upload: the agent sends the file's parts to the links addFootage gives,
    then calls finishUpload.

x-scopes:
  footage.read: Read footage, its index, words, series and search.
  footage.write: Add, change and archive footage.
  edit.read: Read kits, recipes, briefs, videos, revisions and renders.
  edit.write: Create and change kits, recipes, briefs, videos and revisions.
  review.write: Comment, propose changes and approve.
  push.write: Connect channels and push approved videos.
  admin: Manage members, keys and notice endpoints, and read usage.

x-roles:
  owner:
    what: The person who pays. One for each workspace.
    seat: paid
    scopes: [footage.read, footage.write, edit.read, edit.write, review.write, push.write, admin]
  admin:
    what: Runs the workspace day to day.
    seat: paid
    scopes: [footage.read, footage.write, edit.read, edit.write, review.write, push.write, admin]
  editor:
    what: Makes and pushes videos.
    seat: paid
    scopes: [footage.read, footage.write, edit.read, edit.write, review.write, push.write]
  reviewer:
    what: Watches, comments and approves. Costs nothing.
    seat: free
    scopes: [footage.read, edit.read, review.write]

x-errors:
  bad_request: {status: 400, means: 'A field is missing or wrong. `field` names it when there is one.'}
  no_key: {status: 401, means: 'No key or session was sent, or it is unknown, revoked or ended.'}
  sign_in_refused: {status: 401, means: The email and password do not match a person who has signed up.}
  too_many_tries: {status: 429, means: 'Too many wrong passwords were tried. `wait_seconds` says how long to wait before signing in again.'}
  email_unconfirmed: {status: 403, means: 'The email is not confirmed yet. A new link has been sent to it.'}
  scope_missing: {status: 403, means: 'The key does not carry the scope the call needs, or it is a test key and the call reaches past the samples.'}
  not_found: {status: 404, means: 'Nothing is here, or it belongs to another workspace.'}
  key_reused: {status: 409, means: The Idempotency-Key was sent before with a different body.}
  parts_missing: {status: 409, means: Some parts of the file have not been sent.}
  not_ready: {status: 409, means: The object is not in a state that allows the call.}
  not_approved: {status: 409, means: The video has not been approved.}
  locked: {status: 409, means: 'A value differs from one a kit or recipe has locked, or falls outside a platform''s limits. `field` names where the value was set.'}
  wrong_file: {status: 422, means: The file sent is not the kind of file the call takes.}
  our_fault: {status: 500, means: Something broke on our side.}
  not_built: {status: 501, means: The call is written down and not built yet.}
  owner_only: {status: 403, means: 'Only the workspace''s owner, signed in, can pick, change or cancel its plan, or delete the workspace.'}
  plan_needed: {status: 402, means: 'The trial has ended, or the plan has ended or is unpaid. Calls that make new work wait for a plan, and everything made stays readable.'}
  too_many_calls: {status: 429, means: 'The workspace has made all the calls its plan allows this minute. `wait_seconds` says when the next minute starts.'}
  staff_only: {status: 403, means: 'Only a person on Video Bricks staff, signed in, makes this call.'}

x-sign-in:
  window_minutes: 15
  misses_per_email: 10
  misses_per_address: 50

x-notices:
  sent: >-
    When a recording, brief, video or render moves to a new state, a Notice is posted as JSON to every
    endpoint of the workspace whose kinds name it. Its kind is the object and the state it moved
    to, such as footage.ready. A video made with no revision sends video.idea, and a video whose
    title or owner changes sends video.changed, so a board shows a card that did not move.
  signed: >-
    The Standard Webhooks way. Each notice carries webhook-id (the notice's id, the same on every
    try), webhook-timestamp (whole seconds since 1970) and webhook-signature, which is v1, a comma,
    and the base64 HMAC-SHA256 of the id, the timestamp and the body joined by full stops, keyed
    with the endpoint's secret after its whsec_ prefix is taken off and its base64 read. Any
    Standard Webhooks library checks it with the secret as it was shown.
  accepted: Any answer from 200 to 299 within the answer seconds. Anything else is a refusal.
  retried: >-
    A refused notice is sent again after each of the waits in turn, then once more when it is a
    day old, and then given up. The endpoint is failing from the first refusal until a notice is
    accepted. A notice can come more than once and out of order, so use webhook-id to drop one
    already seen.
  answer_seconds: 15
  waits_seconds: [5, 300, 1800, 7200, 18000, 36000]
  tried_hours: 24
  kept_days: 30

x-platforms:
  told: >-
    Each platform's recipe locks the shape its covered edges were measured on and its longest
    length, and keeps the top edge of captions drawn without a kit, text.place, out of the top
    and bottom its buttons and captions cover. The edges are the platforms' own published
    templates, or readings of them.
  recipes:
    - {id: rcp_youtube_shorts, name: YouTube Shorts, settings: {out.shape: '9:16', out.length-limit: 180}, limits: {text.place: [0.15, 0.65]}}
    - {id: rcp_youtube, name: YouTube, settings: {out.shape: '16:9', out.length-limit: 43200}, limits: {text.place: [0.035, 0.642]}}
    - {id: rcp_tiktok, name: TikTok, settings: {out.shape: '9:16', out.length-limit: 600}, limits: {text.place: [0.125, 0.656]}}
    - {id: rcp_reels, name: Instagram Reels, settings: {out.shape: '9:16', out.length-limit: 900}, limits: {text.place: [0.14, 0.65]}}
    - {id: rcp_linkedin, name: LinkedIn, settings: {out.length-limit: 600}, limits: {}}

security:
  - key: []

paths:
  /footage:
    post:
      operationId: addFootage
      tags: [Footage]
      summary: Add a recording
      description: >-
        Names a recording and says where its file comes from. For an upload the answer carries
        the links to send the file to, in parts, straight to storage. For a link our servers fetch
        the file into storage in parts, carrying on from the last whole part when a fetch stops, and
        a link that is private, is not a video, or holds a file too big to keep fails with the
        reason in `problem`. Measuring starts by itself once the file has arrived, and its minutes
        are charged as for an upload. Fetching costs nothing. Adding from a drive is written down and
        not built yet.
      security: [{key: [footage.write]}]
      x-meter: minutes_measured
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/FootageNew'}
            example: {name: Spring launch webinar, bytes: 583774083, keep: original, source: {from: upload}}
      responses:
        '201': {description: 'The recording, waiting for its file', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listFootage
      tags: [Footage]
      summary: List recordings
      description: >-
        An archived recording is listed only when the state asked is archived. Every page of a list
        keeps the order asked for, so `next` reads on in the same order.
      security: [{key: [footage.read]}]
      x-meter: none
      parameters:
        - {name: state, in: query, description: Only recordings in this state., schema: {type: string, enum: [uploading, measuring, ready, failed, archived]}}
        - {name: label, in: query, description: Only recordings carrying this label., schema: {type: string}}
        - {name: name, in: query, description: 'Only recordings whose name holds these letters, in any case.', schema: {type: string, minLength: 1, maxLength: 200}}
        - name: sort
          in: query
          description: '`newest` or `oldest` added first, by `name` from A, or the `longest` first, with those not yet measured last.'
          schema: {type: string, enum: [newest, oldest, name, longest], default: newest}
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Recordings in the order asked', content: {application/json: {schema: {$ref: '#/components/schemas/FootageList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getFootage
      tags: [Footage]
      summary: Read one recording
      security: [{key: [footage.read]}]
      x-meter: none
      responses:
        '200': {description: 'The recording', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}
    patch:
      operationId: changeFootage
      tags: [Footage]
      summary: Rename, label or change what is kept
      description: >-
        Labels replace the ones the recording had, with spaces at either end taken off and the same
        label given twice kept once. Keeping less removes what is no longer kept from storage at
        once, or when measuring ends if it is still uploading or being measured. What was removed
        cannot be kept again, so keeping more is refused with not_ready once measuring has ended;
        add the recording again instead. Keeping less is refused with not_ready while a video is
        being rendered from the recording. A sample recording is never changed.
      security: [{key: [footage.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/FootageChange'}
            example: {name: Spring launch webinar, labels: [webinar, spring-launch]}
      responses:
        '200': {description: 'The recording', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}
    delete:
      operationId: archiveFootage
      tags: [Footage]
      summary: Archive a recording
      description: >-
        A ready or failed recording is put away and leaves the library, search and new briefs. Its
        file and index are removed for good 30 days later, at the time `removed` gives, and until
        then it can be brought back. A sample recording is never archived.
      security: [{key: [footage.write]}]
      x-meter: none
      responses:
        '200': {description: 'The archived recording', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/uploaded:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: finishUpload
      tags: [Footage]
      summary: Say every part has been sent
      description: Checks the parts, joins them and starts measuring.
      security: [{key: [footage.write]}]
      x-meter: minutes_measured
      responses:
        '200': {description: 'The recording, now being measured', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/restore:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: restoreFootage
      tags: [Footage]
      summary: Bring an archived recording back
      description: It goes back to the state it was archived from, ready or failed. One already removed for good cannot be brought back.
      security: [{key: [footage.write]}]
      x-meter: none
      responses:
        '200': {description: 'The recording', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/delete:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: deleteFootage
      tags: [Footage]
      summary: Delete a recording for good
      description: >-
        Removes the file, its index, its playing copies and every video made from it, with their
        revisions, renders, comments, review links and pushes, at once and for good, in any state,
        archived too. What a push put on a channel stays there. A recording still being measured
        stops. A recording with a video being pushed or set to go public later is refused until that
        push is taken back, and a sample is never deleted. Each video deleted sends video.deleted.
        Minutes already measured, stored and rendered stay on the ledger, since invoices are made
        from it.
      security: [{key: [footage.write]}]
      x-meter: none
      responses:
        '200': {description: 'The recording, deleted', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/measure:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: measureAgain
      tags: [Footage]
      summary: Measure again with the newest version
      description: >-
        Measures a ready recording again from the file as sent, with the newest version of the
        measurements, such as after the engine improves. It is measuring until the new index
        replaces the old one. If measuring again fails, the recording is ready again with its old
        index, and `problem` says what went wrong. Its whole length is charged on minutes_measured,
        unless it comes out with the version it was already measured with, when nothing is
        charged. Refused with not_ready while it is measuring, so it is never measured twice at
        once, when it is not ready, and when it keeps less than the file as sent. A sample
        recording is never measured again.
      security: [{key: [footage.write]}]
      x-meter: minutes_measured
      responses:
        '200': {description: 'The recording, now being measured', content: {application/json: {schema: {$ref: '#/components/schemas/Footage'}}}}
        default: {$ref: '#/components/responses/Error'}

  /footage/{id}/index:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getIndex
      tags: [Index]
      summary: Read what was found in a recording
      description: >-
        Every event that touches the stretch between two times, in time order. An event that
        starts before the stretch or ends after it comes back whole, with its own times. The
        summary counts the shots and faults that touch the stretch, and adds up words, speech,
        loudness and peak over the stretch alone. Each bar is a number you may set for this
        call, such as the shortest gap that counts as a pause. Nothing is measured again: a bar
        only changes which stored measurements count as an event.
      security: [{key: [footage.read]}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/From'}
        - {$ref: '#/components/parameters/To'}
        - name: kinds
          in: query
          description: Only these kinds of event, comma-separated. Every kind when left out.
          schema: {type: string, examples: ['shot,sentence,pause']}
        - {name: pause_over, in: query, description: 'The shortest silence, in seconds, that counts as a pause. No silence under a twentieth of a second counts.', schema: {type: number, default: 0.15, minimum: 0.05}}
        - {name: soft_under, in: query, description: 'Sharpness, as a share of the recording''s own sharp level, under which a stretch is soft.', schema: {type: number, default: 0.6}}
        - {name: shaky_over, in: query, description: 'Shake, as a share of the frame width, over which a second is shaky.', schema: {type: number, default: 0.0015}}
        - {name: blown_over, in: query, description: 'The share of the frame at full white over which a stretch is blown.', schema: {type: number, default: 0.02}}
        - {name: crushed_over, in: query, description: 'The share of the frame at full black over which a stretch is crushed.', schema: {type: number, default: 0.05}}
      responses:
        '200': {description: 'The index of the stretch asked for', content: {application/json: {schema: {$ref: '#/components/schemas/Index'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/words:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getWords
      tags: [Index]
      summary: Read the transcript word by word
      security: [{key: [footage.read]}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/From'}
        - {$ref: '#/components/parameters/To'}
      responses:
        '200': {description: 'Every word that touches the stretch, with its times', content: {application/json: {schema: {$ref: '#/components/schemas/Words'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/series:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getSeries
      tags: [Index]
      summary: Read a measurement second by second
      description: >-
        One lowest, mean and highest value for each whole second the stretch touches, and the
        answer's from and to name those seconds. A series made of several readings, such as
        colour, comes back once for each part. Finer readings are not offered.
      security: [{key: [footage.read]}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/From'}
        - {$ref: '#/components/parameters/To'}
        - name: names
          in: query
          required: true
          description: The series wanted, comma-separated.
          schema: {type: string, examples: ['loudness,colour']}
      responses:
        '200': {description: 'The series asked for', content: {application/json: {schema: {$ref: '#/components/schemas/Series'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/play:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getPlay
      tags: [Footage]
      summary: Get links to play a recording
      description: >-
        A link to the playing copy, made while the recording was measured, and links to its strip
        of small stills and the shape of its sound, so a screen can show where things are before
        anything plays. Every link lasts until the time given, which is between five and six
        hours away. Only a member of the recording's workspace is given them.
      security: [{key: [footage.read]}]
      x-meter: none
      responses:
        '200': {description: 'The links to play the recording', content: {application/json: {schema: {$ref: '#/components/schemas/Play'}}}}
        default: {$ref: '#/components/responses/Error'}
  /footage/{id}/frame:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getFrame
      tags: [Index]
      summary: Get the picture shown at a time
      description: >-
        A still is kept for every whole second of a recording, of the frame shown at that second,
        640 pixels on its longer side or the recording's own size when smaller. The answer is the
        still of the whole second nearest the time asked, with that second and the number of its
        frame.
      security: [{key: [footage.read]}]
      x-meter: none
      parameters:
        - {name: at, in: query, required: true, schema: {type: number, minimum: 0}}
      responses:
        '200': {description: 'A link to the still, good for at least one hour', content: {application/json: {schema: {$ref: '#/components/schemas/Frame'}}}}
        default: {$ref: '#/components/responses/Error'}

  /labels:
    get:
      operationId: listLabels
      tags: [Footage]
      summary: List the labels in use
      description: Every label on the workspace's recordings that are not archived, with how many carry it, the most used first.
      security: [{key: [footage.read]}]
      x-meter: none
      responses:
        '200': {description: 'The labels in use', content: {application/json: {schema: {$ref: '#/components/schemas/Labels'}}}}
        default: {$ref: '#/components/responses/Error'}

  /samples:
    get:
      operationId: listSamples
      tags: [Videos]
      summary: List the sample recordings and the videos drafted from them
      description: >-
        The same few sample recordings in every workspace, measured once, each with the videos drafted
        from it. A sample also shows in the library with `sample` true, and can be read, played and
        named in a brief or a spec, but never changed. To make one of its videos your own, send its
        title and spec to POST /videos. Nothing done with a sample is charged: measuring, storing and
        rendering it add nothing to the workspace's usage. The list is empty until samples are chosen.
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The samples, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/SampleList'}}}}
        default: {$ref: '#/components/responses/Error'}

  /search:
    post:
      operationId: search
      tags: [Search]
      summary: Find moments across the library
      description: Looks through what was said, what is written on screen and what was heard, in every recording or the ones named.
      security: [{key: [footage.read]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/SearchAsk'}
            example: {words: follow our passions, labels: [film], limit: 5}
      responses:
        '200': {description: 'The moments found, best first', content: {application/json: {schema: {$ref: '#/components/schemas/Moments'}}}}
        default: {$ref: '#/components/responses/Error'}

  /notice-endpoints:
    post:
      operationId: addNoticeEndpoint
      tags: [Notices]
      summary: Name a URL to send notices to
      security: [{key: [admin]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/NoticeEndpointNew'}
            example: {url: 'https://example.com/hooks/video', kinds: [footage.ready, render.passed]}
      responses:
        '201': {description: 'The endpoint, with its signing secret shown this once', content: {application/json: {schema: {$ref: '#/components/schemas/NoticeEndpoint'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listNoticeEndpoints
      tags: [Notices]
      summary: List notice endpoints
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'Endpoints', content: {application/json: {schema: {$ref: '#/components/schemas/NoticeEndpointList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /notice-endpoints/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getNoticeEndpoint
      tags: [Notices]
      summary: Read one notice endpoint
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'The endpoint', content: {application/json: {schema: {$ref: '#/components/schemas/NoticeEndpoint'}}}}
        default: {$ref: '#/components/responses/Error'}
    patch:
      operationId: changeNoticeEndpoint
      tags: [Notices]
      summary: Change where an endpoint is and which kinds it hears
      description: A stopped endpoint cannot be changed. Name a new one instead.
      security: [{key: [admin]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/NoticeEndpointChange'}
            example: {kinds: [footage.ready, footage.failed, render.passed, render.failed]}
      responses:
        '200': {description: 'The endpoint, changed', content: {application/json: {schema: {$ref: '#/components/schemas/NoticeEndpoint'}}}}
        default: {$ref: '#/components/responses/Error'}
    delete:
      operationId: removeNoticeEndpoint
      tags: [Notices]
      summary: Stop sending to an endpoint
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'The endpoint, switched off', content: {application/json: {schema: {$ref: '#/components/schemas/NoticeEndpoint'}}}}
        default: {$ref: '#/components/responses/Error'}
  /notices:
    get:
      operationId: listNotices
      tags: [Notices]
      summary: Read back the notices of the last 30 days
      security: [{key: [admin]}]
      x-meter: none
      parameters:
        - {name: kind, in: query, schema: {type: string}}
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Notices, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/NoticeList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /changes:
    get:
      operationId: listChanges
      tags: [Notices]
      summary: Read what moved since a cursor
      description: >-
        For a screen that stays live without reading its whole list again. Ask once with no
        cursor to get one for now, then read what the screen shows, then ask every few seconds
        with the `next` of the answer before. Each change is a notice, oldest first: its kind
        names the state an object moved to, or says a card changed without moving, as
        video.idea and video.changed do. A change can come twice but
        is never skipped. A full answer may have more behind it, so ask again at once. Any member
        or key with a read scope may ask, and sees the kinds its scopes read: footage kinds with
        footage.read and the rest with edit.read.
      security: [{key: []}]
      x-meter: none
      parameters:
        - {name: after, in: query, description: 'The `next` of the answer before. Left out, the answer holds no changes and a cursor for now.', schema: {type: string}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 100, default: 100}}
      responses:
        '200': {description: 'What moved, oldest first, and the cursor to ask with next', content: {application/json: {schema: {$ref: '#/components/schemas/Changes'}}}}
        default: {$ref: '#/components/responses/Error'}

  /sign-up:
    post:
      operationId: signUp
      tags: [People]
      summary: Sign up with an email and a password
      description: >-
        Sends a link to the email to confirm it. The answer is the same when the email has signed up
        before, so it never tells anyone who has an account.
      security: []
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/SignUp'}
            example: {name: Dana Okafor, email: dana@example.com, password: a long and private phrase}
      responses:
        '201': {description: 'The person, whose email is not confirmed yet', content: {application/json: {schema: {$ref: '#/components/schemas/Person'}}}}
        default: {$ref: '#/components/responses/Error'}
  /email/confirm:
    post:
      operationId: confirmEmail
      tags: [People]
      summary: Confirm an email
      description: >-
        Takes the token from the link in the email. The person is signed in, and their first
        workspace, which they own, is made.
      security: []
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/Token'}
            example: {token: the_token_from_the_link}
      responses:
        '200': {description: 'A new session', content: {application/json: {schema: {$ref: '#/components/schemas/Session'}}}}
        default: {$ref: '#/components/responses/Error'}
  /sign-in:
    post:
      operationId: signIn
      tags: [People]
      summary: Sign in with an email and a password
      description: >-
        After 10 wrong passwords for one email, or 50 from one address, within 15 minutes, signing in
        with that email or from that address is refused with too_many_tries until the oldest of
        those tries is 15 minutes old, a right password included, and `wait_seconds` says how
        long that is. A try with an email nobody signed up with counts the same, so the answer
        never tells whether the email has an account. Signing in clears the email's wrong tries.
      security: []
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/SignIn'}
            example: {email: dana@example.com, password: a long and private phrase}
      responses:
        '200': {description: 'A new session', content: {application/json: {schema: {$ref: '#/components/schemas/Session'}}}}
        default: {$ref: '#/components/responses/Error'}
  /sign-in/google:
    post:
      operationId: signInWithGoogle
      tags: [People]
      summary: Sign in with Google
      description: >-
        Takes the ID token Google's sign-in button gives the app. A person new to the platform is
        signed up with the email Google has confirmed and gets a workspace they own.
      security: []
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/GoogleSignIn'}
            example: {id_token: the_id_token_google_gave}
      responses:
        '200': {description: 'A new session', content: {application/json: {schema: {$ref: '#/components/schemas/Session'}}}}
        default: {$ref: '#/components/responses/Error'}
  /password/forgot:
    post:
      operationId: forgotPassword
      tags: [People]
      summary: Ask for a link to set a new password
      description: The answer is the same whether or not the email has signed up.
      security: []
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/Email'}
            example: {email: dana@example.com}
      responses:
        '200': {description: 'Asked', content: {application/json: {schema: {$ref: '#/components/schemas/Done'}}}}
        default: {$ref: '#/components/responses/Error'}
  /password/reset:
    post:
      operationId: resetPassword
      tags: [People]
      summary: Set a new password
      description: Takes the token from the link in the email. Every session the person holds is ended.
      security: []
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/PasswordReset'}
            example: {token: the_token_from_the_link, password: a new long and private phrase}
      responses:
        '200': {description: 'The password is set', content: {application/json: {schema: {$ref: '#/components/schemas/Done'}}}}
        default: {$ref: '#/components/responses/Error'}
  /session:
    get:
      operationId: getSession
      tags: [People]
      summary: Read the session
      description: A key has no session, so a key is answered not found.
      security: [{key: []}]
      x-meter: none
      responses:
        '200': {description: 'The session', content: {application/json: {schema: {$ref: '#/components/schemas/Session'}}}}
        default: {$ref: '#/components/responses/Error'}
    patch:
      operationId: changeSession
      tags: [People]
      summary: Move to another workspace
      description: Calls made with the session act in the workspace it names from then on, with the role held there.
      security: [{key: []}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/SessionChange'}
            example: {workspace: ws_2Vd9kPa7}
      responses:
        '200': {description: 'The session', content: {application/json: {schema: {$ref: '#/components/schemas/Session'}}}}
        default: {$ref: '#/components/responses/Error'}
    delete:
      operationId: signOut
      tags: [People]
      summary: Sign out
      security: [{key: []}]
      x-meter: none
      responses:
        '200': {description: 'The session is ended', content: {application/json: {schema: {$ref: '#/components/schemas/Done'}}}}
        default: {$ref: '#/components/responses/Error'}

  /keys:
    post:
      operationId: addKey
      tags: [Keys]
      summary: Make a key
      security: [{key: [admin]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/KeyNew'}
            example: {name: Indexing server, mode: live, scopes: [footage.read, footage.write]}
      responses:
        '201': {description: 'The key, with its secret shown this once', content: {application/json: {schema: {$ref: '#/components/schemas/Key'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listKeys
      tags: [Keys]
      summary: List keys
      description: Revoked keys included, newest first.
      security: [{key: [admin]}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Keys, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/KeyList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /keys/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    delete:
      operationId: revokeKey
      tags: [Keys]
      summary: Revoke a key
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'The key, revoked', content: {application/json: {schema: {$ref: '#/components/schemas/Key'}}}}
        default: {$ref: '#/components/responses/Error'}

  /usage:
    get:
      operationId: getUsage
      tags: [Usage]
      summary: Read what has been used on each meter
      description: >-
        Each meter for every day of a stretch of at most 366 days, read from the ledger an invoice is
        drawn from. Days are days in UTC. Refused when the stretch ends before it starts or is longer.
      security: [{key: [admin]}]
      x-meter: none
      parameters:
        - {name: from, in: query, description: 'The first day of the stretch. The first day of the month of `to` when left out.', schema: {type: string, format: date}}
        - {name: to, in: query, description: 'The last day of the stretch. Today when left out.', schema: {type: string, format: date}}
      responses:
        '200': {description: 'The meters for the stretch and for each of its days', content: {application/json: {schema: {$ref: '#/components/schemas/Usage'}}}}
        default: {$ref: '#/components/responses/Error'}

  /plans:
    get:
      operationId: getPlans
      tags: [Billing]
      summary: Read the plans and the trial
      description: >-
        Every plan a workspace can pick, with what each month of it includes on each meter and what
        a minute past that costs, and the trial every new workspace starts on. Prices are told here
        and nowhere else. Failed work and a render of a revision in a shape rendered before are not
        in the ledger, so they cost nothing, and reviewers take no paid seat.
      security: []
      x-meter: none
      responses:
        '200': {description: 'The plans and the trial', content: {application/json: {schema: {$ref: '#/components/schemas/Plans'}}}}
        default: {$ref: '#/components/responses/Error'}
  /billing:
    get:
      operationId: getBilling
      tags: [Billing]
      summary: Read the workspace's plan, trial and standing
      description: >-
        The plan picked, when the trial ends, the standing, and the minutes used so far in the trial
        or in the plan's current month against what it includes. Unless the standing is trial, active
        or cancelling, the calls that make new work (addFootage, finishUpload, addBrief, addVideo,
        revise, render, takeProposal and push) are refused with plan_needed, and every call that
        reads still answers.
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'What the workspace pays for now', content: {application/json: {schema: {$ref: '#/components/schemas/Billing'}}}}
        default: {$ref: '#/components/responses/Error'}

  /billing/checkout:
    post:
      operationId: startPlan
      tags: [Billing]
      summary: Pick a plan and pay for it
      description: >-
        Answers a link to Stripe's checkout, where the owner gives a card and pays the plan's first
        month. The standing moves to active once Stripe says it is paid, usually within seconds of
        the owner coming back. A workspace on a plan changes it with changePlan instead, and one
        whose bill is overdue changes its card through openPortal.
      security: [{key: [admin]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/PlanPick'}
            example: {plan: starter}
      responses:
        '201': {description: 'The link to pay at', content: {application/json: {schema: {$ref: '#/components/schemas/Link'}}}}
        default: {$ref: '#/components/responses/Error'}
  /billing/plan:
    post:
      operationId: changePlan
      tags: [Billing]
      summary: Change the plan
      description: >-
        Moves to another plan at once. The minutes of earlier days of the month are billed at the old
        plan straight away, and from today on at the new one, which includes its own minutes for the
        rest of the month. A cancelled plan that has not ended yet carries on instead of ending.
      security: [{key: [admin]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/PlanPick'}
            example: {plan: team}
      responses:
        '200': {description: 'What the workspace pays for now', content: {application/json: {schema: {$ref: '#/components/schemas/Billing'}}}}
        default: {$ref: '#/components/responses/Error'}
  /billing/cancel:
    post:
      operationId: cancelPlan
      tags: [Billing]
      summary: Cancel the plan
      description: >-
        One step. The plan runs to the end of the month already paid for, which `ends` tells, then
        the minutes of that month are billed and nothing is ever charged again. Footage and videos
        stay readable after it ends.
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'What the workspace pays for now', content: {application/json: {schema: {$ref: '#/components/schemas/Billing'}}}}
        default: {$ref: '#/components/responses/Error'}
  /billing/invoices:
    get:
      operationId: listInvoices
      tags: [Billing]
      summary: List invoices
      description: Newest first. A month's invoice charges its minutes past what the plan includes, priced as GET /plans says, so it equals GET /usage for the same days to the cent.
      security: [{key: [admin]}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Invoices, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/InvoiceList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /billing/portal:
    post:
      operationId: openPortal
      tags: [Billing]
      summary: Change the card or billing details
      description: Answers a link to Stripe's billing page for this workspace, where the owner changes the card, the billing address and tax ids, and pays an overdue bill.
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '201': {description: 'The link to the billing page', content: {application/json: {schema: {$ref: '#/components/schemas/Link'}}}}
        default: {$ref: '#/components/responses/Error'}

  /kits:
    post:
      operationId: addKit
      tags: [Kits]
      summary: Start a brand kit
      description: The kit starts as a draft at version 1, with each graphic in a usual place in every picture shape until it is moved.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/KitNew'}
            example: {name: Northwind, colours: {main: '#0B3D2E', accent: '#F2B705'}}
      responses:
        '201': {description: 'The kit as a draft', content: {application/json: {schema: {$ref: '#/components/schemas/Kit'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listKits
      tags: [Kits]
      summary: List brand kits
      description: Each kit as its newest version, newest kit first.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: state, in: query, schema: {type: string}}
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Kits', content: {application/json: {schema: {$ref: '#/components/schemas/KitList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /kits/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getKit
      tags: [Kits]
      summary: Read one kit
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: version, in: query, description: 'The version to read. The newest when left out.', schema: {type: integer, minimum: 1}}
      responses:
        '200': {description: 'The kit', content: {application/json: {schema: {$ref: '#/components/schemas/Kit'}}}}
        default: {$ref: '#/components/responses/Error'}
    patch:
      operationId: changeKit
      tags: [Kits]
      summary: Change a kit
      description: >-
        The change is merged into the newest version as a JSON merge patch: an object is merged key
        by key, null takes a key out, and any other value takes the place of the old one. A change
        to a live kit makes a new draft version, and new videos keep being drawn from the live
        version until the draft is published. Videos keep the version they were made with until
        they are revised.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/KitChange'}
            example: {captions: {weight: 700, highlight: true}, settings: {text.lines-max: 2}, locked: [text.lines-max]}
      responses:
        '200': {description: 'The kit as a draft', content: {application/json: {schema: {$ref: '#/components/schemas/Kit'}}}}
        default: {$ref: '#/components/responses/Error'}
  /kits/{id}/publish:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: publishKit
      tags: [Kits]
      summary: Make the draft the live version
      description: New videos are drawn from the published version from now on.
      security: [{key: [edit.write]}]
      x-meter: none
      responses:
        '200': {description: 'The kit, live', content: {application/json: {schema: {$ref: '#/components/schemas/Kit'}}}}
        default: {$ref: '#/components/responses/Error'}
  /kits/{id}/retire:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: retireKit
      tags: [Kits]
      summary: Stop offering a kit for new videos
      security: [{key: [edit.write]}]
      x-meter: none
      responses:
        '200': {description: 'The kit, retired', content: {application/json: {schema: {$ref: '#/components/schemas/Kit'}}}}
        default: {$ref: '#/components/responses/Error'}
  /kits/{id}/files:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: addKitFile
      tags: [Kits]
      summary: Add a font or logo file
      description: >-
        The answer carries a link to send the file to, whole, straight to storage with one PUT.
        Once it is sent, say so, and the file is checked.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/KitFileNew'}
            example: {kind: font, name: Inter-Bold.woff2, bytes: 111268}
      responses:
        '201': {description: 'The file, waiting to be sent', content: {application/json: {schema: {$ref: '#/components/schemas/KitFile'}}}}
        default: {$ref: '#/components/responses/Error'}
  /kits/{id}/files/{file}/uploaded:
    parameters: [{$ref: '#/components/parameters/Id'}, {$ref: '#/components/parameters/File'}]
    post:
      operationId: finishKitFile
      tags: [Kits]
      summary: Say the file has been sent
      description: >-
        Checks the file is whole and is what it was said to be: a TrueType, OpenType, WOFF or WOFF2
        font, a PNG, JPEG, WebP or SVG picture for a logo, or a PDF for a brand guide. A file that is not is taken out of
        storage, and the right one may be sent to the same link.
      security: [{key: [edit.write]}]
      x-meter: none
      responses:
        '200': {description: 'The file, ready for the kit to use', content: {application/json: {schema: {$ref: '#/components/schemas/KitFile'}}}}
        default: {$ref: '#/components/responses/Error'}

  /kits/{id}/guide:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: readGuide
      tags: [Kits]
      summary: Fill a draft from a brand guide
      description: >-
        Reads a brand guide, from a web address or a PDF sent as a guide file of the kit, with a
        language model, and answers what it says the kit should be, each value marked with where
        it was read, for a person to accept or correct. Nothing in the kit changes: send `change`,
        or the parts of it that are right, to changeKit. A web address is fetched by us, with the
        pages of the same site it links to about colour, type and logos, five at most, and a link
        to a PDF is read as one. An address that is not public on the internet, such as localhost
        or a private network, is refused with bad_request, as is a page that cannot be fetched, is
        bigger than 5 MB, or holds no words, saying why. A guide file is read once it is ready, and
        a PDF with no words in it, only pictures, is refused with wrong_file. A font the guide names
        is matched to a ready font file of the kit by its name, or else to the built-in Poppins,
        or else fetched from Google Fonts into the kit as a ready font file when it is there; one
        found nowhere is named in `fonts_missing` to be uploaded. The logo is taken from the site,
        or from the site a PDF names, when one can be found as a PNG, JPEG, WebP or SVG picture,
        and added to the kit as a ready logo file. Captions are a suggestion that fits the brand,
        never read from the guide. A model that does not answer is refused with our_fault, and
        nothing is made.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/GuideSource'}
            example: {link: 'https://brand.example.com'}
      responses:
        '200': {description: 'What the guide says the kit should be', content: {application/json: {schema: {$ref: '#/components/schemas/GuideReading'}}}}
        default: {$ref: '#/components/responses/Error'}

  /settings:
    get:
      operationId: listSettings
      tags: [Recipes]
      summary: List every edit setting
      description: Every setting the engine reads, with its kind, unit, range and starting value, and none it does not read. A recipe, a kit or a revision may set only these.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: group, in: query, description: Only the settings whose id starts with this group and a dot., schema: {type: string}}
      responses:
        '200': {description: 'Settings', content: {application/json: {schema: {$ref: '#/components/schemas/SettingList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /recipes:
    post:
      operationId: addRecipe
      tags: [Recipes]
      summary: Save a recipe
      description: >-
        A recipe holds only the values it changes. Each setting it sets must be one GET /settings
        lists, other than the pinned and verbatim stretches, which belong to one recording, and
        must fit that setting's range; each it locks must be one it sets. Refused with bad_request
        naming the field otherwise.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/RecipeNew'}
            example: {name: Webinar highlight, level: format, settings: {selection.target-length: 43, cut.pause-over: 1000, cut.pause-to: 500}, locked: []}
      responses:
        '201': {description: 'The recipe', content: {application/json: {schema: {$ref: '#/components/schemas/Recipe'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listRecipes
      tags: [Recipes]
      summary: List recipes
      description: The platforms' recipes first, the same in every workspace, then the workspace's own, newest first.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: level, in: query, description: 'Only the recipes of this level: platform, format, brand or project.', schema: {type: string, enum: [platform, format, brand, project]}}
      responses:
        '200': {description: 'Recipes', content: {application/json: {schema: {$ref: '#/components/schemas/RecipeList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /recipes/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getRecipe
      tags: [Recipes]
      summary: Read one recipe
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The recipe', content: {application/json: {schema: {$ref: '#/components/schemas/Recipe'}}}}
        default: {$ref: '#/components/responses/Error'}
    patch:
      operationId: changeRecipe
      tags: [Recipes]
      summary: Change a recipe
      description: >-
        Merged into the recipe as a JSON merge patch, so a setting sent as null is taken out and
        every layer inside it inherits that value again. A value taken out is taken out of
        locked too. A platform's recipe is the platform's, and changing it is refused with
        bad_request. Revisions already made keep the values they were made with, and a new
        revision of a video reads its recipes as they are then.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/RecipeChange'}
            example: {settings: {selection.target-length: 30, cut.pause-to: null}}
      responses:
        '200': {description: 'The recipe', content: {application/json: {schema: {$ref: '#/components/schemas/Recipe'}}}}
        default: {$ref: '#/components/responses/Error'}
  /recipes/{id}/raise:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: raiseToRecipe
      tags: [Recipes]
      summary: Save values up to a recipe
      description: >-
        Copies values a layer inside this recipe set itself up into this recipe, so that what
        is made with it later inherits them. `from` is a revision whose spec names this recipe
        as its innermost, or a recipe of a level inside this one's. A value saved from a recipe
        is taken out of that recipe, which then inherits it. A revision is never changed, so its
        own value stays until a change of settings sets it to null and puts it back to what it
        inherits. Refused with bad_request when `from` does not set a value named itself, or when
        this recipe is not the layer above it, and when this recipe is a platform's.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/RecipeRaise'}
            example: {from: rev_3Kt7Vb2n, settings: [cut.pause-over, cut.pause-to]}
      responses:
        '200': {description: 'The recipe it was saved to', content: {application/json: {schema: {$ref: '#/components/schemas/Recipe'}}}}
        default: {$ref: '#/components/responses/Error'}

  /briefs:
    post:
      operationId: addBrief
      tags: [Briefs]
      summary: Ask for videos in plain words
      description: >-
        A language model reads the ask and the sentences of the recordings, and writes one spec for
        each video: its moment, made of whole sentences, and values for settings. A value outside a
        setting's range is never used, and a setting the kit or a recipe locks keeps the locked
        value. The model's values are each video's own layer, over the recipes named and the kit.
        A solver that follows rules places every cut. The answer comes back at once in the reading state,
        and a notice is sent when the videos are drafted.


        A brief of kind episode names one ready recording in `footage` and makes one video of kind
        episode from the whole of it, titled with the recording's name. No model chooses moments:
        its first revision's spec is the recording with out.shape 16:9, sound.speaker-match 1,
        sound.noise-removal 12 and text.chapters true, and its render is queued at once. Its words are kept as the ask. It is refused with bad_request
        when it names no recording or more than one, or asks for more than one video, and with
        not_built when it names a kit or recipes.


        A brief may name a recording still arriving or being measured. It is kept in the waiting
        state, and drafting starts on the server the moment every recording it names is ready,
        with nobody needing to keep a page open. It fails, saying why, when one of them fails, is
        archived or deleted, or has not finished arriving within a day. A recording that failed or
        is archived is refused with not_ready.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/BriefNew'}
            example: {words: Three 30-second vertical clips of the strongest points for LinkedIn, footage: [ftg_7Hq2mXc4], kit: kit_3fNw81, recipes: [rcp_linkedin, rcp_9aKd20], count: 3}
      responses:
        '201': {description: 'The brief, being read or waiting for its recordings', content: {application/json: {schema: {$ref: '#/components/schemas/Brief'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listBriefs
      tags: [Briefs]
      summary: List briefs
      description: Newest first.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Briefs, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/BriefList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /briefs/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getBrief
      tags: [Briefs]
      summary: Read one brief
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The brief', content: {application/json: {schema: {$ref: '#/components/schemas/Brief'}}}}
        default: {$ref: '#/components/responses/Error'}

  /videos:
    post:
      operationId: addVideo
      tags: [Videos]
      summary: Make a video from a full spec
      description: >-
        For callers who write the spec themselves. The first revision is made and its render is
        queued. A video of kind episode takes an episode's spec, and is refused with bad_request
        when the spec names more than one recording or a source with from or to, or sets an
        out.shape other than 16:9, with not_ready when the recording is not ready, and with
        not_built when it names a kit or recipes.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/VideoNew'}
            example:
              title: Follow our passions
              spec:
                sources: [{footage: ftg_7Hq2mXc4, from: 24.43, to: 44.9}]
                kit: kit_3fNw81
                recipes: [rcp_9aKd20]
                settings: {out.shape: '9:16', text.captions: true}
                pins: []
      responses:
        '201': {description: 'The video in drafting', content: {application/json: {schema: {$ref: '#/components/schemas/Video'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listVideos
      tags: [Videos]
      summary: List videos
      description: This is the board, newest first, so the video made last comes first. Filter by state to read one column, or by brief.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: state, in: query, schema: {type: string}}
        - {name: brief, in: query, schema: {type: string}}
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Videos, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/VideoList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /videos/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getVideo
      tags: [Videos]
      summary: Read one video
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The video', content: {application/json: {schema: {$ref: '#/components/schemas/Video'}}}}
        default: {$ref: '#/components/responses/Error'}
    patch:
      operationId: changeVideo
      tags: [Videos]
      summary: Retitle or hand a video to someone
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/VideoChange'}
            example: {title: Follow our passions, owner: mem_5tRb11}
      responses:
        '200': {description: 'The video', content: {application/json: {schema: {$ref: '#/components/schemas/Video'}}}}
        default: {$ref: '#/components/responses/Error'}
    delete:
      operationId: archiveVideo
      tags: [Videos]
      summary: Archive a video
      description: Its pushes stay live. Revert them first to take them down.
      security: [{key: [edit.write]}]
      x-meter: none
      responses:
        '200': {description: 'The video, archived', content: {application/json: {schema: {$ref: '#/components/schemas/Video'}}}}
        default: {$ref: '#/components/responses/Error'}
  /videos/{id}/revisions:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: revise
      tags: [Videos]
      summary: Change a video
      description: >-
        Every change is made to a base revision, the current one unless `base` names another
        revision of the same video, and makes a new revision that becomes the current one and
        queues its render. The new revision's `before` is its base. A change is one of: setting
        values, words struck from the transcript, words restored to it, a stretch moved, a pinned
        cut, a whole spec, or an ask in plain words. Each is made as the smallest change to the
        base's spec that the solver honours, so striking words and restoring the same words gives
        back the spec they were struck from. A change of words struck, restored, moved or pinned
        that would leave the base's spec as it is makes no revision: it is refused with
        bad_request, and `field` names the change. A change of settings or a whole spec always
        makes a revision, even one whose spec matches its base. A revision is never edited
        afterwards, so any two can be compared. An episode takes every change but a move, which is
        refused with bad_request since an episode keeps the told order, and each of its revisions
        is held to an episode's spec. An ask in plain words, such as faster or cut the intro, is
        read by a language model with the base's transcript and its settings, which names what
        locks each locked one, and becomes one of the changes above: words struck, restored, moved
        or kept in, setting values, or words with setting values. The revision is made by ask and
        keeps its words in `ask`, and its diff says in plain words what changed. An ask is refused
        with not_ready until the solver has placed the base's cuts. An ask the model finds no
        change for, such as praise, a question or music, is refused with bad_request, `field`
        ask, saying why. An ask that needs a value a kit or recipe locks is refused with locked,
        naming the layer that locked it. A refused ask makes nothing.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/RevisionNew'}
            example: {settings: {cut.pause-over: 600, cut.pause-to: 300}, base: rev_3Kt7Vb2n}
      responses:
        '201': {description: 'The new revision', content: {application/json: {schema: {$ref: '#/components/schemas/Revision'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listRevisions
      tags: [Videos]
      summary: List a video's revisions
      description: >-
        Every revision that is part of the video, newest first. A comment's proposed revision is
        left out until it is taken; read it by its id, which the comment names as `proposal`.
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'Revisions, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/RevisionList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /revisions/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getRevision
      tags: [Videos]
      summary: Read one revision
      description: Reads a comment's proposed revision too, by the id the comment names as `proposal`.
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The revision', content: {application/json: {schema: {$ref: '#/components/schemas/Revision'}}}}
        default: {$ref: '#/components/responses/Error'}
  /revisions/{id}/diff:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getDiff
      tags: [Videos]
      summary: Compare a revision with another
      description: >-
        Compared with the revision before it when no other of the same video is named. What
        changed is given as data and in plain words: settings, words taken out, added or moved,
        pauses made shorter or longer, and the length. Refused until the solver has placed the
        cuts of both.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: against, in: query, schema: {type: string}}
      responses:
        '200': {description: 'What changed, as data and in plain words', content: {application/json: {schema: {$ref: '#/components/schemas/Diff'}}}}
        default: {$ref: '#/components/responses/Error'}
  /revisions/{id}/timeline:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getTimeline
      tags: [Videos]
      summary: Read a revision's transcript on the video's clock, or take it into an editing program
      description: >-
        As words, the answer is every word of the video's sources in the order the video plays:
        each kept word where it is heard, and each dropped word at the join it was cut from, so a
        screen can show the transcript with dropped words struck through. A word a person forced
        in with a pin is marked pinned. A word a person forced out is struck, whether it was
        struck or pinned out, since both make the same pin with keep false. Refused until the
        solver has placed the revision's cuts. As otio or fcpxml, the answer is a link to a
        timeline file.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: format, in: query, schema: {type: string, enum: [words, otio, fcpxml], default: words}}
      responses:
        '200': {description: 'The words of the revision, or a link to the timeline file, good for one hour', content: {application/json: {schema: {$ref: '#/components/schemas/Timeline'}}}}
        default: {$ref: '#/components/responses/Error'}
  /revisions/{id}/renders:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: render
      tags: [Videos]
      summary: Render a revision in another shape
      description: >-
        The first render of a shape is charged by the minute. Rendering the same revision in the
        same shape again costs nothing. An episode renders only in 16:9 for now, and another shape
        is refused with bad_request.
      security: [{key: [edit.write]}]
      x-meter: minutes_rendered
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/RenderNew'}
            example: {shape: '1:1'}
      responses:
        '201': {description: 'The render, queued', content: {application/json: {schema: {$ref: '#/components/schemas/Render'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listRenders
      tags: [Videos]
      summary: List a revision's renders
      description: >-
        Every render of the revision in every shape, failed ones included, newest first. The
        revision's `render` names only the newest in the shape its spec asks for, so a render in
        another shape is found here.
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'Renders, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/RenderList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /renders/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getRender
      tags: [Videos]
      summary: Read one render and its checks
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The render', content: {application/json: {schema: {$ref: '#/components/schemas/Render'}}}}
        default: {$ref: '#/components/responses/Error'}

  /videos/{id}/submit:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: submit
      tags: [Review]
      summary: Send a video for review
      description: >-
        Refused unless the current revision's render has passed its checks. Each member asked to
        review is sent an email with a link to the video.
      security: [{key: [edit.write]}]
      x-meter: none
      requestBody:
        content:
          application/json:
            schema: {$ref: '#/components/schemas/Submission'}
            example: {reviewers: [mem_5tRb11]}
      responses:
        '200': {description: 'The video in review', content: {application/json: {schema: {$ref: '#/components/schemas/Video'}}}}
        default: {$ref: '#/components/responses/Error'}
  /videos/{id}/approve:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: approve
      tags: [Review]
      summary: Approve the revision in review
      description: Refused unless the video is in review. The approval is for that one revision. Any later revision sends the video back to drafting.
      security: [{key: [review.write]}]
      x-meter: none
      responses:
        '200': {description: 'The video, approved', content: {application/json: {schema: {$ref: '#/components/schemas/Video'}}}}
        default: {$ref: '#/components/responses/Error'}
  /videos/{id}/approvals:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: listApprovals
      tags: [Review]
      summary: List a video's approvals
      description: >-
        Every approval the video has had, newest first: the revision approved, its number, the
        member who approved it and when. An approval stays listed after a later revision sends the
        video back to drafting, while the video's `approved_revision` and `approved_by` say only
        whether the current revision is approved.
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'Approvals, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/ApprovalList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /videos/{id}/comments:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: comment
      tags: [Review]
      summary: Comment on a stretch of a video
      description: >-
        The comment sits on a stretch of the revision being watched, the current one unless
        another is named. A language model reads it with the words around the stretch and the
        settings, and turns it into the smallest change that would answer it: words struck,
        restored or moved, or settings changed. The change is held as a proposed revision,
        rendered so the before and after can be watched side by side, and nothing changes until
        the proposal is taken. When the model is not sure, or the comment is praise or a
        question, the comment is left as a note, and why says so. Each member named, and the
        writer of the comment it answers, is sent an email with a link to the moment.
      security: [{key: [review.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/CommentNew'}
            example: {from: 6.2, to: 8.0, words: The pause before the punchline is too long, names: [mem_5tRb11]}
      responses:
        '201': {description: 'The comment', content: {application/json: {schema: {$ref: '#/components/schemas/Comment'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listComments
      tags: [Review]
      summary: List a video's comments
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'Comments, oldest first', content: {application/json: {schema: {$ref: '#/components/schemas/CommentList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /comments/{id}/take:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: takeProposal
      tags: [Review]
      summary: Take the change a comment proposed
      description: >-
        The proposed revision becomes the video's current revision, which sends the video back to
        drafting, and the comment is settled. Refused while the change is still being worked out,
        for a comment left as a note, and when the video has changed since the change was
        proposed.
      security: [{key: [edit.write]}]
      x-meter: none
      responses:
        '200': {description: 'The comment, settled', content: {application/json: {schema: {$ref: '#/components/schemas/Comment'}}}}
        default: {$ref: '#/components/responses/Error'}
  /comments/{id}/settle:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: settleComment
      tags: [Review]
      summary: Settle a comment without taking its change
      security: [{key: [review.write]}]
      x-meter: none
      responses:
        '200': {description: 'The comment, settled', content: {application/json: {schema: {$ref: '#/components/schemas/Comment'}}}}
        default: {$ref: '#/components/responses/Error'}

  /videos/{id}/review-links:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: addReviewLink
      tags: [Review]
      summary: Make a review link for a video
      description: >-
        Anyone who opens the link gives a name and can then watch the video's current revision,
        comment on its moments and approve it, with no account. The link shows nothing else of the
        workspace. Its address is shown once, now, and only a hash of it is kept, so a lost link is
        turned off and a new one made.
      security: [{key: [edit.write]}]
      x-meter: none
      responses:
        '201': {description: 'The link, with its address shown once', content: {application/json: {schema: {$ref: '#/components/schemas/ReviewLink'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listReviewLinks
      tags: [Review]
      summary: List a video's review links and their guests
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'Review links, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/ReviewLinkList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /review-links/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    delete:
      operationId: turnOffReviewLink
      tags: [Review]
      summary: Turn off a review link
      description: The link stops opening at once, and every guest who opened it is refused from the next call on. What they said and approved stays.
      security: [{key: [edit.write]}]
      x-meter: none
      responses:
        '200': {description: 'The link, turned off', content: {application/json: {schema: {$ref: '#/components/schemas/ReviewLink'}}}}
        default: {$ref: '#/components/responses/Error'}
  /guest:
    post:
      operationId: openReviewLink
      tags: [Review]
      summary: Open a review link as a guest
      description: >-
        Takes the secret at the end of the link's address and the name the guest gives. The answer
        carries a guest's token, shown once, which is sent as the bearer token of the guest calls.
        It reaches only the video of the link, and stops working when the link is turned off.
      security: []
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/GuestNew'}
            example: {secret: Xq3vR8mT2wKp9sLd4fHj7nBc5yGz1aEu6oWi0eYr2tU, name: Maya Chen}
      responses:
        '201': {description: 'The guest, with a token shown once', content: {application/json: {schema: {$ref: '#/components/schemas/Guest'}}}}
        default: {$ref: '#/components/responses/Error'}
  /guest/review:
    get:
      operationId: getGuestReview
      tags: [Review]
      summary: Read the video a guest reviews
      description: The video's title and state, its current revision, and that revision's render with a link to watch it.
      security: [{guest: []}]
      x-meter: none
      responses:
        '200': {description: 'The video under review', content: {application/json: {schema: {$ref: '#/components/schemas/GuestReview'}}}}
        default: {$ref: '#/components/responses/Error'}
  /guest/comments:
    post:
      operationId: guestComment
      tags: [Review]
      summary: Comment as a guest on a stretch of the current revision
      description: >-
        Made like a member's comment, so a change to answer it is proposed, and signed with the
        guest's id and name. The video's owner, or the member who made the link when the video
        has no owner, is sent an email with a link to the moment.
      security: [{guest: []}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/GuestCommentNew'}
            example: {from: 6.2, to: 8.0, words: 'Can the logo come in sooner?'}
      responses:
        '201': {description: 'The comment', content: {application/json: {schema: {$ref: '#/components/schemas/GuestComment'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listGuestComments
      tags: [Review]
      summary: List the comments guests of the link made
      description: Members' comments are not shown to guests.
      security: [{guest: []}]
      x-meter: none
      responses:
        '200': {description: 'Comments, oldest first', content: {application/json: {schema: {$ref: '#/components/schemas/GuestCommentList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /guest/comments/{id}/change:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getGuestChange
      tags: [Review]
      summary: Read the change a guest's comment proposes
      description: >-
        For a comment listed to the guest that is proposed: the proposed revision, its render
        with a link to watch it, and what it changes in plain words. Refused with not_ready while
        the change is being worked out, and for a comment left as a note or settled.
      security: [{guest: []}]
      x-meter: none
      responses:
        '200': {description: 'The proposed change', content: {application/json: {schema: {$ref: '#/components/schemas/GuestChange'}}}}
        default: {$ref: '#/components/responses/Error'}
  /guest/comments/{id}/take:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: guestTakeProposal
      tags: [Review]
      summary: Take the change a comment proposes, as a guest
      description: >-
        For a comment listed to the guest. The proposed revision becomes the video's current
        revision and the comment is settled, as when a member takes it. A video in review stays in
        review on the new revision, so the guest can watch it and approve it, and an approval still
        covers only that revision; a video in drafting stays in drafting. Refused with not_ready
        until the proposal's render has passed its checks, when the video has changed since the
        change was proposed, and while the video is approved, scheduled, published or archived.
        The video's owner, or the member who made the link, is sent an email.
      security: [{guest: []}]
      x-meter: none
      responses:
        '200': {description: 'The video under review, on the revision taken', content: {application/json: {schema: {$ref: '#/components/schemas/GuestReview'}}}}
        default: {$ref: '#/components/responses/Error'}
  /guest/approve:
    post:
      operationId: guestApprove
      tags: [Review]
      summary: Approve the revision in review as a guest
      description: >-
        Refused unless the video is in review. The approval covers that one revision and is signed
        with the guest's id. The video's owner, or the member who made the link, is sent an email.
      security: [{guest: []}]
      x-meter: none
      responses:
        '200': {description: 'The video under review, approved', content: {application/json: {schema: {$ref: '#/components/schemas/GuestReview'}}}}
        default: {$ref: '#/components/responses/Error'}

  /channels:
    post:
      operationId: connectChannel
      tags: [Pushes]
      summary: Connect a publishing account
      description: >-
        The answer carries a link where the account's owner signs in and allows posting: Google for
        YouTube, LinkedIn for a company Page, Instagram for a professional account's Reels, and
        TikTok. Every platform sends them back to the app's /channels/signed-in page with a state and
        a code in its address, and the app sends both to finishChannel. Refused with not_built where
        the platform's app is not set up yet.
      security: [{key: [push.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/ChannelNew'}
            example: {platform: youtube}
      responses:
        '201': {description: 'The channel, waiting for sign-in', content: {application/json: {schema: {$ref: '#/components/schemas/Channel'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listChannels
      tags: [Pushes]
      summary: List channels
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'Channels, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/ChannelList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /channels/signed-in:
    post:
      operationId: finishChannel
      tags: [Pushes]
      summary: Finish connecting a channel after its owner signed in
      description: >-
        Takes the state and code the platform put in the address it sent the person back to.
        The channel is connected, or connected again after a reconnect, once the platform gives
        every permission asked for. A reconnect must sign in to the same channel. A LinkedIn member
        who runs more than one Page is asked which one: the channel waits in choosing, listing
        them, until chooseChannelAccount names one, and a member who runs none is refused. The
        tokens the platform gives are kept encrypted and never shown.
      security: [{key: [push.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/ChannelSignedIn'}
            example: {state: 'k3J9xq2LmV8tRb0w', code: '4/0AeanS0Example'}
      responses:
        '200': {description: 'The channel, connected', content: {application/json: {schema: {$ref: '#/components/schemas/Channel'}}}}
        default: {$ref: '#/components/responses/Error'}
  /channels/{id}/account:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: chooseChannelAccount
      tags: [Pushes]
      summary: Choose which of the signed-in person's accounts a channel posts to
      description: >-
        For a channel in choosing: names one of its `choices`, such as one LinkedIn Page of several
        the member runs. Refused when that account is connected already in the workspace.
      security: [{key: [push.write]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/ChannelAccount'}
            example: {account: 'urn:li:organization:2414183'}
      responses:
        '200': {description: 'The channel, connected', content: {application/json: {schema: {$ref: '#/components/schemas/Channel'}}}}
        default: {$ref: '#/components/responses/Error'}
  /channels/{id}/rules:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getChannelRules
      tags: [Pushes]
      summary: Read what a push to a connected channel may be
      description: >-
        The account as the platform shows it, the privacy settings it offers, the longest title and
        description, the shapes, length and size of video it takes, whether it takes a time to go
        public itself, and whether a push can be taken back there. For TikTok it is read from
        TikTok each time, as TikTok asks, with the creator's nickname, the privacy levels the account
        offers and no default among them, and whether the account allows comments, duets and stitches.
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The rules', content: {application/json: {schema: {$ref: '#/components/schemas/ChannelRules'}}}}
        default: {$ref: '#/components/responses/Error'}
  /channels/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    delete:
      operationId: removeChannel
      tags: [Pushes]
      summary: Disconnect a channel
      description: >-
        The platform is told to withdraw the access it gave where it has a way to (Google, LinkedIn and TikTok;
        Instagram has none, and its owner removes Video Bricks under Apps and websites in Instagram's settings), the
        tokens are forgotten, and the channel's name and every number read from it are deleted. Pushes already made
        stay on the channel. A push YouTube holds still goes public at its time unless it is taken back first, and one
        Video Bricks holds for a time fails at that time, since the channel is gone.
      security: [{key: [push.write]}]
      x-meter: none
      responses:
        '200': {description: 'The channel, removed', content: {application/json: {schema: {$ref: '#/components/schemas/Channel'}}}}
        default: {$ref: '#/components/responses/Error'}
  /videos/{id}/pushes:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: push
      tags: [Pushes]
      summary: Push an approved video to a channel
      description: >-
        Sends the approved revision's render in the shape asked for, which must have passed its
        checks. Left out, the shape is the revision's own when the channel takes it, or else the
        first shape the channel takes that has a passed render. Refused unless the video is
        approved, and refused before anything is sent, naming the limit, when the render is
        shorter, longer, larger or of another shape than the channel takes (getChannelRules lists
        them). Give a time to schedule it, and leave it out to push now. YouTube takes the time
        itself: the video goes up at once, private, and YouTube makes it public then. LinkedIn,
        Instagram and TikTok take no time, so Video Bricks holds the push, scheduled, and sends it
        then. YouTube takes a title of 1 to 100 characters and a description of at most 5000 bytes,
        neither with < or >. LinkedIn posts the description as the post's words, at most 3000
        characters, under the title on the video. Instagram and TikTok take one caption of at most
        2200 characters, which is the title, a blank line and the description. A push to TikTok
        needs the `tiktok` choices made by a person on TikTok's own screen, and a privacy, with no
        default, that the account offers; branded content is never private. A push that failed is
        sent again by pushing the same video to the same channel again, which picks up where it
        stopped and never posts twice, and keeps the title, description, privacy and time it began
        sending with; one that is pushing, scheduled or live is refused.
      security: [{key: [push.write]}]
      x-meter: minutes_delivered
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/PushNew'}
            example: {channel: chn_8Lm4Qz, title: Why we build robots, description: 'Two engineers on the hand that started it all.', at: '2026-12-03T15:00:00Z'}
      responses:
        '201': {description: 'The push', content: {application/json: {schema: {$ref: '#/components/schemas/Push'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listPushes
      tags: [Pushes]
      summary: List a video's pushes with their results
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'Pushes, newest first', content: {application/json: {schema: {$ref: '#/components/schemas/PushList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /videos/{id}/push-draft:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getPushDraft
      tags: [Pushes]
      summary: Read the title and description drafted for pushing a video
      description: >-
        Drafted from what is said in the approved revision, once the video is approved, for a
        person to change before pushing. Refused while the video has no approved revision.
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The draft', content: {application/json: {schema: {$ref: '#/components/schemas/PushDraft'}}}}
        default: {$ref: '#/components/responses/Error'}
  /pushes:
    get:
      operationId: listWorkspacePushes
      tags: [Pushes]
      summary: List the workspace's pushes between two days
      description: >-
        Every push of the workspace whose time to go out falls on a day of the stretch, with its results, earliest
        first, so a calendar reads a month in one call. Days are days in UTC, and a stretch is at most 366 days. A
        push with no time yet, such as one being sent now, is left out until it goes out. Refused when the stretch
        ends before it starts or is longer.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {name: from, in: query, required: true, description: The first day of the stretch., schema: {type: string, format: date}}
        - {name: to, in: query, required: true, description: The last day of the stretch., schema: {type: string, format: date}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 100, default: 100}}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Pushes, earliest first', content: {application/json: {schema: {$ref: '#/components/schemas/PushList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /pushes/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    get:
      operationId: getPush
      tags: [Pushes]
      summary: Read one push and its results
      security: [{key: [edit.read]}]
      x-meter: none
      responses:
        '200': {description: 'The push', content: {application/json: {schema: {$ref: '#/components/schemas/Push'}}}}
        default: {$ref: '#/components/responses/Error'}
  /pushes/{id}/revert:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: revert
      tags: [Pushes]
      summary: Take a push back
      description: >-
        Makes the video private on YouTube, which also stops a scheduled one from going public, and
        deletes the post on LinkedIn. A push Video Bricks holds for a time is never sent. Instagram
        and TikTok give apps no way to take a post down, so a push live there is refused, saying to
        delete it in the platform's own app. Refused while the push is still being sent.
      security: [{key: [push.write]}]
      x-meter: none
      responses:
        '200': {description: 'The push, reverted', content: {application/json: {schema: {$ref: '#/components/schemas/Push'}}}}
        default: {$ref: '#/components/responses/Error'}

  /workspace:
    get:
      operationId: getWorkspace
      tags: [Workspace]
      summary: Read the workspace a key or session acts in
      security: [{key: []}]
      x-meter: none
      responses:
        '200': {description: 'The workspace', content: {application/json: {schema: {$ref: '#/components/schemas/Workspace'}}}}
        default: {$ref: '#/components/responses/Error'}
    delete:
      operationId: deleteWorkspace
      tags: [Workspace]
      summary: Delete the workspace for good
      description: >-
        Only the owner, signed in, can do this. Every recording, video, kit, brief, channel, key,
        notice endpoint and member's place in it is removed at once and for good, and each
        channel's access is given back to the platform. What a push put on a channel stays there.
        A plan ends now, billed for the minutes used up to the day before. Refused while a video is
        being pushed or set to go public later. Its people keep their own sign-in. The ledger, the
        minutes sent to be billed and the link to the invoices are kept, since invoices must be.
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'The workspace, deleted', content: {application/json: {schema: {$ref: '#/components/schemas/Workspace'}}}}
        default: {$ref: '#/components/responses/Error'}
  /members:
    post:
      operationId: invite
      tags: [Workspace]
      summary: Invite someone
      security: [{key: [admin]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/MemberNew'}
            example: {email: dana@example.com, role: reviewer}
      responses:
        '201': {description: 'The member, invited', content: {application/json: {schema: {$ref: '#/components/schemas/Member'}}}}
        default: {$ref: '#/components/responses/Error'}
    get:
      operationId: listMembers
      tags: [Workspace]
      summary: List members
      description: Members and the invitations still open, oldest first, so the owner comes first.
      security: [{key: [edit.read]}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/Limit'}
        - {$ref: '#/components/parameters/After'}
      responses:
        '200': {description: 'Members, oldest first', content: {application/json: {schema: {$ref: '#/components/schemas/MemberList'}}}}
        default: {$ref: '#/components/responses/Error'}
  /members/{id}:
    parameters: [{$ref: '#/components/parameters/Id'}]
    patch:
      operationId: changeMember
      tags: [Workspace]
      summary: Change someone's role
      security: [{key: [admin]}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/MemberChange'}
            example: {role: editor}
      responses:
        '200': {description: 'The member', content: {application/json: {schema: {$ref: '#/components/schemas/Member'}}}}
        default: {$ref: '#/components/responses/Error'}
    delete:
      operationId: removeMember
      tags: [Workspace]
      summary: Remove someone
      security: [{key: [admin]}]
      x-meter: none
      responses:
        '200': {description: 'The member, removed', content: {application/json: {schema: {$ref: '#/components/schemas/Member'}}}}
        default: {$ref: '#/components/responses/Error'}
  /members/{id}/join:
    parameters: [{$ref: '#/components/parameters/Id'}]
    post:
      operationId: join
      tags: [Workspace]
      summary: Join a workspace you were invited to
      description: >-
        Takes the id from the link in the invitation. The session's email must be the one invited,
        and the session moves to the workspace joined.
      security: [{key: []}]
      x-meter: none
      responses:
        '200': {description: 'The member, now active', content: {application/json: {schema: {$ref: '#/components/schemas/Member'}}}}
        default: {$ref: '#/components/responses/Error'}
  /faults:
    post:
      operationId: reportFault
      tags: [Workspace]
      summary: Tell us of something that broke in your screens
      description: >-
        For an error your own screens hit, such as a page that would not draw. It is kept with the
        workspace and the place it came from, for our staff to read beside the errors on our side,
        which are kept without being told. At most 30 a minute are kept for a workspace, and the
        rest are answered the same and dropped.
      security: [{key: []}]
      x-meter: none
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: '#/components/schemas/FaultNew'}
            example: {says: "Cannot read properties of undefined (reading 'title')", where: /videos/vid_2Vd9kPa7}
      responses:
        '200': {description: 'The fault is kept', content: {application/json: {schema: {$ref: '#/components/schemas/Done'}}}}
        default: {$ref: '#/components/responses/Error'}

  /staff/costs:
    get:
      operationId: getCosts
      tags: [Staff]
      summary: Read every workspace's cost against what it paid
      description: >-
        For each workspace, in one month: the minutes used, what they cost us, what its invoices
        made in the month and paid came to, and how many errors, stuck work and slow calls were
        recorded for it. Only a session of a person on our staff makes this call, and every other
        session or key is refused with staff_only.
      security: [{key: []}]
      x-meter: none
      parameters:
        - {name: month, in: query, description: 'The month, written as YYYY-MM. This month when left out.', schema: {type: string, pattern: '^[0-9]{4}-[0-9]{2}$'}}
      responses:
        '200': {description: 'Every workspace in the month', content: {application/json: {schema: {$ref: '#/components/schemas/Costs'}}}}
        default: {$ref: '#/components/responses/Error'}

  /staff/workspaces/{id}/faults:
    get:
      operationId: listFaults
      tags: [Staff]
      summary: Read what broke for a workspace
      description: >-
        The newest 50 faults recorded for the workspace, newest first: errors, stuck work and slow
        calls. Only a session of a person on our staff makes this call.
      security: [{key: []}]
      x-meter: none
      parameters:
        - {$ref: '#/components/parameters/Id'}
      responses:
        '200': {description: 'The newest faults', content: {application/json: {schema: {$ref: '#/components/schemas/Faults'}}}}
        default: {$ref: '#/components/responses/Error'}

components:
  securitySchemes:
    key:
      type: http
      scheme: bearer
      description: >-
        A key made in the workspace, or the token of a session a person started by signing in. A live
        key starts with sk_live_ and a test key with sk_test_. A test key answers with real data
        about the sample recordings and the videos drawn only from them, and nothing it does is
        charged. It lists, reads, plays and searches the samples, makes videos from a spec drawn
        only from samples, and revises, renders and reads those videos, within its scopes. Any other
        recording or video is not found for it, and any other call is refused with scope_missing.
        A session acts with the scopes of the role its person holds in the session's workspace.
    guest:
      type: http
      scheme: bearer
      description: >-
        The token of a guest, from opening a review link. It carries no scope: it reaches only the
        guest calls, on the one video of its link, and stops working when the link is turned off.

  parameters:
    Id: {name: id, in: path, required: true, schema: {type: string}}
    File: {name: file, in: path, required: true, schema: {type: string}}
    Limit: {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 100, default: 20}}
    After: {name: after, in: query, description: The `next` value of the list before., schema: {type: string}}
    From: {name: from, in: query, description: 'Where the stretch starts, in seconds. The start of the recording when left out.', schema: {type: number}}
    To: {name: to, in: query, description: 'Where the stretch ends, in seconds. The end of the recording when left out.', schema: {type: number}}

  responses:
    Error:
      description: The call was refused. Nothing changed.
      content:
        application/json:
          schema: {$ref: '#/components/schemas/Error'}

  schemas:
    Error:
      type: object
      required: [error]
      properties:
        error:
          type: object
          required: [code, says]
          properties:
            code:
              type: string
              enum: [bad_request, no_key, sign_in_refused, too_many_tries, email_unconfirmed, scope_missing, not_found, key_reused, parts_missing, not_ready, not_approved, locked, wrong_file, our_fault, not_built, owner_only, plan_needed, too_many_calls, staff_only]
              description: Why the call was refused. Each code always comes with the same status.
            says: {type: string, description: One plain sentence a person can act on.}
            field: {type: string, description: 'The field at fault, when there is one.'}
            wait_seconds: {type: integer, minimum: 1, description: 'How long to wait before asking again, when the code is too_many_tries or too_many_calls. The Retry-After header says the same.'}
            help: {type: string, format: uri}
    Stamp: {type: string, format: date-time}
    Seconds: {type: number, minimum: 0, description: Seconds on the recording's own clock.}
    Sure: {type: number, minimum: 0, maximum: 1, description: 'How sure the measurement is, from 0 to 1.'}
    SureOfWords: {type: [number, 'null'], minimum: 0, maximum: 1, description: 'How sure the speech model is of the words, from 0 to 1. Null when the model that heard this recording gives no sureness.'}
    Shape: {type: string, enum: ['9:16', '1:1', '4:5', '16:9']}
    Settings:
      type: object
      description: Setting ids and their values. GET /settings lists every id.
      additionalProperties: true
    Scope: {type: string, enum: [footage.read, footage.write, edit.read, edit.write, review.write, push.write, admin]}

    Workspace:
      type: object
      x-object: A team account. Everything else belongs to one.
      x-prefix: ws
      x-states:
        active: In use.
        unpaid: A bill is overdue. Reading still works and nothing new is measured, rendered or pushed.
        deleted: Deleted by its owner. Only what its invoices need is kept.
      x-moves:
        - {from: active, to: unpaid, by: system}
        - {from: unpaid, to: active, by: system}
        - {from: active, to: deleted, by: deleteWorkspace}
        - {from: unpaid, to: deleted, by: deleteWorkspace}
      required: [id, name, state, made]
      properties:
        id: {type: string}
        name: {type: string}
        state: {type: string, enum: [active, unpaid, deleted]}
        made: {$ref: '#/components/schemas/Stamp'}

    Member:
      type: object
      x-object: A person in a workspace and the role they hold.
      x-prefix: mem
      x-states:
        invited: Asked to join by email and not yet joined.
        active: In the workspace with a role.
        removed: No longer in the workspace.
      x-moves:
        - {from: invited, to: active, by: join}
        - {from: invited, to: removed, by: removeMember}
        - {from: active, to: removed, by: removeMember}
      required: [id, email, role, state]
      properties:
        id: {type: string}
        email: {type: string, format: email}
        name: {type: [string, 'null']}
        role: {type: string, enum: [owner, admin, editor, reviewer]}
        state: {type: string, enum: [invited, active, removed]}
    MemberNew:
      type: object
      required: [email, role]
      properties:
        email: {type: string, format: email}
        role: {type: string, enum: [admin, editor, reviewer]}
    MemberChange:
      type: object
      required: [role]
      properties:
        role: {type: string, enum: [admin, editor, reviewer]}
    MemberList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Member'}}, next: {type: [string, 'null']}}}

    Person:
      type: object
      x-object: Someone who signs in. A person can belong to several workspaces.
      x-prefix: per
      required: [id, email, name, email_confirmed, made]
      properties:
        id: {type: string}
        email: {type: string, format: email}
        name: {type: string}
        email_confirmed: {type: boolean}
        made: {$ref: '#/components/schemas/Stamp'}
    Session:
      type: object
      description: A person signed in, and the workspace the session acts in.
      required: [person, workspace, role, workspaces, until, staff]
      properties:
        token: {type: string, description: 'Send it as the bearer token. Shown once, when the session starts.'}
        staff: {type: boolean, description: 'Whether the person is on Video Bricks staff, and so may read what every workspace costs.'}
        person: {$ref: '#/components/schemas/Person'}
        workspace: {type: [string, 'null'], description: The workspace calls made with the session act in.}
        role: {type: [string, 'null'], enum: [owner, admin, editor, reviewer, null]}
        workspaces:
          type: array
          description: Every workspace the person belongs to.
          items:
            type: object
            required: [id, name, role]
            properties:
              id: {type: string}
              name: {type: string}
              role: {type: string, enum: [owner, admin, editor, reviewer]}
        until: {$ref: '#/components/schemas/Stamp'}
    FaultNew:
      type: object
      required: [says, where]
      properties:
        says: {type: string, minLength: 1, maxLength: 2000, description: What broke, in the error's own words.}
        where: {type: string, minLength: 1, maxLength: 500, description: 'The page, screen or call it came from.'}
        stack: {type: string, maxLength: 8000, description: Where in your code it broke, if known.}
    SessionChange:
      type: object
      required: [workspace]
      properties:
        workspace: {type: string}
    SignUp:
      type: object
      required: [name, email, password]
      properties:
        name: {type: string, minLength: 1, maxLength: 200}
        email: {type: string, format: email}
        password: {type: string, minLength: 8, maxLength: 128}
    SignIn:
      type: object
      required: [email, password]
      properties:
        email: {type: string, format: email}
        password: {type: string}
    GoogleSignIn:
      type: object
      required: [id_token]
      properties:
        id_token: {type: string}
    Token:
      type: object
      required: [token]
      properties:
        token: {type: string}
    Email:
      type: object
      required: [email]
      properties:
        email: {type: string, format: email}
    PasswordReset:
      type: object
      required: [token, password]
      properties:
        token: {type: string}
        password: {type: string, minLength: 8, maxLength: 128}
    Done:
      type: object
      required: [done]
      properties:
        done: {type: boolean, enum: [true]}

    Key:
      type: object
      x-object: A secret a program uses to call the API, limited to the scopes it was given.
      x-prefix: key
      x-states:
        active: Accepted.
        revoked: Refused from now on.
      x-moves:
        - {from: active, to: revoked, by: revokeKey}
      required: [id, name, mode, scopes, state, made]
      properties:
        id: {type: string}
        name: {type: string}
        mode: {type: string, enum: [live, test], description: 'A test key works only on the sample recordings and the videos drawn only from them, and is never charged. The key security scheme says which calls it makes.'}
        scopes: {type: array, items: {$ref: '#/components/schemas/Scope'}}
        state: {type: string, enum: [active, revoked]}
        secret: {type: string, description: 'Shown once, when the key is made.'}
        last_used: {oneOf: [{$ref: '#/components/schemas/Stamp'}, {type: 'null'}]}
        made: {$ref: '#/components/schemas/Stamp'}
    KeyNew:
      type: object
      required: [name, mode, scopes]
      properties:
        name: {type: string}
        mode: {type: string, enum: [live, test]}
        scopes: {type: array, items: {$ref: '#/components/schemas/Scope'}}
    KeyList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Key'}}, next: {type: [string, 'null']}}}

    Footage:
      type: object
      x-object: One recording, stored and measured.
      x-prefix: ftg
      x-states:
        uploading: Named, and its file has not fully arrived.
        measuring: The file is here and is being measured.
        ready: Measured. Its index can be read and it can be used in videos.
        failed: The file could not be read or measured. `problem` says why.
        archived: Put away. Removed for good 30 days later.
        deleted: Deleted for good, with every video made from it.
      x-moves:
        - {from: uploading, to: measuring, by: finishUpload}
        - {from: uploading, to: measuring, by: system}
        - {from: uploading, to: failed, by: system}
        - {from: measuring, to: ready, by: system}
        - {from: measuring, to: failed, by: system}
        - {from: ready, to: measuring, by: measureAgain}
        - {from: ready, to: archived, by: archiveFootage}
        - {from: failed, to: archived, by: archiveFootage}
        - {from: archived, to: ready, by: restoreFootage}
        - {from: archived, to: failed, by: restoreFootage}
        - {from: uploading, to: deleted, by: deleteFootage}
        - {from: measuring, to: deleted, by: deleteFootage}
        - {from: ready, to: deleted, by: deleteFootage}
        - {from: failed, to: deleted, by: deleteFootage}
        - {from: archived, to: deleted, by: deleteFootage}
      required: [id, name, state, keep, labels, made]
      properties:
        id: {type: string}
        name: {type: string}
        state: {type: string, enum: [uploading, measuring, ready, failed, archived, deleted]}
        problem: {type: [string, 'null'], description: 'Why it failed, in one sentence.'}
        keep:
          type: string
          enum: [original, proxy, index]
          description: >-
            What is stored once measuring ends. `original` keeps the file as sent, so videos are cut
            from it at full quality and it can be measured again. `proxy` keeps only the light copy
            made for playing, at most 1920 by 1080, and removes the file as sent: it can still be
            watched, searched and cut into videos, at the light copy's quality. `index` keeps the
            measurements only and removes the file and the light copy: its index, words and series
            can be read and searched, and it cannot be played or cut into a video. A recording kept
            as its index only is not counted on minutes_stored.
        labels: {type: array, items: {type: string}}
        seconds: {type: [number, 'null']}
        bytes: {type: [integer, 'null']}
        picture:
          type: [object, 'null']
          properties:
            width: {type: integer}
            height: {type: integer}
            frames_a_second: {type: number}
            frames: {type: integer}
            curve: {type: string, description: The brightness curve the file declares.}
        sound:
          type: [object, 'null']
          properties:
            samples_a_second: {type: integer}
            channels: {type: integer}
        measured: {type: [string, 'null'], description: The version of the measurements its index was made with.}
        link: {type: [string, 'null'], description: 'The link its file is fetched from. Null for an upload.'}
        removed: {oneOf: [{$ref: '#/components/schemas/Stamp'}, {type: 'null'}], description: 'When an archived recording''s file and index are removed for good. Null unless it is archived.'}
        sample:
          type: boolean
          description: >-
            True for a sample recording, the same in every workspace. It can be read, played and named
            in a brief or a spec, and never changed, archived or deleted. Nothing done with it is
            charged. A brief that names no recordings leaves the samples out.
        upload:
          type: [object, 'null']
          description: Present while the file is still to be sent.
          properties:
            part_bytes: {type: integer}
            parts: {type: array, items: {type: object, required: [number, url], properties: {number: {type: integer}, url: {type: string, format: uri}}}}
            until: {$ref: '#/components/schemas/Stamp'}
        made: {$ref: '#/components/schemas/Stamp'}
    FootageNew:
      type: object
      required: [source]
      properties:
        name: {type: string, minLength: 1, maxLength: 200, description: 'Needed for an upload. For a link left out, the name the file is given where it is kept.'}
        bytes: {type: integer, description: The size of the file. Needed for an upload.}
        keep: {type: string, enum: [original, proxy, index], default: original, description: What is stored once measuring ends. See Footage.}
        labels: {type: array, maxItems: 20, items: {type: string, minLength: 1, maxLength: 40}}
        source:
          type: object
          required: [from]
          properties:
            from: {type: string, enum: [upload, link, drive, dropbox]}
            link:
              type: string
              maxLength: 2000
              description: >-
                Needed for a link. A link straight to the file, or a shared link from Google Drive,
                Dropbox, Box or OneDrive that anyone with the link can open. One sent with no
                http:// or https:// is read as https://.
    FootageChange:
      type: object
      properties:
        name: {type: string, minLength: 1, maxLength: 200}
        labels: {type: array, maxItems: 20, items: {type: string, minLength: 1, maxLength: 40}}
        keep: {type: string, enum: [original, proxy, index]}
    FootageList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Footage'}}, next: {type: [string, 'null']}}}
    Labels:
      type: object
      required: [data]
      properties:
        data:
          type: array
          items:
            type: object
            required: [label, count]
            properties:
              label: {type: string}
              count: {type: integer, minimum: 1, description: How many recordings that are not archived carry it.}
    Sample:
      type: object
      description: A sample recording and the videos drafted from it. A video's spec names no kit, so any workspace can send it as it is.
      required: [footage, videos]
      properties:
        footage: {$ref: '#/components/schemas/Footage'}
        videos:
          type: array
          items:
            type: object
            required: [title, spec]
            properties:
              title: {type: string}
              spec: {$ref: '#/components/schemas/Spec'}
    SampleList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Sample'}}, next: {type: [string, 'null']}}}

    Index:
      type: object
      description: What was found in one stretch of one recording.
      required: [footage, measured, from, to, summary, speakers, events, not_measured, bars]
      properties:
        footage: {type: string}
        measured: {type: string}
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
        summary:
          type: object
          required: [shots, words, speaking_seconds, words_a_second, loudness_lufs, true_peak_db, faults]
          properties:
            shots: {type: integer}
            words: {type: integer}
            speaking_seconds: {type: number}
            words_a_second: {type: [number, 'null']}
            loudness_lufs: {type: [number, 'null'], description: Loudness to the broadcast standard.}
            true_peak_db: {type: [number, 'null'], description: 'The highest peak, in decibels under full scale.'}
            faults: {type: object, additionalProperties: {type: integer}, description: How many stretches of each fault were found.}
        speakers:
          type: array
          items:
            type: object
            required: [speaker, seconds]
            properties:
              speaker: {type: string, description: 'speaker-1, speaker-2 and so on in the order first heard, or unknown.'}
              seconds: {type: number}
        events: {type: array, items: {$ref: '#/components/schemas/Event'}}
        not_measured: {type: array, items: {type: string}, description: 'Kinds of event that were never measured in this recording. An empty list of events of a kind named here means not looked for, not none found.'}
        bars: {type: object, additionalProperties: {type: number}, description: The bars this answer was made with.}
    Event:
      type: object
      description: One thing found in a recording, with its exact times.
      required: [kind, from, to]
      properties:
        kind: {type: string, enum: [shot, sentence, pause, filler, repeat, sound, words_on_screen, fault]}
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
      oneOf:
        - title: shot
          description: From one cut to the next.
          properties:
            kind: {const: shot}
            first_frame: {type: integer}
            last_frame: {type: integer}
            face: {type: [boolean, 'null'], description: 'Whether a face is in the shot. Null when faces were not looked for in this recording.'}
          required: [first_frame, last_frame, face]
        - title: sentence
          description: A run of words up to a full stop, question mark or exclamation mark.
          properties:
            kind: {const: sentence}
            says: {type: string}
            speaker: {type: string}
            sure: {$ref: '#/components/schemas/SureOfWords'}
          required: [says, speaker, sure]
        - title: pause
          description: A stretch from where one sound stops to where the next starts.
          properties:
            kind: {const: pause}
            room_db: {type: number, description: The level of the room during the pause.}
          required: [room_db]
        - title: filler
          description: An um, uh, er or mm.
          properties:
            kind: {const: filler}
            says: {type: string}
          required: [says]
        - title: repeat
          description: 'A run of four or more words said again within a minute, fillers left out. The times are those of the first telling. It says only that the words came again: whether the first telling is a retake to cut is for the caller to judge, from how many words came between and how often the run is said in the whole recording.'
          properties:
            kind: {const: repeat}
            says: {type: string}
            again_from: {$ref: '#/components/schemas/Seconds'}
            again_to: {$ref: '#/components/schemas/Seconds'}
            words: {type: integer, minimum: 4, description: How many words the run holds.}
            between: {type: integer, minimum: 0, description: 'How many words, fillers left out, were said between the end of the first telling and the start of the second. 0 means the speaker started again straight away.'}
            times_said: {type: integer, minimum: 2, description: 'How many times the run is said in the whole recording. A common phrase is said many times.'}
          required: [says, again_from, again_to, words, between, times_said]
        - title: sound
          description: A laugh, music or a breath.
          properties:
            kind: {const: sound}
            what: {type: string, enum: [laugh, music, breath]}
            sure: {$ref: '#/components/schemas/Sure'}
          required: [what, sure]
        - title: words_on_screen
          description: A line of words shown in the picture.
          properties:
            kind: {const: words_on_screen}
            says: {type: string}
            sure: {$ref: '#/components/schemas/Sure'}
            box:
              type: object
              description: The middle and size of the line, as shares of the frame.
              required: [x, y, width, height]
              properties: {x: {type: number}, y: {type: number}, width: {type: number}, height: {type: number}}
          required: [says, sure, box]
        - title: fault
          description: A stretch an editor would avoid.
          properties:
            kind: {const: fault}
            what: {type: string, enum: [soft, shaky, blown, crushed, clipped]}
            value: {type: number, description: 'What was measured over the stretch, in the units of its bar.'}
          required: [what, value]
    Words:
      type: object
      required: [footage, from, to, words]
      properties:
        footage: {type: string}
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
        words:
          type: array
          items:
            type: object
            required: [says, from, to, sure]
            properties:
              says: {type: string}
              from: {$ref: '#/components/schemas/Seconds'}
              to: {$ref: '#/components/schemas/Seconds'}
              sure: {$ref: '#/components/schemas/SureOfWords'}
    Series:
      type: object
      required: [footage, from, to, series]
      properties:
        footage: {type: string}
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
        series:
          type: array
          items:
            type: object
            required: [name, unit, seconds]
            properties:
              name: {type: string, enum: [loudness, sound_level, speech, pitch, sharpness, shake, brightness, faces, colour]}
              part: {type: string, description: 'Which reading of the series this is, such as blue. Left out when the series has one.'}
              unit: {type: string}
              seconds:
                type: array
                description: 'One row for each second, as lowest, mean and highest. A second with no reading holds nulls.'
                items: {type: array, items: {type: [number, 'null']}, minItems: 3, maxItems: 3}
    Frame:
      type: object
      required: [footage, at, frame, width, height, link, until]
      properties:
        footage: {type: string}
        at: {type: integer, minimum: 0, description: 'The whole second the still shows.'}
        frame: {type: integer, minimum: 0, description: 'The number of the frame shown at that second, counted from 0.'}
        width: {type: integer}
        height: {type: integer}
        link: {type: string, format: uri, description: A JPEG.}
        until: {$ref: '#/components/schemas/Stamp'}
    Play:
      type: object
      required: [footage, link, picture, stills, sound, until]
      properties:
        footage: {type: string}
        link:
          type: string
          format: uri
          description: >-
            An HLS playlist of the playing copy: H.264 picture no larger than 1920 by 1080, or 1080
            by 1920 standing, and AAC sound, in fragmented MP4 pieces of about four seconds that
            each start on a key frame, so a player can start from any second. Safari plays it as it
            is, and Chrome through Media Source Extensions with a player such as hls.js.
        picture:
          type: [object, 'null']
          description: The size of the copy's picture. Null for a recording with only sound.
          required: [width, height]
          properties:
            width: {type: integer}
            height: {type: integer}
        stills:
          type: [object, 'null']
          description: >-
            A strip of small stills, one every few seconds, laid in rows on JPEG sheets. The still
            for second `from + every × n` of a sheet sits in column `n mod columns` and row
            `floor(n / columns)`. Null for a recording with only sound.
          required: [every, width, height, columns, sheets]
          properties:
            every: {type: integer, description: Seconds between stills.}
            width: {type: integer, description: The width of one still.}
            height: {type: integer, description: The height of one still.}
            columns: {type: integer}
            sheets:
              type: array
              items:
                type: object
                required: [from, count, link]
                properties:
                  from: {type: integer, description: 'The whole second of the first still on the sheet.'}
                  count: {type: integer}
                  link: {type: string, format: uri}
        sound:
          type: [object, 'null']
          description: >-
            The shape of the sound: one byte for each hundredth of a second, the loudest sample in
            it from 0 for 60 dB below full scale or quieter to 255 for full scale, even in decibels
            between. Null for a recording with no sound.
          required: [every, count, link]
          properties:
            every: {type: number, description: Seconds each byte covers.}
            count: {type: integer}
            link: {type: string, format: uri}
        until: {$ref: '#/components/schemas/Stamp'}

    SearchAsk:
      type: object
      required: [words]
      properties:
        words: {type: string, minLength: 1, maxLength: 500, description: 'What to look for, in plain words. A moment that holds more of the words comes first. Sounds are found by their names, such as laughter, music or breath.'}
        footage: {type: array, minItems: 1, items: {type: string}, description: Only these recordings.}
        labels: {type: array, minItems: 1, items: {type: string}, description: Only recordings carrying any of these labels.}
        speakers: {type: array, minItems: 1, items: {type: string}, description: 'Only words said by these speakers, named as in the index. Words on screen and sounds have no speaker, so naming speakers leaves them out.'}
        since: {$ref: '#/components/schemas/Stamp', description: Only recordings added at or after this time.}
        until: {$ref: '#/components/schemas/Stamp', description: Only recordings added before this time.}
        within: {type: array, minItems: 1, items: {type: string, enum: [said, on_screen, heard]}, description: Where to look. Everywhere when left out.}
        limit: {type: integer, minimum: 1, maximum: 100, default: 20}
    Moments:
      type: object
      required: [data]
      properties:
        data:
          type: array
          items:
            type: object
            required: [footage, from, to, found, says, score]
            properties:
              footage: {type: string}
              from: {$ref: '#/components/schemas/Seconds'}
              to: {$ref: '#/components/schemas/Seconds'}
              found: {type: string, enum: [said, on_screen, heard]}
              says: {type: string, description: 'The sentence said, the line on screen, or the name of the sound heard. A line shown for several seconds in a row is one moment.'}
              speaker: {type: string, description: Who said it. Only on words said.}
              score: {type: number, minimum: 0, maximum: 1, description: 'How well the moment answers. It rises with the share of the asked words it holds, then with how close together they sit.'}

    NoticeEndpoint:
      type: object
      x-object: A URL of yours that notices are sent to.
      x-prefix: nep
      x-states:
        sending: Notices are being sent.
        failing: The last notice sent was refused. Each refused notice is sent again for a day.
        stopped: Switched off. Nothing more is sent to it.
      x-moves:
        - {from: sending, to: failing, by: system}
        - {from: failing, to: sending, by: system}
        - {from: sending, to: stopped, by: removeNoticeEndpoint}
        - {from: failing, to: stopped, by: removeNoticeEndpoint}
      required: [id, url, kinds, state]
      properties:
        id: {type: string}
        url: {type: string, format: uri}
        kinds: {type: array, items: {$ref: '#/components/schemas/NoticeKind'}}
        state: {type: string, enum: [sending, failing, stopped]}
        secret: {type: string, description: 'Signs every notice, the Standard Webhooks way. Shown once, when the endpoint is made.'}
    NoticeEndpointNew:
      type: object
      required: [url, kinds]
      properties:
        url: {type: string, format: uri, description: An https address.}
        kinds: {type: array, minItems: 1, items: {$ref: '#/components/schemas/NoticeKind'}}
    NoticeEndpointChange:
      type: object
      properties:
        url: {type: string, format: uri, description: An https address.}
        kinds: {type: array, minItems: 1, items: {$ref: '#/components/schemas/NoticeKind'}}
    NoticeEndpointList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/NoticeEndpoint'}}, next: {type: [string, 'null']}}}
    NoticeKind:
      type: string
      description: The object and the state it moved to.
      enum:
        - footage.measuring
        - footage.ready
        - footage.failed
        - footage.archived
        - footage.deleted
        - brief.reading
        - brief.drafted
        - brief.failed
        - video.idea
        - video.changed
        - video.drafting
        - video.in_review
        - video.approved
        - video.scheduled
        - video.published
        - video.archived
        - video.deleted
        - render.rendering
        - render.checking
        - render.passed
        - render.failed
        - comment.proposed
        - push.pushing
        - push.scheduled
        - push.live
        - push.failed
        - push.reverted
        - channel.choosing
        - channel.connected
        - channel.reconnect
        - channel.removed
    Notice:
      type: object
      x-object: One message saying a state moved. Signed, so your server can tell it is real.
      x-prefix: ntc
      required: [id, kind, at, about]
      properties:
        id: {type: string}
        kind: {$ref: '#/components/schemas/NoticeKind'}
        at: {$ref: '#/components/schemas/Stamp'}
        about: {type: string, description: The id of the object that moved.}
    NoticeList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Notice'}}, next: {type: [string, 'null']}}}
    Changes:
      type: object
      required: [data, next]
      properties:
        data: {type: array, items: {$ref: '#/components/schemas/Notice'}}
        next: {type: string, description: 'The cursor to send as `after` next time. Never null.'}

    Usage:
      type: object
      description: >-
        The ledger holds one row for each piece of metered work, written once however often the work
        is tried, in whole milliseconds. Work that failed on our side is not in it, and neither is a
        render of a revision in a shape it was rendered in before. The meters of the stretch are the
        sum of its days.
      required: [from, to, meters, days]
      properties:
        from: {type: string, format: date}
        to: {type: string, format: date}
        meters: {$ref: '#/components/schemas/Meters'}
        days:
          type: array
          description: Every day of the stretch in order, a day with nothing used included.
          items:
            type: object
            required: [day, meters]
            properties:
              day: {type: string, format: date}
              meters: {$ref: '#/components/schemas/Meters'}

    Plans:
      type: object
      description: The plans a workspace can pick, and the trial every new workspace starts on.
      required: [currency, trial, data]
      properties:
        currency: {type: string, description: 'The currency every price is in, as a three-letter ISO code in lowercase.'}
        trial:
          type: object
          description: >-
            A new workspace starts on the trial with no card. It ends after its days or once any meter
            reaches what the trial includes, whichever comes first.
          required: [days, includes, limits]
          properties:
            days: {type: integer, minimum: 1}
            includes: {$ref: '#/components/schemas/Meters'}
            limits: {$ref: '#/components/schemas/Limits'}
        data: {type: array, items: {$ref: '#/components/schemas/Plan'}}

    Limits:
      type: object
      description: >-
        What a workspace may do at once, set by its plan, or by the trial before a plan is paid for.
        They keep one workspace from slowing every other one down.
      required: [calls_a_minute, hours_measuring_at_once]
      properties:
        calls_a_minute:
          type: integer
          minimum: 1
          description: >-
            Calls made with the workspace's keys, sessions and guests' tokens in one minute, counted
            from the start of each minute in UTC. Past it, a call is refused with too_many_calls and
            `wait_seconds` says when the next minute starts.
        hours_measuring_at_once:
          type: number
          exclusiveMinimum: 0
          description: >-
            Hours of recordings measured at the same time. A recording that would go past it is
            not refused: it stays measuring and waits until enough of the others are ready. A
            recording longer than the limit is measured alone.

    Plan:
      type: object
      description: >-
        One plan. Each month of it is paid at its start, and the minutes past what it includes are
        added up over the month and paid at its end.
      required: [id, name, cents_a_month, includes, cents_a_minute_over, limits]
      properties:
        id: {type: string, description: 'Sent as `plan` to pick it.'}
        name: {type: string}
        cents_a_month: {type: integer, minimum: 0, description: 'The price of each month, in cents of the currency.'}
        includes: {$ref: '#/components/schemas/Meters'}
        cents_a_minute_over: {$ref: '#/components/schemas/Meters'}
        limits: {$ref: '#/components/schemas/Limits'}

    PlanPick:
      type: object
      required: [plan]
      properties:
        plan: {type: string, description: 'The id of a plan GET /plans lists.'}

    Link:
      type: object
      required: [url]
      properties:
        url: {type: string, format: uri, description: 'Where to send the owner. It works for a short while and once.'}

    Invoice:
      type: object
      description: One bill, kept by Stripe.
      required: [id, number, state, from, to, total_cents, currency, link, made]
      properties:
        id: {type: string}
        number: {type: [string, 'null']}
        state: {type: string, enum: [draft, open, paid, uncollectible, void]}
        from: {$ref: '#/components/schemas/Stamp'}
        to: {$ref: '#/components/schemas/Stamp'}
        total_cents: {type: integer, description: 'The total, in cents of the currency.'}
        currency: {type: string}
        link: {type: [string, 'null'], format: uri, description: 'The invoice as a page to read and pay.'}
        made: {$ref: '#/components/schemas/Stamp'}
    InvoiceList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Invoice'}}, next: {type: [string, 'null']}}}

    Billing:
      type: object
      description: >-
        What the workspace pays for now. Days are days in UTC, and a day's minutes are counted in the
        month the day is in, so the minutes used in a stretch are what GET /usage reads for it.
      required: [plan, standing, trial_ends, from, to, ends, includes, used, limits]
      properties:
        plan: {type: [string, 'null'], description: 'The id of the plan picked. Null before one is picked.'}
        standing:
          type: string
          enum: [trial, trial_over, active, cancelling, unpaid, cancelled]
          description: >-
            trial: on the trial, making anything. trial_over: the trial's days or minutes ran out.
            active: on a plan, paid up. cancelling: cancelled, and still making anything until `ends`.
            unpaid: a bill is overdue. cancelled: the plan has ended and nothing more is charged.
            Only trial, active and cancelling make new work. In every standing, everything made
            already stays readable.
        trial_ends: {$ref: '#/components/schemas/Stamp'}
        from: {type: string, format: date, description: 'The first day `used` counts: the trial''s first day, or the first day of the plan''s current month.'}
        to: {type: string, format: date, description: 'The last day of the trial, or of the plan''s current month.'}
        ends: {type: [string, 'null'], format: date-time, description: 'When a cancelled plan stops. Null unless it was cancelled.'}
        includes: {$ref: '#/components/schemas/Meters'}
        used: {$ref: '#/components/schemas/Meters'}
        limits: {$ref: '#/components/schemas/Limits'}

    Costs:
      type: object
      description: >-
        Every workspace's month: what it used, what that cost us, what it paid and what broke for it,
        the dearest first. Days are days in UTC.
      required: [month, from, to, currency, data]
      properties:
        month: {type: string, pattern: '^[0-9]{4}-[0-9]{2}$'}
        from: {type: string, format: date, description: The first day of the month.}
        to: {type: string, format: date, description: 'The last day of the month, or today while the month is under way.'}
        currency: {type: string, description: 'The currency of every amount, as a three-letter ISO code in lowercase.'}
        data: {type: array, items: {$ref: '#/components/schemas/WorkspaceCost'}}

    WorkspaceCost:
      type: object
      required: [workspace, name, state, plan, standing, limits, used, cost, paid_cents, faults]
      properties:
        workspace: {type: string}
        name: {type: string}
        state: {type: string, enum: [active, unpaid, deleted]}
        plan: {type: [string, 'null'], description: 'The id of the plan it is on now. Null on the trial.'}
        standing: {type: string, enum: [trial, trial_over, active, cancelling, unpaid, cancelled]}
        limits: {$ref: '#/components/schemas/Limits'}
        used: {$ref: '#/components/schemas/Meters'}
        cost:
          type: object
          description: >-
            What the month cost us, in cents. Measuring and rendering are the minutes used at what a
            minute cost on our machines when last measured, storing is the bytes of each recording
            for each day it is counted as stored, and models is what each call to a language model
            was charged, as the model's provider told it.
          required: [measuring_cents, rendering_cents, storing_cents, models_cents, total_cents]
          properties:
            measuring_cents: {type: number, minimum: 0}
            rendering_cents: {type: number, minimum: 0}
            storing_cents: {type: number, minimum: 0}
            models_cents: {type: number, minimum: 0}
            total_cents: {type: number, minimum: 0}
        paid_cents: {type: [integer, 'null'], description: 'What its invoices made in the month and paid came to, in cents. Null when payments are not set up.'}
        faults:
          type: object
          description: What was recorded as broken for it in the month.
          required: [errors, stuck, slow]
          properties:
            errors: {type: integer, minimum: 0, description: 'Errors on the API, the machines and its screens.'}
            stuck: {type: integer, minimum: 0, description: 'Work found held in a working state past its limit.'}
            slow: {type: integer, minimum: 0, description: Calls that took 5 seconds or more.}

    Fault:
      type: object
      required: [id, at, source, kind, call, about, says]
      properties:
        id: {type: string}
        at: {$ref: '#/components/schemas/Stamp'}
        source: {type: string, enum: [api, service, worker, app]}
        kind: {type: string, enum: [error, slow, stuck]}
        call: {type: string, description: 'The call, step or screen it came from.'}
        about: {type: [string, 'null'], description: 'The id of the recording, brief, video, render or push it concerns, when there is one.'}
        says: {type: string}
    Faults:
      type: object
      required: [data]
      properties:
        data: {type: array, items: {$ref: '#/components/schemas/Fault'}}

    Meters:
      type: object
      required: [minutes_measured, minutes_stored, minutes_rendered, minutes_delivered]
      properties:
        minutes_measured: {type: number, minimum: 0, description: 'Minutes of footage measured. A recording counts once, on the day it becomes ready.'}
        minutes_stored: {type: number, minimum: 0, description: 'Minutes of footage held. A recording counts once for each day it is ready for any part of, so ten minutes held for 30 days is 300. One kept as its index only stops counting the day after.'}
        minutes_rendered: {type: number, minimum: 0, description: 'Minutes of finished video rendered and checked. A revision counts once in each shape, when a render of it first passes its checks. A render that fails its checks costs nothing.'}
        minutes_delivered: {type: number, minimum: 0, description: 'Minutes of finished video downloaded or pushed. Not counted yet, so it reads 0.'}

    Kit:
      type: object
      x-object: A brand's look and sound, set once and applied to every video.
      x-prefix: kit
      description: >-
        The state, the live version and the files are the kit's own. Everything else is the version
        read, which is the newest unless another was asked for.
      x-states:
        draft: Being put together or changed. A version published before is still the one new videos are drawn from.
        live: Its newest version is applied to new videos and new revisions.
        retired: Kept for the videos made with it and offered for nothing new.
      x-moves:
        - {from: draft, to: live, by: publishKit}
        - {from: live, to: draft, by: changeKit}
        - {from: live, to: retired, by: retireKit}
        - {from: draft, to: retired, by: retireKit}
      required: [id, name, version, state, live_version, published, colours, fonts, logo, captions, name_label, opening_card, end_card, music, places, settings, locked, files, made]
      properties:
        id: {type: string}
        name: {type: string, minLength: 1}
        version: {type: integer, minimum: 1}
        state: {type: string, enum: [draft, live, retired]}
        live_version: {type: [integer, 'null'], description: The version new videos are drawn from. Null until the kit is first published.}
        published: {oneOf: [{$ref: '#/components/schemas/Stamp'}, {type: 'null'}], description: When this version was published. Null while it is a draft.}
        colours: {type: object, additionalProperties: {$ref: '#/components/schemas/Colour'}}
        fonts: {type: object, additionalProperties: {type: string}, description: 'Each use, such as captions or titles, and the id of the ready font file it is drawn in.'}
        logo: {type: [string, 'null'], description: The id of the ready logo file.}
        captions: {type: object, additionalProperties: true}
        name_label: {type: object, additionalProperties: true, description: How a speaker's name and title are shown.}
        opening_card: {type: object, additionalProperties: true}
        end_card: {type: object, additionalProperties: true}
        music: {type: object, additionalProperties: true}
        places: {$ref: '#/components/schemas/Places'}
        settings: {$ref: '#/components/schemas/Settings'}
        locked: {type: array, items: {type: string}, description: 'Setting ids no video may set to another value than the kit''s. Each is one of the kit''s settings.'}
        files: {type: array, items: {$ref: '#/components/schemas/KitFile'}}
        made: {$ref: '#/components/schemas/Stamp'}
    KitChange:
      type: object
      description: Merged into the kit as a JSON merge patch. Null takes a key out.
      properties:
        name: {type: string, minLength: 1}
        colours: {type: object, additionalProperties: {oneOf: [{$ref: '#/components/schemas/Colour'}, {type: 'null'}]}}
        fonts: {type: object, additionalProperties: {type: [string, 'null']}}
        logo: {type: [string, 'null']}
        captions: {type: object, additionalProperties: true}
        name_label: {type: object, additionalProperties: true}
        opening_card: {type: object, additionalProperties: true}
        end_card: {type: object, additionalProperties: true}
        music: {type: object, additionalProperties: true}
        places: {type: object, additionalProperties: true, description: 'Only the shapes and graphics that move, such as {"9:16": {logo: {x: 0.8}}}.'}
        settings: {$ref: '#/components/schemas/Settings'}
        locked: {type: array, items: {type: string}}
    KitNew:
      allOf:
        - {$ref: '#/components/schemas/KitChange'}
        - {required: [name]}
    KitList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Kit'}}, next: {type: [string, 'null']}}}
    Colour: {type: string, pattern: '^#[0-9A-Fa-f]{6}$', description: 'A colour written as #RRGGBB.'}
    Places:
      type: object
      description: Where each graphic sits in each picture shape. The opening and end cards fill the frame.
      required: ['9:16', '1:1', '4:5', '16:9']
      properties:
        '9:16': {$ref: '#/components/schemas/ShapePlaces'}
        '1:1': {$ref: '#/components/schemas/ShapePlaces'}
        '4:5': {$ref: '#/components/schemas/ShapePlaces'}
        '16:9': {$ref: '#/components/schemas/ShapePlaces'}
    ShapePlaces:
      type: object
      required: [captions, name_label, logo]
      properties:
        captions: {$ref: '#/components/schemas/Place'}
        name_label: {$ref: '#/components/schemas/Place'}
        logo: {$ref: '#/components/schemas/Place'}
    Place:
      type: object
      description: The graphic's top left corner and its width, each as a share of the frame from its top left.
      required: [x, y, width]
      properties:
        x: {type: number, minimum: 0, maximum: 1}
        y: {type: number, minimum: 0, maximum: 1}
        width: {type: number, exclusiveMinimum: 0, maximum: 1}
    KitFile:
      type: object
      x-object: A font, logo or brand guide file a kit may use. Files are kept for every version of the kit.
      x-prefix: kfl
      x-states:
        uploading: Waiting for the file to be sent to its link.
        ready: Checked, held, and ready for the kit to use.
      x-moves:
        - {from: uploading, to: ready, by: finishKitFile}
      required: [id, kit, kind, name, bytes, state, type, upload, made]
      properties:
        id: {type: string}
        kit: {type: string}
        kind: {type: string, enum: [font, logo, guide], description: 'A guide is a brand guide as a PDF, for readGuide.'}
        name: {type: string}
        bytes: {type: integer}
        state: {type: string, enum: [uploading, ready]}
        type: {type: [string, 'null'], enum: [ttf, otf, woff, woff2, png, jpeg, webp, svg, pdf, null], description: What the file was found to be. Null until it is checked.}
        upload:
          type: [object, 'null']
          description: Present while the file is still to be sent. Send it whole to the link with one PUT.
          required: [url, until]
          properties:
            url: {type: string, format: uri}
            until: {$ref: '#/components/schemas/Stamp'}
        link: {type: [string, 'null'], format: uri, description: 'A link to read the ready file, good for at least one day, so a screen can draw a font or logo sent in an earlier visit. The same link is given all hour, so a browser keeps what it fetched. Null while the file is still to be sent. Always given.'}
        made: {$ref: '#/components/schemas/Stamp'}
    KitFileNew:
      type: object
      required: [kind, name, bytes]
      properties:
        kind: {type: string, enum: [font, logo, guide]}
        name: {type: string, minLength: 1}
        bytes: {type: integer, minimum: 1, maximum: 52428800, description: 'The size of the file. At most 50 MiB.'}

    GuideSource:
      type: object
      description: Where the guide is. Exactly one of the two.
      properties:
        link: {type: string, minLength: 1, maxLength: 2000, description: 'A web address of the guide or of the brand''s own site, or a link to a PDF.'}
        file: {type: string, description: 'The id of a ready guide file of this kit.'}
    GuideReading:
      type: object
      description: >-
        What a brand guide says a kit should be. `found` lists each value with where it came from,
        `change` holds them all as one change to the kit, and nothing is changed until it is sent.
      required: [kit, source, found, palette, fonts_missing, change, model, cost]
      properties:
        kit: {type: string}
        source:
          type: object
          required: [link, file, read]
          properties:
            link: {type: [string, 'null'], description: The web address given. Null for a guide file.}
            file: {type: [string, 'null'], description: The guide file read. Null for a web address.}
            read: {type: array, items: {type: string}, description: 'What was read: each web address fetched, or for a PDF its pages as p1, p2 and on.'}
        found:
          type: array
          items: {$ref: '#/components/schemas/GuideFinding'}
          description: One for each part of the kit the guide fills, in the order of the kit's screen.
        palette:
          type: array
          description: Every brand colour the guide lists, in its order, for a person to pick another from.
          items:
            type: object
            required: [colour, name, from]
            properties:
              colour: {$ref: '#/components/schemas/Colour'}
              name: {type: [string, 'null'], description: The guide's own name for it, such as Aubergine.}
              from: {$ref: '#/components/schemas/GuideFrom'}
        fonts_missing:
          type: array
          description: Typefaces the guide names that the kit has no file for and that are not free to fetch. Upload one for each use to draw in it.
          items:
            type: object
            required: [use, family, weight, from]
            properties:
              use: {type: string, enum: [titles, captions]}
              family: {type: string}
              weight: {type: integer, minimum: 100, maximum: 900}
              from: {$ref: '#/components/schemas/GuideFrom'}
        change: {$ref: '#/components/schemas/KitChange'}
        model: {type: string, description: The language model that read the guide.}
        cost: {type: number, minimum: 0, description: What reading the guide cost in US dollars.}
    GuideFinding:
      type: object
      required: [field, value, says, stated, from]
      properties:
        field: {type: string, enum: [name, colours.main, colours.text, colours.accent, fonts.titles, fonts.captions, logo, captions], description: The part of the kit it fills.}
        value: {description: 'The value as the kit takes it: a name, a colour, the id of a ready font or logo file, null for the built-in font, or the captions object.'}
        says: {type: string, description: 'The value in plain words, such as Aubergine #4A154B or Inter Bold, fetched from Google Fonts.'}
        stated: {type: boolean, description: True when the guide states the value, false when it was chosen to fit the brand, as captions always are.}
        from: {$ref: '#/components/schemas/GuideFrom'}
    GuideFrom:
      type: object
      description: Where in the guide a value was read.
      required: [page, link, quote]
      properties:
        page: {type: [integer, 'null'], minimum: 1, description: The page of a PDF.}
        link: {type: [string, 'null'], description: The web address of the page or file.}
        quote: {type: [string, 'null'], description: 'The guide''s own words the value was read from, as they appear there. Null when none could be checked.'}

    Setting:
      type: object
      description: One setting the engine reads, as the engine lists it.
      required: [id, group, name, kind, unit, range, start]
      properties:
        id: {type: string}
        group: {type: string, enum: [selection, order, cut, frame, sound, text, out], description: The part of the id before the dot.}
        name: {type: string}
        kind: {type: string, enum: [number, whole, switch, choice, ranges, span, shape, size], description: 'The kind of value: a number, a whole number, true or false, one of a list, a list of [start, end] stretches, a [least, most] pair, a width:height shape or a [width, height] size.'}
        unit: {type: string}
        range:
          type: array
          description: 'The lowest and highest value of a number, whole number, span, shape or size side; every choice of a choice; false and true for a switch. A null end has no bound.'
          items: {type: [number, string, boolean, 'null']}
        start: {description: 'The value a spec gets when it leaves the setting out. Null means none, and none says what that means.'}
        none: {type: string, description: 'What null means, for a setting that may be null.'}
    SettingList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Setting'}}, next: {type: [string, 'null']}}}
    Recipe:
      type: object
      x-object: >-
        A named set of setting values, one layer of a video's settings. The layers stack in this
        order: a platform's recipe, a format's, a brand's, the kit, a project's, and last the
        video's own values. The inner layer wins unless an outer layer locks the value. The
        platforms' recipes are the platforms' own limits, the same in every workspace, every
        value locked, and nobody overrides them.
      x-prefix: rcp
      required: [id, name, level, settings, locked, limits, made]
      properties:
        id: {type: string}
        name: {type: string, minLength: 1}
        level: {type: string, enum: [platform, format, brand, project], description: 'Where it stacks: a platform''s, then a format''s, then a brand''s, then the kit, then a project''s, then the video''s own values.'}
        settings: {$ref: '#/components/schemas/Settings'}
        locked: {type: array, items: {type: string}, description: 'Setting ids no layer inside may set to another value. Each is one of its settings.'}
        limits:
          type: object
          description: >-
            Least and most values that a platform allows a number setting in the finished spec, such
            as text.place kept clear of the edges its buttons and captions cover. A null end has no
            bound. Only a platform's recipe has any.
          additionalProperties:
            type: array
            minItems: 2
            maxItems: 2
            items: {type: [number, 'null']}
        made: {oneOf: [{$ref: '#/components/schemas/Stamp'}, {type: 'null'}], description: Null for a platform's recipe.}
    RecipeChange:
      type: object
      description: Merged into the recipe as a JSON merge patch. A setting sent as null is taken out.
      properties:
        name: {type: string, minLength: 1}
        level: {type: string, enum: [format, brand, project]}
        settings: {$ref: '#/components/schemas/Settings'}
        locked: {type: array, items: {type: string}}
    RecipeNew:
      allOf:
        - {$ref: '#/components/schemas/RecipeChange'}
        - {required: [name, level]}
    RecipeRaise:
      type: object
      required: [from, settings]
      properties:
        from: {type: string, description: 'The revision or recipe whose own values are saved up.'}
        settings: {type: array, minItems: 1, items: {type: string}, description: The setting ids to save.}
    RecipeList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Recipe'}}, next: {type: [string, 'null']}}}

    Brief:
      type: object
      x-object: An ask for videos in plain words.
      x-prefix: brf
      x-states:
        waiting: A recording it names is still arriving or being measured. Reading starts the moment every one is ready.
        reading: The ask is being turned into specs and the cuts are being placed.
        drafted: Every video asked for has a first revision.
        failed: Nothing could be drafted. `problem` says why.
      x-moves:
        - {from: waiting, to: reading, by: system}
        - {from: waiting, to: failed, by: system}
        - {from: reading, to: drafted, by: system}
        - {from: reading, to: failed, by: system}
      required: [id, words, state, videos, made]
      properties:
        id: {type: string}
        kind: {$ref: '#/components/schemas/Kind'}
        words: {type: string}
        state: {type: string, enum: [waiting, reading, drafted, failed]}
        problem: {type: [string, 'null']}
        footage: {type: array, items: {type: string}}
        kit: {type: [string, 'null']}
        recipes: {type: array, items: {type: string}}
        count: {type: integer}
        videos: {type: array, items: {type: string}}
        made: {$ref: '#/components/schemas/Stamp'}
    BriefList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Brief'}}, next: {type: [string, 'null']}}}
    BriefNew:
      type: object
      required: [words]
      properties:
        kind: {$ref: '#/components/schemas/Kind'}
        words: {type: string}
        footage: {type: array, items: {type: string}, description: 'The recordings to draw from, samples among them. Every ready recording of the workspace, and no sample, when left out. An episode names exactly one. A recording still arriving or being measured holds the brief until it is ready.'}
        kit: {type: string}
        recipes: {type: array, items: {type: string}, description: 'The recipes every video stacks, at most one of each level. A clips brief only.'}
        count: {type: integer, minimum: 1, maximum: 100, default: 1, description: How many videos. An episode is always one.}
    Kind:
      type: string
      enum: [clips, episode]
      default: clips
      description: >-
        The kind of edit. clips cuts short videos from moments of the recordings, chosen by a
        language model from the brief's words. episode cuts one whole recording into one long 16:9
        video that keeps the told order: the talk before the start and after the goodbye goes, long
        pauses, fillers and false starts go, every speaker is brought to the same loudness, steady
        noise is lowered, and chapters are proposed. A video keeps the kind it was made with, and an
        episode has the same revisions, renders, checks, comments and approval as a clip. Every
        brief and video is answered with its kind.
    Chapter:
      type: object
      description: >-
        One chapter of an episode. A chapter starts on the first word of a sentence and runs until
        the next one starts, the last until the video ends, and the first starts at 0. Its start is
        on the video's clock, so the starts written as timestamps in a description, one line each
        with its title, are the video's chapters.
      required: [start, title, first_word, from]
      properties:
        start: {type: number, minimum: 0, description: Where it starts on the video's clock.}
        title: {type: string, description: 'Two to six words saying what it is about, written by a language model from the chapter''s first words.'}
        first_word: {type: string, description: The word it opens on.}
        from: {type: number, minimum: 0, description: 'Where that word is said, on the recording''s own clock.'}

    Spec:
      type: object
      description: >-
        Everything that decides an edit. The same spec always gives the same cuts.


        An episode's spec holds its one recording, its settings and its pins. Its one source names
        the recording with no from or to, since the engine reads the whole recording and finds
        where the talk starts and ends from the words. Its settings are the ones GET /settings
        lists: out.shape is 16:9, the only shape an episode takes for now, and the ones that shape
        an episode are selection.trim-ends, which drops the talk before the start and after the
        goodbye; frame.layout, which fills the picture with whoever speaks or splits it between
        the two people most on screen; sound.speaker-match, which brings every speaker within so
        many LU of the others; sound.noise-removal, which lowers steady noise by about so many dB;
        and text.chapters with text.chapter-min, which propose chapters no shorter than that. An
        episode made from a brief starts with out.shape 16:9, sound.speaker-match 1,
        sound.noise-removal 12 and text.chapters true. Its pins work as a clip's do. It takes no
        kit and no recipes yet. Its chapters are not in the spec: the solver proposes them with the
        cuts, and the revision holds them.
      required: [sources, settings, pins]
      properties:
        sources:
          type: array
          items:
            type: object
            required: [footage]
            properties:
              footage: {type: string}
              from: {$ref: '#/components/schemas/Seconds'}
              to: {$ref: '#/components/schemas/Seconds'}
        kit: {type: [string, 'null']}
        kit_version: {type: [integer, 'null']}
        recipes:
          type: array
          items: {type: string}
          description: >-
            The recipes it stacks, at most one of each level, in any order: each stacks at its
            level. Read as they are when the revision is made. A recipe that is not there is
            refused with bad_request, and two of one level with bad_request.
        settings:
          allOf: [{$ref: '#/components/schemas/Settings'}]
          description: >-
            The video's own values, the innermost layer. The revision's resolved holds the values
            the video is made with once the recipes and the kit are stacked under them, and the
            locks and a platform's limits are checked on those finished values: a value that
            differs from a locked one is refused with locked naming the layer that locked it, and
            so is a value outside a platform's limits or a target length over the length limit.
        speakers:
          type: array
          description: >-
            Who the voices in the recordings are. A render in a kit's look shows each one named in
            the kit's name label from the first word they say in the video, for four seconds or
            until the next one named starts speaking, and once only. A video with no kit shows no
            names. Naming speakers leaves the cuts as they are.
          items:
            type: object
            required: [footage, speaker, name]
            properties:
              footage: {type: string, description: One of the spec's recordings.}
              speaker: {type: string, pattern: '^speaker-[1-9][0-9]*$', description: 'The voice as the recording''s index names it, such as speaker-1.'}
              name: {type: string, minLength: 1, maxLength: 60}
              title: {type: [string, 'null'], maxLength: 80, description: 'Shown under the name when the kit''s name label shows titles, such as Head of Growth.'}
        pins:
          type: array
          description: Cuts a person fixed by hand. The solver works around them.
          items:
            type: object
            required: [footage, from, to]
            properties:
              footage: {type: string}
              from: {$ref: '#/components/schemas/Seconds'}
              to: {$ref: '#/components/schemas/Seconds'}
              keep: {type: boolean, description: 'True to force the stretch in, false to force it out.'}
    Video:
      type: object
      x-object: One video on the board, from first idea to published.
      x-prefix: vid
      x-states:
        idea: A card with no revision yet.
        drafting: Has a revision and is being worked on.
        in_review: Waiting for someone to approve the current revision.
        approved: The current revision is approved and may be pushed.
        scheduled: A push is set for a later time.
        published: Live on at least one channel.
        archived: Put away.
        deleted: Deleted with a recording it was made from. Nothing of it is kept.
      x-moves:
        - {from: idea, to: drafting, by: revise}
        - {from: drafting, to: in_review, by: submit}
        - {from: in_review, to: approved, by: approve}
        - {from: in_review, to: drafting, by: revise}
        - {from: approved, to: drafting, by: revise}
        - {from: approved, to: scheduled, by: system}
        - {from: approved, to: published, by: system}
        - {from: scheduled, to: published, by: system}
        - {from: scheduled, to: approved, by: revert}
        - {from: published, to: approved, by: revert}
        - {from: published, to: drafting, by: revise}
        - {from: idea, to: archived, by: archiveVideo}
        - {from: drafting, to: archived, by: archiveVideo}
        - {from: in_review, to: archived, by: archiveVideo}
        - {from: approved, to: archived, by: archiveVideo}
        - {from: published, to: archived, by: archiveVideo}
        - {from: idea, to: deleted, by: deleteFootage}
        - {from: drafting, to: deleted, by: deleteFootage}
        - {from: in_review, to: deleted, by: deleteFootage}
        - {from: approved, to: deleted, by: deleteFootage}
        - {from: published, to: deleted, by: deleteFootage}
        - {from: archived, to: deleted, by: deleteFootage}
      x-changed: [title, owner]
      required: [id, title, state, revision, approved_revision, results, made]
      properties:
        id: {type: string}
        kind: {$ref: '#/components/schemas/Kind'}
        title: {type: string}
        state: {type: string, enum: [idea, drafting, in_review, approved, scheduled, published, archived, deleted]}
        brief: {type: [string, 'null']}
        owner: {type: [string, 'null'], description: The member it is handed to.}
        revision: {type: [string, 'null'], description: The current revision.}
        approved_revision: {type: [string, 'null'], description: 'The revision approved. Null whenever the current revision is not approved. Every approval, later ones undone included, is listed by GET /videos/{id}/approvals.'}
        approved_by: {type: [string, 'null'], description: The member who approved it. Null whenever the current revision is not approved.}
        results:
          type: [object, 'null']
          description: >-
            The newest views and minutes watched of the video's live pushes, added up, so a board shows them without
            reading each push, and `as_of` is when the newest of them was read. Null until a live push has numbers, and
            each of the two is null when no live push's channel gives it.
            Each push's own results, its retention curve among them, are read with GET /videos/{id}/pushes.
          required: [as_of, views, minutes_watched]
          properties:
            as_of: {$ref: '#/components/schemas/Stamp'}
            views: {type: [integer, 'null']}
            minutes_watched: {type: [number, 'null']}
        made: {$ref: '#/components/schemas/Stamp'}
    VideoNew:
      type: object
      required: [title]
      properties:
        kind: {$ref: '#/components/schemas/Kind'}
        title: {type: string}
        spec: {$ref: '#/components/schemas/Spec'}
    VideoChange:
      type: object
      properties:
        title: {type: string}
        owner: {type: string}
    VideoList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Video'}}, next: {type: [string, 'null']}}}

    Revision:
      type: object
      x-object: One version of a video. Never changed once made, so any two can be compared.
      x-prefix: rev
      required: [id, video, number, before, made_by, spec, cuts, resolved, render, made]
      properties:
        id: {type: string}
        video: {type: string}
        number: {type: integer, description: 'Counts the video''s revisions from 1. A proposal shows the number it takes if it is taken, one more than the revision it was made from, and is not counted until then, so proposals of the same revision share a number.'}
        before: {type: [string, 'null'], description: 'The revision this one was made from: the base of the change.'}
        made_by: {type: string, enum: [brief, settings, transcript, pin, ask, comment, api]}
        proposed: {type: boolean, description: 'True while it is only a comment''s proposal and not yet part of the video. A proposal is read by its id and is not listed among the video''s revisions until it is taken.'}
        spec: {$ref: '#/components/schemas/Spec'}
        cuts:
          type: array
          description: Where the solver placed every cut, in the order the video plays. Empty until the solver has placed them, and never changed after.
          items:
            type: object
            required: [footage, from, to]
            properties:
              footage: {type: string}
              from: {$ref: '#/components/schemas/Seconds'}
              to: {$ref: '#/components/schemas/Seconds'}
        chapters:
          type: array
          description: >-
            An episode's chapters, in the order the video plays, proposed by the solver with the
            cuts. Empty for clips, for an episode whose text.chapters is false, and until the
            solver has placed the cuts, and never changed after. Read them with the cuts: each
            starts where its first word plays. Always given.
          items: {$ref: '#/components/schemas/Chapter'}
        ask: {type: [string, 'null'], description: 'The words asked, when the revision was made by an ask in plain words. Null for every other revision.'}
        resolved: {$ref: '#/components/schemas/Resolved'}
        render: {type: [string, 'null'], description: The newest render of this revision in the shape its spec asks for.}
        made: {$ref: '#/components/schemas/Stamp'}
    Resolved:
      type: object
      description: >-
        Every setting a layer sets, with the value the video is made with and the layer behind
        it. A setting no layer sets is not listed and takes its start from GET /settings. These
        are frozen with the revision, so a recipe changed later does not change them.
      additionalProperties:
        type: object
        required: [value, layer, by, locked]
        properties:
          value: {description: The finished value.}
          layer: {type: string, enum: [platform, format, brand, kit, project, video], description: The layer that set it, or for a locked value the layer that locked it.}
          by: {type: [string, 'null'], description: 'The recipe or kit of that layer. Null for the video''s own.'}
          locked: {type: boolean, description: 'True when that layer locks it, so no layer inside may change it.'}
    RevisionNew:
      type: object
      description: One kind of change at a time, made to one base revision.
      properties:
        base: {type: string, description: 'The revision of this video the change is made to. The current revision when left out. A proposal is refused as a base until it is taken.'}
        settings:
          allOf: [{$ref: '#/components/schemas/Settings'}]
          description: Merged into the video's own values. A setting sent as null is put back to what the layers under the video give it.
        strike: {type: array, description: 'Stretches of the transcript to take out. A word is struck when its middle lies inside a stretch.', items: {$ref: '#/components/schemas/Stretch'}}
        restore:
          type: array
          description: >-
            Stretches of the transcript to bring back. Words struck there are no longer struck,
            words the solver left out are pinned in, and words outside the video's sources are
            added to it in the order they were said.
          items: {$ref: '#/components/schemas/Stretch'}
        move:
          type: object
          description: 'A stretch of the transcript to play somewhere else, such as a sentence moved to open the video. The setting order.reorder becomes free when it is not.'
          required: [footage, from, to]
          properties:
            footage: {type: string}
            from: {$ref: '#/components/schemas/Seconds'}
            to: {$ref: '#/components/schemas/Seconds'}
            before:
              type: object
              description: The word it now plays before, by the recording and the moment that word starts. At the end of the video when left out.
              required: [footage, at]
              properties:
                footage: {type: string}
                at: {$ref: '#/components/schemas/Seconds'}
        pins: {type: array, description: 'Stretches forced in, or with keep false forced out. A stretch forced in that lies outside the video is added to it in the order it was said.', items: {type: object, required: [footage, from, to], properties: {footage: {type: string}, from: {$ref: '#/components/schemas/Seconds'}, to: {$ref: '#/components/schemas/Seconds'}, keep: {type: boolean, default: true}}}}
        ask: {type: string, minLength: 1, maxLength: 2000, description: 'A change in plain words, such as faster or cut the intro.'}
        spec: {$ref: '#/components/schemas/Spec'}
    Stretch:
      type: object
      description: A stretch of one recording.
      required: [footage, from, to]
      properties:
        footage: {type: string}
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
    RevisionList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Revision'}}, next: {type: [string, 'null']}}}
    Diff:
      type: object
      required: [revision, against, settings, words, pauses, seconds, says]
      properties:
        revision: {type: string}
        against: {type: string, description: The earlier revision it is compared with.}
        settings:
          type: array
          description: Each setting whose finished value changed, counting a setting no layer sets as its starting value.
          items:
            type: object
            required: [id, was, now, says]
            properties: {id: {type: string}, was: {}, now: {}, says: {type: string}}
        words:
          type: array
          description: Each run of words taken out, added or moved.
          items:
            type: object
            required: [change, words, at, footage, from, to, says]
            properties:
              change: {type: string, enum: [removed, added, moved]}
              words: {type: string}
              at: {type: number, minimum: 0, description: 'Where the words are heard on the video''s clock: in the earlier revision for words removed, and in this one for words added or moved.'}
              footage: {type: string}
              from: {$ref: '#/components/schemas/Seconds'}
              to: {$ref: '#/components/schemas/Seconds'}
              says: {type: string}
        pauses:
          type: array
          description: Each pause between two words heard one after the other in both revisions that is now shorter or longer.
          items:
            type: object
            required: [at, after, was_seconds, now_seconds, says]
            properties:
              at: {type: number, minimum: 0, description: Where the pause starts on this revision's clock.}
              after: {type: string, description: The word before the pause.}
              was_seconds: {type: number}
              now_seconds: {type: number}
              says: {type: string}
        seconds: {type: object, required: [was, now], properties: {was: {type: number}, now: {type: number}}}
        says: {type: array, items: {type: string}, description: 'Every change in plain words: settings first, then the rest in the order the video plays, then the length.'}
    Timeline:
      type: object
      required: [revision, format]
      properties:
        revision: {type: string}
        format: {type: string, enum: [words, otio, fcpxml]}
        seconds: {type: number, description: 'How long the video plays. Given as words.'}
        words:
          type: array
          description: Every word of the video's sources, kept and dropped, in the order the video plays. Given as words.
          items:
            type: object
            required: [says, kept, struck, sentence, from, to, said]
            properties:
              says: {type: string}
              kept: {type: boolean, description: True when the video plays it.}
              struck: {type: boolean, description: 'True when a person took it out, by striking it or by pinning it out: both make the same pin with keep false, so a word pinned out is struck. A word dropped and not struck was left out by the solver, as a filler, a retelling or a choice of length.'}
              pinned: {type: boolean, description: 'True when a person forced it in with a pin, by pinning it or by restoring a word the solver left out. The solver keeps a pinned word whatever the settings. Always given.'}
              sentence: {type: [integer, 'null'], description: 'The number of its sentence in its recording, counted from 1, so a sentence can be moved or struck whole.'}
              from: {type: number, minimum: 0, description: Where it starts on the video's clock. A dropped word starts and ends at the join it was cut from.}
              to: {type: number, minimum: 0}
              said: {$ref: '#/components/schemas/Stretch'}
        link: {type: string, format: uri, description: 'The timeline file. Given as otio or fcpxml.'}
        until: {$ref: '#/components/schemas/Stamp'}

    Render:
      type: object
      x-object: A finished file built from one revision, with the checks it had to clear.
      x-prefix: rnd
      x-states:
        queued: Waiting for a machine.
        rendering: Being built.
        checking: Built, and being measured against its spec.
        passed: Cleared every hard rule. Can be watched, reviewed and pushed.
        failed: Could not be built, and `problem` says why, or broke a hard rule, and its checks name it. Cannot be pushed.
      x-moves:
        - {from: queued, to: rendering, by: system}
        - {from: rendering, to: checking, by: system}
        - {from: rendering, to: failed, by: system}
        - {from: checking, to: passed, by: system}
        - {from: checking, to: failed, by: system}
      required: [id, revision, shape, state, checks, made]
      properties:
        id: {type: string}
        revision: {type: string}
        shape: {$ref: '#/components/schemas/Shape'}
        state: {type: string, enum: [queued, rendering, checking, passed, failed]}
        problem: {type: [string, 'null'], description: 'Why it could not be built. Null when it was built, and a render that breaks a hard rule names the rule in its checks instead.'}
        seconds: {type: [number, 'null']}
        link: {type: [string, 'null'], format: uri, description: 'A link to watch the finished file, good for one day. Null until it is built.'}
        checks:
          type: array
          description: >-
            Each hard rule in the spec, measured again on the finished file. An episode is also
            checked for sound.speaker-match, each speaker's loudness against the others, and for
            sound.noise-removal, how far the room under the speech was lowered, when its spec sets
            them.
          items:
            type: object
            required: [setting, wanted, measured, passed]
            properties:
              setting: {type: string}
              wanted: {type: string}
              measured: {type: string}
              passed: {type: boolean}
        made: {$ref: '#/components/schemas/Stamp'}
    RenderList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Render'}}, next: {type: [string, 'null']}}}
    RenderNew:
      type: object
      required: [shape]
      properties:
        shape: {$ref: '#/components/schemas/Shape'}

    Comment:
      type: object
      x-object: A note on a stretch of a video, and the change proposed to answer it.
      x-prefix: cmt
      x-states:
        open: Written. A change is being worked out, unless it was left as a note.
        proposed: A proposed revision is ready to watch beside the current one.
        settled: The proposal was taken, or the comment was closed without it.
      x-moves:
        - {from: open, to: proposed, by: system}
        - {from: open, to: settled, by: settleComment}
        - {from: proposed, to: settled, by: takeProposal}
        - {from: proposed, to: settled, by: settleComment}
      required: [id, video, revision, from, to, words, by, state, made]
      properties:
        id: {type: string}
        video: {type: string}
        revision: {type: string, description: The revision that was being watched.}
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
        words: {type: string}
        by: {type: string, description: The member who wrote it.}
        answers: {type: [string, 'null'], description: The comment this one answers.}
        names: {type: array, items: {type: string}, description: The members named in it.}
        propose: {type: boolean, description: 'False when it was left as a note with no proposed change, by its writer or because no change was found to answer it.'}
        state: {type: string, enum: [open, proposed, settled]}
        proposal: {type: [string, 'null'], description: 'The proposed revision. Read it with GET /revisions/{id}; it is listed among the video''s revisions only once taken.'}
        why: {type: [string, 'null'], description: 'In one sentence, what the proposed change does, or why the comment was left as a note. Null while the change is being worked out, and when its writer left it as a note.'}
        taken: {type: [boolean, 'null']}
        made: {$ref: '#/components/schemas/Stamp'}
    CommentNew:
      type: object
      required: [from, to, words]
      properties:
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
        words: {type: string}
        revision: {type: string, description: The revision being watched. The current one when left out.}
        answers: {type: string, description: 'The comment this one answers, on the same video. Its writer is sent an email.'}
        names: {type: array, items: {type: string}, description: 'Members named in the comment. Each is sent an email.'}
        propose: {type: boolean, default: true, description: False to leave a note with no proposed change.}
    Approval:
      type: object
      description: One revision approved. Kept when a later revision sends the video back to drafting.
      required: [video, revision, number, by, made]
      properties:
        video: {type: string}
        revision: {type: string, description: The revision approved.}
        number: {type: integer, description: The number of the revision approved.}
        by: {type: string, description: The member who approved it.}
        made: {$ref: '#/components/schemas/Stamp'}
    ApprovalList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Approval'}}, next: {type: [string, 'null']}}}
    Submission:
      type: object
      properties:
        reviewers: {type: array, items: {type: string}, description: 'Members asked to review. Each is sent an email.'}
    CommentList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Comment'}}, next: {type: [string, 'null']}}}

    ReviewLink:
      type: object
      x-object: A link that lets whoever opens it watch, comment on and approve one video as a named guest, with no account.
      x-prefix: rvl
      x-states:
        active: Opens the video for anyone who has the link.
        turned_off: Opens nothing. Every guest of the link is refused from then on.
      x-moves:
        - {from: active, to: turned_off, by: turnOffReviewLink}
      required: [id, video, state, made_by, guests, made, turned_off]
      properties:
        id: {type: string}
        video: {type: string}
        state: {type: string, enum: [active, turned_off]}
        link: {type: string, format: uri, description: 'The address to send. Shown once, when the link is made. Only a hash of its secret is kept.'}
        made_by: {type: string, description: The member who made it.}
        guests: {type: array, items: {$ref: '#/components/schemas/Guest'}, description: 'Everyone who opened it, oldest first.'}
        made: {$ref: '#/components/schemas/Stamp'}
        turned_off: {oneOf: [{$ref: '#/components/schemas/Stamp'}, {type: 'null'}]}
    ReviewLinkList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/ReviewLink'}}, next: {type: [string, 'null']}}}
    Guest:
      type: object
      x-object: >-
        Someone outside the workspace who opened a review link and gave a name. A comment or an
        approval a guest makes carries the guest's id where a member's id would be, so its gst_
        prefix marks it as a guest's.
      x-prefix: gst
      required: [id, name, link, video, made]
      properties:
        id: {type: string}
        name: {type: string}
        link: {type: string, description: The review link it opened.}
        video: {type: string}
        token: {type: string, description: 'Send it as the bearer token of the guest calls. Shown once, when the link is opened.'}
        made: {$ref: '#/components/schemas/Stamp'}
    GuestNew:
      type: object
      required: [secret, name]
      properties:
        secret: {type: string, description: The last part of the review link's address.}
        name: {type: string, minLength: 1, maxLength: 100, description: 'The name the guest gives. Everything the guest does is signed with it.'}
    GuestReview:
      type: object
      required: [guest, title, state, revision, render, approved]
      properties:
        guest: {$ref: '#/components/schemas/Guest'}
        title: {type: string}
        state: {type: string, enum: [idea, drafting, in_review, approved, scheduled, published, archived]}
        revision: {type: [string, 'null'], description: The current revision.}
        render:
          oneOf: [{$ref: '#/components/schemas/Render'}, {type: 'null'}]
          description: The newest render of the current revision in the shape its spec asks for.
        approved: {type: boolean, description: True when the current revision is approved.}
    GuestComment:
      type: object
      required: [id, revision, from, to, words, by, mine, state, why, taken, made]
      properties:
        id: {type: string}
        revision: {type: string, description: The revision that was being watched.}
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
        words: {type: string}
        by: {type: string, description: The name the guest gave.}
        mine: {type: boolean, description: True when the guest asking wrote it.}
        state: {type: string, enum: [open, proposed, settled], description: 'As a member''s comment: proposed once a change to answer it is ready to watch with getGuestChange.'}
        why: {type: [string, 'null'], description: 'In one sentence, what the proposed change does, or why the comment was left as a note. Null while the change is being worked out.'}
        taken: {type: [boolean, 'null'], description: 'True once its change was taken, false when it was settled without it.'}
        made: {$ref: '#/components/schemas/Stamp'}
    GuestChange:
      type: object
      required: [comment, revision, render, says]
      properties:
        comment: {type: string}
        revision: {type: string, description: The proposed revision.}
        render:
          oneOf: [{$ref: '#/components/schemas/Render'}, {type: 'null'}]
          description: The newest render of the proposed revision in the shape its spec asks for.
        says: {type: array, items: {type: string}, description: 'Every change against the current revision in plain words, as getDiff gives them. Empty until the solver has placed the cuts of both.'}
    GuestCommentNew:
      type: object
      required: [from, to, words]
      properties:
        from: {$ref: '#/components/schemas/Seconds'}
        to: {$ref: '#/components/schemas/Seconds'}
        words: {type: string}
    GuestCommentList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/GuestComment'}}, next: {type: [string, 'null']}}}

    Channel:
      type: object
      x-object: A publishing account the workspace may push to.
      x-prefix: chn
      x-states:
        connecting: Waiting for the account's owner to sign in and allow posting.
        choosing: Signed in, and the person runs more than one account there, listed in `choices`. One is chosen with chooseChannelAccount.
        connected: Ready to push to.
        reconnect: The platform withdrew access. Someone must sign in again.
        removed: Disconnected.
      x-moves:
        - {from: connecting, to: connected, by: finishChannel}
        - {from: connecting, to: choosing, by: finishChannel}
        - {from: choosing, to: connected, by: chooseChannelAccount}
        - {from: choosing, to: removed, by: removeChannel}
        - {from: connected, to: reconnect, by: system}
        - {from: reconnect, to: connected, by: finishChannel}
        - {from: connecting, to: removed, by: removeChannel}
        - {from: connected, to: removed, by: removeChannel}
        - {from: reconnect, to: removed, by: removeChannel}
      required: [id, platform, state]
      properties:
        id: {type: string}
        platform: {type: string, enum: [youtube, tiktok, instagram, linkedin]}
        name: {type: [string, 'null'], description: The account's name on the platform.}
        state: {type: string, enum: [connecting, choosing, connected, reconnect, removed]}
        sign_in: {type: [string, 'null'], format: uri, description: Where to sign in. Present while connecting or when a reconnect is needed.}
        choices:
          type: array
          description: The accounts to choose from while choosing, and empty otherwise.
          items:
            type: object
            required: [account, name]
            properties:
              account: {type: string}
              name: {type: string}
    ChannelNew:
      type: object
      required: [platform]
      properties:
        platform: {type: string, enum: [youtube, tiktok, instagram, linkedin]}
    ChannelAccount:
      type: object
      required: [account]
      properties:
        account: {type: string, description: One of the channel's choices.}
    ChannelRules:
      type: object
      required: [channel, platform, name, avatar, privacy, privacy_default, title_most, description_most, caption, shapes, seconds_least, seconds_most, bytes_most, holds_time, can_revert, interactions]
      properties:
        channel: {type: string}
        platform: {type: string, enum: [youtube, tiktok, instagram, linkedin]}
        name: {type: [string, 'null'], description: 'The account as the platform names it: for TikTok, the creator''s nickname.'}
        avatar: {type: [string, 'null'], format: uri, description: 'The account''s picture where the platform gives one. A TikTok link lasts two hours.'}
        privacy: {type: array, items: {$ref: '#/components/schemas/Privacy'}, description: The privacy settings the account offers.}
        privacy_default: {oneOf: [{$ref: '#/components/schemas/Privacy'}, {type: 'null'}], description: 'Null for TikTok, where a person must choose one.'}
        title_most: {type: integer, description: The longest title in characters, or the longest caption where `caption` is true.}
        description_most: {type: [integer, 'null'], description: 'The longest description, in bytes for YouTube and characters elsewhere. Null where `caption` is true.'}
        caption: {type: boolean, description: 'True where the platform takes one caption: the title, a blank line and the description.'}
        shapes: {type: array, items: {$ref: '#/components/schemas/Shape'}}
        seconds_least: {type: number}
        seconds_most: {type: number, description: 'The longest video. For TikTok, the longest this creator may post.'}
        bytes_most: {type: integer}
        holds_time: {type: boolean, description: 'True where the platform takes a time to go public itself. Otherwise Video Bricks holds a scheduled push and sends it at its time.'}
        can_revert: {type: boolean, description: True where a live push can be taken back from Video Bricks.}
        interactions:
          type: [object, 'null']
          description: 'For TikTok: whether the creator lets anyone comment on, duet or stitch their posts. One turned off cannot be allowed on a push. Null elsewhere.'
          required: [comments, duets, stitches]
          properties:
            comments: {type: boolean}
            duets: {type: boolean}
            stitches: {type: boolean}
    Privacy:
      type: string
      enum: [public, unlisted, private, followers, friends]
      description: >-
        Who may watch it once it is out: anyone, only people with the link, only the account,
        the account's followers, or followers it follows back. YouTube offers the first three,
        LinkedIn and Instagram only public, and TikTok what the creator's account offers.
    TikTokChoices:
      type: object
      description: >-
        What a person chose on TikTok's posting screen. TikTok asks that nothing is chosen for
        them: each is ticked or left off by that person, and none is ticked to begin with.
      required: [comments, duets, stitches, your_brand, branded_content, agreed]
      properties:
        comments: {type: boolean, description: Allow comments.}
        duets: {type: boolean, description: Allow duets.}
        stitches: {type: boolean, description: Allow stitches.}
        your_brand: {type: boolean, description: 'The video promotes the creator''s own business. TikTok labels it Promotional content.'}
        branded_content: {type: boolean, description: 'The video promotes another brand or a third party. TikTok labels it Paid partnership, and it is never private.'}
        agreed: {type: boolean, const: true, description: 'The person agreed to TikTok''s Music Usage Confirmation, and to its Branded Content Policy when the video is branded content.'}
    ChannelSignedIn:
      type: object
      required: [state, code]
      properties:
        state: {type: string, description: The state in the address the platform sent the person back to.}
        code: {type: string, description: The code in that address.}
    ChannelList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Channel'}}, next: {type: [string, 'null']}}}

    Push:
      type: object
      x-object: One approved video sent to one channel, and what happened to it there.
      x-prefix: psh
      x-states:
        pushing: Being sent to the channel.
        scheduled: Set to go out at `at`. YouTube holds it on the channel, private, until then; for other channels Video Bricks holds it and sends it then.
        live: On the channel as asked. `link` is where it can be watched.
        failed: The channel refused it or did not answer. `problem` says why in plain words.
        reverted: Taken back, so made private on YouTube, deleted on LinkedIn, or never sent when it was held for a time.
      x-moves:
        - {from: pushing, to: scheduled, by: system}
        - {from: pushing, to: live, by: system}
        - {from: pushing, to: failed, by: system}
        - {from: scheduled, to: live, by: system}
        - {from: scheduled, to: failed, by: system}
        - {from: live, to: failed, by: system}
        - {from: failed, to: pushing, by: push}
        - {from: scheduled, to: reverted, by: revert}
        - {from: live, to: reverted, by: revert}
      required: [id, video, revision, render, channel, state, problem, title, description, privacy, at, link, tiktok, results, made]
      properties:
        id: {type: string}
        video: {type: string}
        revision: {type: string}
        render: {type: string}
        channel: {type: string}
        state: {type: string, enum: [pushing, scheduled, live, failed, reverted]}
        problem: {type: [string, 'null']}
        title: {type: string}
        description: {type: string}
        privacy: {$ref: '#/components/schemas/Privacy'}
        at: {oneOf: [{$ref: '#/components/schemas/Stamp'}, {type: 'null'}], description: When it goes or went out.}
        link: {type: [string, 'null'], format: uri, description: 'Where it can be watched. Null until it is out, and for TikTok until TikTok makes a public post visible.'}
        tiktok: {oneOf: [{$ref: '#/components/schemas/TikTokChoices'}, {type: 'null'}], description: The choices made on TikTok's screen, for a push to TikTok.}
        results:
          type: [object, 'null']
          description: >-
            What the channel reports, read once a day for 90 days after the push goes out and once every 30 days after
            that, as the channel gives it. A number the channel does not give is null: LinkedIn gives views, watch time,
            likes, comments and shares; Instagram gives views, watch time, the average view, likes, comments and shares;
            TikTok gives views, likes, comments and shares. Null until the channel has numbers for it. The numbers are
            deleted when the channel is removed, when its access is withdrawn, or when the video is gone from the
            channel, and the push then fails.
          required: [as_of, views, minutes_watched, watch_seconds_mean, watched_share, likes, comments, shares, retention]
          properties:
            as_of: {$ref: '#/components/schemas/Stamp'}
            views: {type: [integer, 'null']}
            minutes_watched: {type: [number, 'null']}
            watch_seconds_mean: {type: [number, 'null']}
            watched_share: {type: [number, 'null'], description: The share of the video an average view watched, from 0 to 1.}
            likes: {type: [integer, 'null']}
            comments: {type: [integer, 'null']}
            shares: {type: [integer, 'null']}
            retention:
              type: array
              description: 'The retention curve: for each point through the video, from 0.01 to 1 of its length, how many times it was watched there for each view. Empty when the channel gives none.'
              items:
                type: object
                required: [at, watching]
                properties:
                  at: {type: number}
                  watching: {type: number}
        made: {$ref: '#/components/schemas/Stamp'}
    PushNew:
      type: object
      required: [channel, title, description]
      properties:
        channel: {type: string}
        shape: {$ref: '#/components/schemas/Shape'}
        title: {type: string}
        description: {type: string}
        privacy: {allOf: [{$ref: '#/components/schemas/Privacy'}], description: 'Public when left out, except on TikTok, which needs one chosen.'}
        at: {$ref: '#/components/schemas/Stamp'}
        tiktok: {$ref: '#/components/schemas/TikTokChoices'}
    PushDraft:
      type: object
      required: [video, revision, state, title, description, problem]
      properties:
        video: {type: string}
        revision: {type: string, description: The approved revision it was drafted from.}
        state: {type: string, enum: [drafting, drafted, failed]}
        title: {type: [string, 'null']}
        description: {type: [string, 'null']}
        problem: {type: [string, 'null']}
    PushList: {type: object, required: [data, next], properties: {data: {type: array, items: {$ref: '#/components/schemas/Push'}}, next: {type: [string, 'null']}}}
