{
  "openapi": "3.1.0",
  "info": {
    "title": "Qualsted API",
    "version": "1",
    "description": "Read and write your workspace's records from your own systems.\n\n**Authentication.** Send an API key as `Authorization: Bearer ck_…`. An admin makes keys in Settings → Developers. A key acts as one person, with exactly their access; it's read-only or read and write, and it can never sign records. Every change made with a key is in the audit trail under that person.\n\n**Values.** A record's `values` are keyed by column id (see a table's `properties`). Choice columns take option ids; people and relations take lists of ids; dates are `{ \"start\": \"YYYY-MM-DD\" }`.\n\n**Limits.** Up to 1,200 requests a minute for each key's person; above that you get 429 with a `Retry-After` header (seconds).\n\n**Webhooks.** Table managers add webhooks (table settings → Webhooks) to be told when records change; JSON webhooks are signed: `X-Webhook-Signature: sha256=<hex HMAC-SHA256 of \"<X-Webhook-Timestamp>.<body>\">`."
  },
  "servers": [
    {
      "url": "/api",
      "description": "Your workspace's address, e.g. https://acme.example.com/api"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (ck_…)"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "array",
                      "items": {}
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Table": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "8d3f2c1a-5b6e-4f7a-9c0d-1e2f3a4b5c6d"
            ]
          },
          "name": {
            "type": "string",
            "examples": [
              "CAPA log"
            ]
          },
          "idPrefix": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "CAPA"
            ]
          },
          "folderId": {
            "type": "string",
            "format": "uuid"
          },
          "access": {
            "type": "string",
            "enum": [
              "view",
              "edit",
              "manage"
            ],
            "description": "What the key's person can do in it"
          }
        }
      },
      "Property": {
        "type": "object",
        "description": "A column",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "5e9d0b72-1a4c-4e3f-b8a6-0f7c2d9e1b43"
            ]
          },
          "name": {
            "type": "string",
            "examples": [
              "Status"
            ]
          },
          "type": {
            "type": "string",
            "examples": [
              "status",
              "text",
              "number",
              "date",
              "person",
              "relation",
              "file",
              "signature"
            ]
          },
          "config": {
            "type": "object",
            "description": "Type settings, e.g. a status column's options",
            "examples": [
              {
                "options": [
                  {
                    "id": "7c2e5a91-0d4b-4f86-9a3e-6b1d8c0f2e75",
                    "name": "Open",
                    "color": "blue"
                  }
                ]
              }
            ]
          },
          "required": {
            "type": "boolean"
          }
        }
      },
      "TableDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Table"
          },
          {
            "type": "object",
            "properties": {
              "properties": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Property"
                }
              },
              "views": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        ]
      },
      "Row": {
        "type": "object",
        "description": "A record",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "2b7e9f40-31c5-4d8a-a6f2-9c1e0d3b7a58"
            ]
          },
          "databaseId": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "8d3f2c1a-5b6e-4f7a-9c0d-1e2f3a4b5c6d"
            ]
          },
          "autoId": {
            "type": "integer",
            "examples": [
              12
            ]
          },
          "displayId": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "CAPA-0012"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "in_review",
              "published"
            ]
          },
          "version": {
            "type": "integer"
          },
          "locked": {
            "type": "boolean"
          },
          "values": {
            "type": "object",
            "additionalProperties": true,
            "description": "Column id -> value",
            "examples": [
              {
                "c41a8e27-6f3b-4b90-8d15-7e2a9f0c3d61": "Temperature excursion in cold room 2",
                "5e9d0b72-1a4c-4e3f-b8a6-0f7c2d9e1b43": "7c2e5a91-0d4b-4f86-9a3e-6b1d8c0f2e75",
                "f0a6c3d8-9e2b-4c71-a5d4-3b8e1f6a0c92": {
                  "start": "2026-11-02"
                },
                "9a1b3c5d-7e8f-4a0b-8c2d-4e6f8a0b2c4d": [
                  "4d2c6e8a-0b1f-4a3c-9e5d-7f9a1b3c5e7d"
                ]
              }
            ]
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Linked record id -> its label",
            "examples": [
              {}
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "RowPage": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Row"
            }
          },
          "total": {
            "type": "integer"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "User": {
        "type": "object",
        "description": "A person (person columns hold their ids)",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "4d2c6e8a-0b1f-4a3c-9e5d-7f9a1b3c5e7d"
            ]
          },
          "email": {
            "type": "string",
            "examples": [
              "maya.chen@example.com"
            ]
          },
          "name": {
            "type": "string",
            "examples": [
              "Maya Chen"
            ]
          },
          "active": {
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "A short-lived link to their photo",
            "examples": [
              null
            ]
          }
        }
      },
      "Backup": {
        "type": "object",
        "description": "A backup that can be downloaded now",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "a7c3e1f9-2d4b-4a6c-8e0f-1b3d5f7a9c2e"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "full",
              "incremental"
            ],
            "examples": [
              "full"
            ],
            "description": "Backups are always complete (full)"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-13T14:30:00.000Z"
            ]
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-13T14:30:00.000Z"
            ],
            "description": "The moment the backup's data is as of"
          },
          "sizeBytes": {
            "type": [
              "integer",
              "null"
            ],
            "examples": [
              48211968
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-13T14:30:00.000Z"
            ],
            "description": "The last moment it can be downloaded (14 days after it was made)"
          }
        }
      },
      "BackupLink": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Download the zip from this address; it works for a few minutes",
            "examples": [
              "https://files.example.com/backups/a7c3e1f9.zip?signature=…"
            ]
          }
        }
      },
      "HistoryEntry": {
        "type": "object",
        "description": "One entry in a record's audit trail",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "description": "create, update, archive, restore, submit_review, withdraw_review, sign or new_version",
            "examples": [
              "update"
            ]
          },
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "examples": [
              1
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "For review and signing events, e.g. \"Approved: looks good\"",
            "examples": [
              null
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-13T14:30:00.000Z"
            ]
          },
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "examples": [
                  "4d2c6e8a-0b1f-4a3c-9e5d-7f9a1b3c5e7d"
                ]
              },
              "name": {
                "type": "string",
                "examples": [
                  "Maya Chen"
                ]
              }
            }
          },
          "via": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the change came from when the person wasn't at the screen, e.g. \"through API key “ERP sync”\"; null when they made it in the app",
            "examples": [
              "through API key “ERP sync”"
            ]
          },
          "changes": {
            "type": "array",
            "description": "Columns that changed (for create: every value set)",
            "items": {
              "type": "object",
              "properties": {
                "property": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "examples": [
                        "5e9d0b72-1a4c-4e3f-b8a6-0f7c2d9e1b43"
                      ]
                    },
                    "name": {
                      "type": "string",
                      "examples": [
                        "Status"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "examples": [
                        "status"
                      ]
                    },
                    "archived": {
                      "type": "boolean",
                      "examples": [
                        false
                      ]
                    }
                  }
                },
                "before": {
                  "examples": [
                    null
                  ]
                },
                "after": {
                  "examples": [
                    "7c2e5a91-0d4b-4f86-9a3e-6b1d8c0f2e75"
                  ]
                }
              }
            }
          }
        }
      },
      "Signature": {
        "type": "object",
        "description": "An electronic signature (21 CFR Part 11)",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "b6e1d3f5-8a2c-4e7b-9d0f-1a3c5e7b9d2f"
            ]
          },
          "rowId": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "2b7e9f40-31c5-4d8a-a6f2-9c1e0d3b7a58"
            ]
          },
          "propertyId": {
            "type": "string",
            "format": "uuid",
            "description": "The signature column"
          },
          "version": {
            "type": "integer",
            "examples": [
              1
            ]
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "4d2c6e8a-0b1f-4a3c-9e5d-7f9a1b3c5e7d"
            ]
          },
          "name": {
            "type": "string",
            "examples": [
              "Maya Chen"
            ],
            "description": "The signer's name as printed at signing"
          },
          "meaning": {
            "type": "string",
            "examples": [
              "Approved"
            ]
          },
          "comment": {
            "type": "string",
            "examples": [
              ""
            ]
          },
          "signedAt": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-13T14:30:00.000Z"
            ]
          },
          "contentHash": {
            "type": "string",
            "examples": [
              "9f2c4e6a8b0d1f3a5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a1c3e5b7d9f1a"
            ],
            "description": "SHA-256 of the record's content when it was signed"
          },
          "reauthMethod": {
            "type": "string",
            "examples": [
              "password"
            ],
            "description": "How the signer proved who they were"
          },
          "matches": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record still has exactly the content that was signed (null: not checked)",
            "examples": [
              true
            ]
          }
        }
      },
      "Version": {
        "type": "object",
        "description": "A published (approved) version",
        "properties": {
          "version": {
            "type": "integer",
            "examples": [
              1
            ]
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-13T14:30:00.000Z"
            ]
          },
          "contentHash": {
            "type": "string",
            "examples": [
              "9f2c4e6a8b0d1f3a5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a1c3e5b7d9f1a"
            ]
          },
          "signatures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Signature"
            }
          }
        }
      },
      "Comment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "examples": [
              "e3f5a7c9-1b2d-4f6a-8c0e-2d4f6a8c0e1b"
            ]
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The thread's first comment, for a reply",
            "examples": [
              null
            ]
          },
          "body": {
            "type": "string",
            "examples": [
              "Moved the samples to cold room 1; see the attached log."
            ],
            "description": "Empty once removed"
          },
          "mentions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "examples": [
                    "4d2c6e8a-0b1f-4a3c-9e5d-7f9a1b3c5e7d"
                  ]
                },
                "name": {
                  "type": "string",
                  "examples": [
                    "Maya Chen"
                  ]
                }
              }
            },
            "examples": [
              []
            ]
          },
          "author": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "examples": [
                  "4d2c6e8a-0b1f-4a3c-9e5d-7f9a1b3c5e7d"
                ]
              },
              "name": {
                "type": "string",
                "examples": [
                  "Maya Chen"
                ]
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2026-10-13T14:30:00.000Z"
            ]
          },
          "editedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "examples": [
              null
            ]
          },
          "removed": {
            "type": [
              "object",
              "null"
            ],
            "examples": [
              null
            ]
          }
        }
      },
      "CommentList": {
        "type": "object",
        "properties": {
          "threads": {
            "type": "array",
            "description": "Each thread's first comment, with its replies",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Comment"
                },
                {
                  "type": "object",
                  "properties": {
                    "resolved": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "examples": [
                        null
                      ]
                    },
                    "replies": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Comment"
                      },
                      "examples": [
                        []
                      ]
                    }
                  }
                }
              ]
            }
          },
          "canComment": {
            "type": "boolean",
            "examples": [
              true
            ]
          }
        }
      },
      "Values": {
        "type": "object",
        "additionalProperties": true,
        "description": "Column id -> value (null clears)",
        "examples": [
          {
            "c41a8e27-6f3b-4b90-8d15-7e2a9f0c3d61": "Temperature excursion in cold room 2",
            "5e9d0b72-1a4c-4e3f-b8a6-0f7c2d9e1b43": "7c2e5a91-0d4b-4f86-9a3e-6b1d8c0f2e75",
            "f0a6c3d8-9e2b-4c71-a5d4-3b8e1f6a0c92": {
              "start": "2026-11-02"
            }
          }
        ]
      }
    }
  },
  "paths": {
    "/databases": {
      "get": {
        "summary": "List the tables you can see",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Table"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/databases/{id}": {
      "get": {
        "summary": "A table with its columns and views",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TableDetail"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/databases/{id}/rows": {
      "get": {
        "summary": "List records (page by page)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "nextCursor from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewId",
            "in": "query",
            "description": "Apply a saved view's filter and sort",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Search text or record ID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "in": "query",
            "description": "A filter as JSON (as saved views hold)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "A sort as JSON, e.g. [{\"propertyId\":\"…\",\"direction\":\"desc\"}]",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RowPage"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a record (write key)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "values"
                ],
                "properties": {
                  "values": {
                    "$ref": "#/components/schemas/Values"
                  },
                  "templateId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Start from this template: its default values, and its page for the record"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rows/{id}": {
      "get": {
        "summary": "A record",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Change a record's values (write key)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "values"
                ],
                "properties": {
                  "values": {
                    "$ref": "#/components/schemas/Values"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rows/{id}/archive": {
      "post": {
        "summary": "Archive a record (write key; never deleted)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rows/{id}/restore": {
      "post": {
        "summary": "Restore an archived record (write key)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rows/{id}/history": {
      "get": {
        "summary": "A record's audit trail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/HistoryEntry"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rows/{id}/versions": {
      "get": {
        "summary": "A record's published (approved) versions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Version"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rows/{id}/signatures": {
      "get": {
        "summary": "A record's signatures",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Signature"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rows/{id}/comments": {
      "get": {
        "summary": "A record's comments",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommentList"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Comment on a record (write key)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Its id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "body"
                ],
                "properties": {
                  "body": {
                    "type": "string",
                    "examples": [
                      "Checked the data logger: back in range at 09:40."
                    ],
                    "description": "Up to 10,000 characters"
                  },
                  "parentId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Reply to this thread (its first comment)"
                  },
                  "mentions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "People to @mention (they're notified)",
                    "examples": [
                      []
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Comment"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users": {
      "get": {
        "summary": "People in the workspace (for person columns)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/User"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/backups": {
      "get": {
        "summary": "The backups that can be downloaded now, newest first (backup key)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Backup"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/backups/{id}/download": {
      "get": {
        "summary": "A short-lived link to download a backup's zip (backup key)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The backup's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupLink"
                }
              }
            }
          },
          "400": {
            "description": "The request isn't valid (the issues say which fields and why)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's person can't do this, or the key is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not visible to the key's person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not possible now (e.g. the record is locked in review or published)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "The backup can no longer be downloaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait and retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}