@talonic/docs 0.21.97 → 0.21.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/openapi.json CHANGED
@@ -1963,6 +1963,18 @@
1963
1963
  ],
1964
1964
  "default": "extract",
1965
1965
  "description": "`extract`: text only, for a following `POST /v1/extract`. `ingest`: full processing into workspace data."
1966
+ },
1967
+ "parties": {
1968
+ "type": "array",
1969
+ "maxItems": 500,
1970
+ "description": "The document's parties as your system has them, the same as `PUT /v1/documents/{id}/parties`. They decide the document's labels and so its place in the Collections tree.",
1971
+ "items": {
1972
+ "$ref": "#/components/schemas/DocumentParty"
1973
+ }
1974
+ },
1975
+ "parties_complete": {
1976
+ "type": "boolean",
1977
+ "description": "`parties` names every party of the document."
1966
1978
  }
1967
1979
  }
1968
1980
  }
@@ -65998,89 +66010,15 @@
65998
66010
  }
65999
66011
  }
66000
66012
  },
66001
- "/v1/documents/batch-metadata/import": {
66002
- "post": {
66003
- "operationId": "importDocumentBatchMetadata",
66004
- "x-audience": "public",
66005
- "tags": [
66006
- "Documents"
66007
- ],
66008
- "summary": "Import source batch ids from a CSV",
66009
- "description": "Sets the source batch id on existing documents from a CSV upload (`file`, up to 20 MB). Answers how many documents were updated and which named ones were not found. 403 for a person whose document visibility a rule narrows, because the import matches against every document of the workspace. Requires the `documents:write` scope. The key's person must be an Admin of the workspace, as in the web app; in a workspace whose model configuration Talonic manages this answers 403 `insufficient_role`.",
66010
- "security": [
66011
- {
66012
- "BearerAuth": []
66013
- }
66014
- ],
66015
- "x-required-scopes": [
66016
- "documents:write"
66017
- ],
66018
- "requestBody": {
66019
- "required": true,
66020
- "content": {
66021
- "multipart/form-data": {
66022
- "schema": {
66023
- "type": "object",
66024
- "properties": {
66025
- "file": {
66026
- "type": "string",
66027
- "format": "binary",
66028
- "description": "CSV with a header row."
66029
- }
66030
- },
66031
- "required": [
66032
- "file"
66033
- ]
66034
- }
66035
- }
66036
- }
66037
- },
66038
- "responses": {
66039
- "201": {
66040
- "description": "OK",
66041
- "content": {
66042
- "application/json": {
66043
- "schema": {
66044
- "type": "object",
66045
- "properties": {
66046
- "updated": {
66047
- "type": "integer"
66048
- },
66049
- "not_found": {
66050
- "type": "array",
66051
- "items": {
66052
- "type": "string"
66053
- }
66054
- }
66055
- }
66056
- }
66057
- }
66058
- }
66059
- },
66060
- "400": {
66061
- "$ref": "#/components/responses/BadRequest"
66062
- },
66063
- "401": {
66064
- "$ref": "#/components/responses/Unauthorized"
66065
- },
66066
- "403": {
66067
- "$ref": "#/components/responses/Forbidden"
66068
- },
66069
- "429": {
66070
- "$ref": "#/components/responses/RateLimitExceeded"
66071
- }
66072
- }
66073
- }
66074
- },
66075
- "/v1/documents/display-name-rule": {
66013
+ "/v1/documents/{id}/collections": {
66076
66014
  "get": {
66077
- "operationId": "getDisplayNameRule",
66015
+ "operationId": "explainDocumentCollections",
66078
66016
  "x-audience": "public",
66079
66017
  "tags": [
66080
- "Documents"
66018
+ "Collections"
66081
66019
  ],
66082
- "summary": "Get the readable-name rule",
66083
- "description": "The workspace's rule for deriving a readable name from each filename, its check state, and a sample of current filename → name pairs. Requires the `read` scope (or `documents:read`). Any member of the workspace may call it. The sample lists only documents the key's person can see.",
66020
+ "summary": "Explain a document's collections",
66021
+ "description": "Why the document sits where it does: each of its labels, whether it was derived or set by a person, with the evidence you may see behind it, and each collection it is in, with why (`rule`, `hand` or `held` by a limit). `pending` and `unresolved` say whether its labels are still settling. 404 when the key's person may not read the document. Requires the `read` scope (or `documents:read`). Any member of the workspace may call it.",
66084
66022
  "security": [
66085
66023
  {
66086
66024
  "BearerAuth": []
@@ -66089,72 +66027,17 @@
66089
66027
  "x-required-scopes": [
66090
66028
  "read"
66091
66029
  ],
66092
- "responses": {
66093
- "200": {
66094
- "description": "OK",
66095
- "content": {
66096
- "application/json": {
66097
- "schema": {
66098
- "type": "object",
66099
- "additionalProperties": true
66100
- }
66101
- }
66102
- }
66103
- },
66104
- "401": {
66105
- "$ref": "#/components/responses/Unauthorized"
66106
- },
66107
- "403": {
66108
- "$ref": "#/components/responses/Forbidden"
66109
- },
66110
- "429": {
66111
- "$ref": "#/components/responses/RateLimitExceeded"
66112
- }
66113
- }
66114
- },
66115
- "patch": {
66116
- "operationId": "setDisplayNameRule",
66117
- "x-audience": "public",
66118
- "tags": [
66119
- "Documents"
66120
- ],
66121
- "summary": "Set the readable-name rule",
66122
- "description": "`off` derives nothing and clears stored names, `default` tidies each filename, `lua` runs your `script` (reads `record.filename`, calls `record:set('display_name', value)`). Takes effect for new documents; apply it to existing ones with the backfill. Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app.",
66123
- "security": [
66030
+ "parameters": [
66124
66031
  {
66125
- "BearerAuth": []
66126
- }
66127
- ],
66128
- "x-required-scopes": [
66129
- "documents:write"
66130
- ],
66131
- "requestBody": {
66132
- "required": true,
66133
- "content": {
66134
- "application/json": {
66135
- "schema": {
66136
- "type": "object",
66137
- "properties": {
66138
- "mode": {
66139
- "type": "string",
66140
- "enum": [
66141
- "off",
66142
- "default",
66143
- "lua"
66144
- ]
66145
- },
66146
- "script": {
66147
- "type": "string",
66148
- "maxLength": 20000
66149
- }
66150
- },
66151
- "required": [
66152
- "mode"
66153
- ]
66154
- }
66032
+ "name": "id",
66033
+ "in": "path",
66034
+ "required": true,
66035
+ "schema": {
66036
+ "type": "string",
66037
+ "format": "uuid"
66155
66038
  }
66156
66039
  }
66157
- },
66040
+ ],
66158
66041
  "responses": {
66159
66042
  "200": {
66160
66043
  "description": "OK",
@@ -66176,21 +66059,24 @@
66176
66059
  "403": {
66177
66060
  "$ref": "#/components/responses/Forbidden"
66178
66061
  },
66062
+ "404": {
66063
+ "$ref": "#/components/responses/NotFound"
66064
+ },
66179
66065
  "429": {
66180
66066
  "$ref": "#/components/responses/RateLimitExceeded"
66181
66067
  }
66182
66068
  }
66183
66069
  }
66184
66070
  },
66185
- "/v1/documents/display-name-rule/preview": {
66186
- "post": {
66187
- "operationId": "previewDisplayNameRule",
66071
+ "/v1/documents/{id}/traits": {
66072
+ "patch": {
66073
+ "operationId": "setDocumentLabels",
66188
66074
  "x-audience": "public",
66189
66075
  "tags": [
66190
- "Documents"
66076
+ "Collections"
66191
66077
  ],
66192
- "summary": "Try a readable-name script",
66193
- "description": "Runs a candidate `lua_script` over a sample of real filenames (default 50, at most 200) without saving it. Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app. The sample is drawn only from documents the key's person can see.",
66078
+ "summary": "Change a document's labels by hand",
66079
+ "description": "Adds and removes labels on one document (`add`, `remove`, each at most 50 labels such as `relationship:client`). A person's labels are kept whenever the document's labels are derived again. Refused (403) when the change would move the document into or out of a limited collection the key's person may not manage. Requires the `documents:write` scope. The key's person must be allowed to edit in the workspace, as in the web app.",
66194
66080
  "security": [
66195
66081
  {
66196
66082
  "BearerAuth": []
@@ -66199,74 +66085,17 @@
66199
66085
  "x-required-scopes": [
66200
66086
  "documents:write"
66201
66087
  ],
66202
- "requestBody": {
66203
- "required": true,
66204
- "content": {
66205
- "application/json": {
66206
- "schema": {
66207
- "type": "object",
66208
- "properties": {
66209
- "lua_script": {
66210
- "type": "string",
66211
- "maxLength": 20000
66212
- },
66213
- "sample_size": {
66214
- "type": "integer",
66215
- "minimum": 1,
66216
- "maximum": 200
66217
- }
66218
- },
66219
- "required": [
66220
- "lua_script"
66221
- ]
66222
- }
66223
- }
66224
- }
66225
- },
66226
- "responses": {
66227
- "200": {
66228
- "description": "OK",
66229
- "content": {
66230
- "application/json": {
66231
- "schema": {
66232
- "type": "object",
66233
- "additionalProperties": true
66234
- }
66235
- }
66236
- }
66237
- },
66238
- "400": {
66239
- "$ref": "#/components/responses/BadRequest"
66240
- },
66241
- "401": {
66242
- "$ref": "#/components/responses/Unauthorized"
66243
- },
66244
- "403": {
66245
- "$ref": "#/components/responses/Forbidden"
66246
- },
66247
- "429": {
66248
- "$ref": "#/components/responses/RateLimitExceeded"
66249
- }
66250
- }
66251
- }
66252
- },
66253
- "/v1/documents/display-name-rule/generate-script": {
66254
- "post": {
66255
- "operationId": "generateDisplayNameScript",
66256
- "x-audience": "public",
66257
- "tags": [
66258
- "Documents"
66259
- ],
66260
- "summary": "Draft a readable-name script from an instruction",
66261
- "description": "Drafts a rule script from a plain-language `instruction` (\"drop the number in front of the name\"), grounded in the workspace's own filenames. Saves nothing. Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app. Only filenames of documents the key's person can see are used and returned.",
66262
- "security": [
66088
+ "parameters": [
66263
66089
  {
66264
- "BearerAuth": []
66090
+ "name": "id",
66091
+ "in": "path",
66092
+ "required": true,
66093
+ "schema": {
66094
+ "type": "string",
66095
+ "format": "uuid"
66096
+ }
66265
66097
  }
66266
66098
  ],
66267
- "x-required-scopes": [
66268
- "documents:write"
66269
- ],
66270
66099
  "requestBody": {
66271
66100
  "required": true,
66272
66101
  "content": {
@@ -66274,19 +66103,512 @@
66274
66103
  "schema": {
66275
66104
  "type": "object",
66276
66105
  "properties": {
66277
- "instruction": {
66278
- "type": "string",
66279
- "maxLength": 2000
66106
+ "add": {
66107
+ "type": "array",
66108
+ "maxItems": 50,
66109
+ "items": {
66110
+ "type": "string",
66111
+ "maxLength": 200
66112
+ }
66280
66113
  },
66281
- "sample_size": {
66282
- "type": "integer",
66283
- "minimum": 1,
66284
- "maximum": 200
66114
+ "remove": {
66115
+ "type": "array",
66116
+ "maxItems": 50,
66117
+ "items": {
66118
+ "type": "string",
66119
+ "maxLength": 200
66120
+ }
66285
66121
  }
66286
- },
66287
- "required": [
66288
- "instruction"
66289
- ]
66122
+ }
66123
+ }
66124
+ }
66125
+ }
66126
+ },
66127
+ "responses": {
66128
+ "200": {
66129
+ "description": "OK",
66130
+ "content": {
66131
+ "application/json": {
66132
+ "schema": {
66133
+ "type": "object",
66134
+ "additionalProperties": true
66135
+ }
66136
+ }
66137
+ }
66138
+ },
66139
+ "400": {
66140
+ "$ref": "#/components/responses/BadRequest"
66141
+ },
66142
+ "401": {
66143
+ "$ref": "#/components/responses/Unauthorized"
66144
+ },
66145
+ "403": {
66146
+ "$ref": "#/components/responses/Forbidden"
66147
+ },
66148
+ "404": {
66149
+ "$ref": "#/components/responses/NotFound"
66150
+ },
66151
+ "429": {
66152
+ "$ref": "#/components/responses/RateLimitExceeded"
66153
+ }
66154
+ }
66155
+ }
66156
+ },
66157
+ "/v1/documents/{id}/move": {
66158
+ "post": {
66159
+ "operationId": "moveDocumentBetweenCollections",
66160
+ "x-audience": "public",
66161
+ "tags": [
66162
+ "Collections"
66163
+ ],
66164
+ "summary": "Move a document between collections",
66165
+ "description": "Takes the document out of `from`, puts it into `to`, or both. A collection that sorts by labels keeps the document out once it is moved out. Any member moves between plain collections; a limited collection needs a person its limit admits or an owner; an enforced collection or an account needs an owner (403 otherwise). 404 when the key's person may not read the document. Requires the `documents:write` scope. The key's person must be allowed to edit in the workspace, as in the web app.",
66166
+ "security": [
66167
+ {
66168
+ "BearerAuth": []
66169
+ }
66170
+ ],
66171
+ "x-required-scopes": [
66172
+ "documents:write"
66173
+ ],
66174
+ "parameters": [
66175
+ {
66176
+ "name": "id",
66177
+ "in": "path",
66178
+ "required": true,
66179
+ "schema": {
66180
+ "type": "string",
66181
+ "format": "uuid"
66182
+ }
66183
+ }
66184
+ ],
66185
+ "requestBody": {
66186
+ "required": true,
66187
+ "content": {
66188
+ "application/json": {
66189
+ "schema": {
66190
+ "type": "object",
66191
+ "properties": {
66192
+ "from": {
66193
+ "type": "string",
66194
+ "format": "uuid",
66195
+ "nullable": true
66196
+ },
66197
+ "to": {
66198
+ "type": "string",
66199
+ "format": "uuid",
66200
+ "nullable": true
66201
+ }
66202
+ }
66203
+ }
66204
+ }
66205
+ }
66206
+ },
66207
+ "responses": {
66208
+ "200": {
66209
+ "description": "OK",
66210
+ "content": {
66211
+ "application/json": {
66212
+ "schema": {
66213
+ "type": "object",
66214
+ "additionalProperties": true
66215
+ }
66216
+ }
66217
+ }
66218
+ },
66219
+ "400": {
66220
+ "$ref": "#/components/responses/BadRequest"
66221
+ },
66222
+ "401": {
66223
+ "$ref": "#/components/responses/Unauthorized"
66224
+ },
66225
+ "403": {
66226
+ "$ref": "#/components/responses/Forbidden"
66227
+ },
66228
+ "404": {
66229
+ "$ref": "#/components/responses/NotFound"
66230
+ },
66231
+ "409": {
66232
+ "$ref": "#/components/responses/Conflict"
66233
+ },
66234
+ "429": {
66235
+ "$ref": "#/components/responses/RateLimitExceeded"
66236
+ }
66237
+ }
66238
+ }
66239
+ },
66240
+ "/v1/documents/{id}/parties": {
66241
+ "put": {
66242
+ "operationId": "setDocumentParties",
66243
+ "x-audience": "public",
66244
+ "tags": [
66245
+ "Collections"
66246
+ ],
66247
+ "summary": "Set a document's parties",
66248
+ "description": "Hands over the document's parties as your system has them, the way a connected mailbox does at import: typed identifiers with an optional role, and whether the list is `complete` (only a complete list whose every party is your own makes a document internal). The document's labels are derived again at once; a party nobody in the directory knows yet may leave the document `pending` for a short while, during which it stays under every limit. Requires the `documents:write` scope. The key's person must be allowed to edit in the workspace, as in the web app.",
66249
+ "security": [
66250
+ {
66251
+ "BearerAuth": []
66252
+ }
66253
+ ],
66254
+ "x-required-scopes": [
66255
+ "documents:write"
66256
+ ],
66257
+ "parameters": [
66258
+ {
66259
+ "name": "id",
66260
+ "in": "path",
66261
+ "required": true,
66262
+ "schema": {
66263
+ "type": "string",
66264
+ "format": "uuid"
66265
+ }
66266
+ }
66267
+ ],
66268
+ "requestBody": {
66269
+ "required": true,
66270
+ "content": {
66271
+ "application/json": {
66272
+ "schema": {
66273
+ "type": "object",
66274
+ "required": [
66275
+ "parties"
66276
+ ],
66277
+ "properties": {
66278
+ "parties": {
66279
+ "type": "array",
66280
+ "maxItems": 500,
66281
+ "items": {
66282
+ "$ref": "#/components/schemas/DocumentParty"
66283
+ }
66284
+ },
66285
+ "complete": {
66286
+ "type": "boolean"
66287
+ }
66288
+ }
66289
+ }
66290
+ }
66291
+ }
66292
+ },
66293
+ "responses": {
66294
+ "200": {
66295
+ "description": "OK",
66296
+ "content": {
66297
+ "application/json": {
66298
+ "schema": {
66299
+ "type": "object",
66300
+ "additionalProperties": true
66301
+ }
66302
+ }
66303
+ }
66304
+ },
66305
+ "400": {
66306
+ "$ref": "#/components/responses/BadRequest"
66307
+ },
66308
+ "401": {
66309
+ "$ref": "#/components/responses/Unauthorized"
66310
+ },
66311
+ "403": {
66312
+ "$ref": "#/components/responses/Forbidden"
66313
+ },
66314
+ "404": {
66315
+ "$ref": "#/components/responses/NotFound"
66316
+ },
66317
+ "429": {
66318
+ "$ref": "#/components/responses/RateLimitExceeded"
66319
+ }
66320
+ }
66321
+ }
66322
+ },
66323
+ "/v1/documents/batch-metadata/import": {
66324
+ "post": {
66325
+ "operationId": "importDocumentBatchMetadata",
66326
+ "x-audience": "public",
66327
+ "tags": [
66328
+ "Documents"
66329
+ ],
66330
+ "summary": "Import source batch ids from a CSV",
66331
+ "description": "Sets the source batch id on existing documents from a CSV upload (`file`, up to 20 MB). Answers how many documents were updated and which named ones were not found. 403 for a person whose document visibility a rule narrows, because the import matches against every document of the workspace. Requires the `documents:write` scope. The key's person must be an Admin of the workspace, as in the web app; in a workspace whose model configuration Talonic manages this answers 403 `insufficient_role`.",
66332
+ "security": [
66333
+ {
66334
+ "BearerAuth": []
66335
+ }
66336
+ ],
66337
+ "x-required-scopes": [
66338
+ "documents:write"
66339
+ ],
66340
+ "requestBody": {
66341
+ "required": true,
66342
+ "content": {
66343
+ "multipart/form-data": {
66344
+ "schema": {
66345
+ "type": "object",
66346
+ "properties": {
66347
+ "file": {
66348
+ "type": "string",
66349
+ "format": "binary",
66350
+ "description": "CSV with a header row."
66351
+ }
66352
+ },
66353
+ "required": [
66354
+ "file"
66355
+ ]
66356
+ }
66357
+ }
66358
+ }
66359
+ },
66360
+ "responses": {
66361
+ "201": {
66362
+ "description": "OK",
66363
+ "content": {
66364
+ "application/json": {
66365
+ "schema": {
66366
+ "type": "object",
66367
+ "properties": {
66368
+ "updated": {
66369
+ "type": "integer"
66370
+ },
66371
+ "not_found": {
66372
+ "type": "array",
66373
+ "items": {
66374
+ "type": "string"
66375
+ }
66376
+ }
66377
+ }
66378
+ }
66379
+ }
66380
+ }
66381
+ },
66382
+ "400": {
66383
+ "$ref": "#/components/responses/BadRequest"
66384
+ },
66385
+ "401": {
66386
+ "$ref": "#/components/responses/Unauthorized"
66387
+ },
66388
+ "403": {
66389
+ "$ref": "#/components/responses/Forbidden"
66390
+ },
66391
+ "429": {
66392
+ "$ref": "#/components/responses/RateLimitExceeded"
66393
+ }
66394
+ }
66395
+ }
66396
+ },
66397
+ "/v1/documents/display-name-rule": {
66398
+ "get": {
66399
+ "operationId": "getDisplayNameRule",
66400
+ "x-audience": "public",
66401
+ "tags": [
66402
+ "Documents"
66403
+ ],
66404
+ "summary": "Get the readable-name rule",
66405
+ "description": "The workspace's rule for deriving a readable name from each filename, its check state, and a sample of current filename → name pairs. Requires the `read` scope (or `documents:read`). Any member of the workspace may call it. The sample lists only documents the key's person can see.",
66406
+ "security": [
66407
+ {
66408
+ "BearerAuth": []
66409
+ }
66410
+ ],
66411
+ "x-required-scopes": [
66412
+ "read"
66413
+ ],
66414
+ "responses": {
66415
+ "200": {
66416
+ "description": "OK",
66417
+ "content": {
66418
+ "application/json": {
66419
+ "schema": {
66420
+ "type": "object",
66421
+ "additionalProperties": true
66422
+ }
66423
+ }
66424
+ }
66425
+ },
66426
+ "401": {
66427
+ "$ref": "#/components/responses/Unauthorized"
66428
+ },
66429
+ "403": {
66430
+ "$ref": "#/components/responses/Forbidden"
66431
+ },
66432
+ "429": {
66433
+ "$ref": "#/components/responses/RateLimitExceeded"
66434
+ }
66435
+ }
66436
+ },
66437
+ "patch": {
66438
+ "operationId": "setDisplayNameRule",
66439
+ "x-audience": "public",
66440
+ "tags": [
66441
+ "Documents"
66442
+ ],
66443
+ "summary": "Set the readable-name rule",
66444
+ "description": "`off` derives nothing and clears stored names, `default` tidies each filename, `lua` runs your `script` (reads `record.filename`, calls `record:set('display_name', value)`). Takes effect for new documents; apply it to existing ones with the backfill. Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app.",
66445
+ "security": [
66446
+ {
66447
+ "BearerAuth": []
66448
+ }
66449
+ ],
66450
+ "x-required-scopes": [
66451
+ "documents:write"
66452
+ ],
66453
+ "requestBody": {
66454
+ "required": true,
66455
+ "content": {
66456
+ "application/json": {
66457
+ "schema": {
66458
+ "type": "object",
66459
+ "properties": {
66460
+ "mode": {
66461
+ "type": "string",
66462
+ "enum": [
66463
+ "off",
66464
+ "default",
66465
+ "lua"
66466
+ ]
66467
+ },
66468
+ "script": {
66469
+ "type": "string",
66470
+ "maxLength": 20000
66471
+ }
66472
+ },
66473
+ "required": [
66474
+ "mode"
66475
+ ]
66476
+ }
66477
+ }
66478
+ }
66479
+ },
66480
+ "responses": {
66481
+ "200": {
66482
+ "description": "OK",
66483
+ "content": {
66484
+ "application/json": {
66485
+ "schema": {
66486
+ "type": "object",
66487
+ "additionalProperties": true
66488
+ }
66489
+ }
66490
+ }
66491
+ },
66492
+ "400": {
66493
+ "$ref": "#/components/responses/BadRequest"
66494
+ },
66495
+ "401": {
66496
+ "$ref": "#/components/responses/Unauthorized"
66497
+ },
66498
+ "403": {
66499
+ "$ref": "#/components/responses/Forbidden"
66500
+ },
66501
+ "429": {
66502
+ "$ref": "#/components/responses/RateLimitExceeded"
66503
+ }
66504
+ }
66505
+ }
66506
+ },
66507
+ "/v1/documents/display-name-rule/preview": {
66508
+ "post": {
66509
+ "operationId": "previewDisplayNameRule",
66510
+ "x-audience": "public",
66511
+ "tags": [
66512
+ "Documents"
66513
+ ],
66514
+ "summary": "Try a readable-name script",
66515
+ "description": "Runs a candidate `lua_script` over a sample of real filenames (default 50, at most 200) without saving it. Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app. The sample is drawn only from documents the key's person can see.",
66516
+ "security": [
66517
+ {
66518
+ "BearerAuth": []
66519
+ }
66520
+ ],
66521
+ "x-required-scopes": [
66522
+ "documents:write"
66523
+ ],
66524
+ "requestBody": {
66525
+ "required": true,
66526
+ "content": {
66527
+ "application/json": {
66528
+ "schema": {
66529
+ "type": "object",
66530
+ "properties": {
66531
+ "lua_script": {
66532
+ "type": "string",
66533
+ "maxLength": 20000
66534
+ },
66535
+ "sample_size": {
66536
+ "type": "integer",
66537
+ "minimum": 1,
66538
+ "maximum": 200
66539
+ }
66540
+ },
66541
+ "required": [
66542
+ "lua_script"
66543
+ ]
66544
+ }
66545
+ }
66546
+ }
66547
+ },
66548
+ "responses": {
66549
+ "200": {
66550
+ "description": "OK",
66551
+ "content": {
66552
+ "application/json": {
66553
+ "schema": {
66554
+ "type": "object",
66555
+ "additionalProperties": true
66556
+ }
66557
+ }
66558
+ }
66559
+ },
66560
+ "400": {
66561
+ "$ref": "#/components/responses/BadRequest"
66562
+ },
66563
+ "401": {
66564
+ "$ref": "#/components/responses/Unauthorized"
66565
+ },
66566
+ "403": {
66567
+ "$ref": "#/components/responses/Forbidden"
66568
+ },
66569
+ "429": {
66570
+ "$ref": "#/components/responses/RateLimitExceeded"
66571
+ }
66572
+ }
66573
+ }
66574
+ },
66575
+ "/v1/documents/display-name-rule/generate-script": {
66576
+ "post": {
66577
+ "operationId": "generateDisplayNameScript",
66578
+ "x-audience": "public",
66579
+ "tags": [
66580
+ "Documents"
66581
+ ],
66582
+ "summary": "Draft a readable-name script from an instruction",
66583
+ "description": "Drafts a rule script from a plain-language `instruction` (\"drop the number in front of the name\"), grounded in the workspace's own filenames. Saves nothing. Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app. Only filenames of documents the key's person can see are used and returned.",
66584
+ "security": [
66585
+ {
66586
+ "BearerAuth": []
66587
+ }
66588
+ ],
66589
+ "x-required-scopes": [
66590
+ "documents:write"
66591
+ ],
66592
+ "requestBody": {
66593
+ "required": true,
66594
+ "content": {
66595
+ "application/json": {
66596
+ "schema": {
66597
+ "type": "object",
66598
+ "properties": {
66599
+ "instruction": {
66600
+ "type": "string",
66601
+ "maxLength": 2000
66602
+ },
66603
+ "sample_size": {
66604
+ "type": "integer",
66605
+ "minimum": 1,
66606
+ "maximum": 200
66607
+ }
66608
+ },
66609
+ "required": [
66610
+ "instruction"
66611
+ ]
66290
66612
  }
66291
66613
  }
66292
66614
  }
@@ -66571,9 +66893,58 @@
66571
66893
  "type": "object",
66572
66894
  "additionalProperties": true
66573
66895
  }
66574
- },
66575
- "restricted": {
66576
- "type": "boolean"
66896
+ },
66897
+ "restricted": {
66898
+ "type": "boolean"
66899
+ }
66900
+ }
66901
+ }
66902
+ }
66903
+ }
66904
+ },
66905
+ "401": {
66906
+ "$ref": "#/components/responses/Unauthorized"
66907
+ },
66908
+ "403": {
66909
+ "$ref": "#/components/responses/Forbidden"
66910
+ },
66911
+ "429": {
66912
+ "$ref": "#/components/responses/RateLimitExceeded"
66913
+ }
66914
+ }
66915
+ }
66916
+ },
66917
+ "/v1/collections/counts": {
66918
+ "get": {
66919
+ "operationId": "getCollectionCounts",
66920
+ "x-audience": "public",
66921
+ "tags": [
66922
+ "Collections"
66923
+ ],
66924
+ "summary": "Count documents per collection",
66925
+ "description": "Visible-document counts per collection. Requires the `read` scope (or `documents:read`). Any member of the workspace may call it.",
66926
+ "security": [
66927
+ {
66928
+ "BearerAuth": []
66929
+ }
66930
+ ],
66931
+ "x-required-scopes": [
66932
+ "read"
66933
+ ],
66934
+ "responses": {
66935
+ "200": {
66936
+ "description": "OK",
66937
+ "content": {
66938
+ "application/json": {
66939
+ "schema": {
66940
+ "type": "object",
66941
+ "properties": {
66942
+ "collections": {
66943
+ "type": "array",
66944
+ "items": {
66945
+ "type": "object",
66946
+ "additionalProperties": true
66947
+ }
66577
66948
  }
66578
66949
  }
66579
66950
  }
@@ -66592,15 +66963,15 @@
66592
66963
  }
66593
66964
  }
66594
66965
  },
66595
- "/v1/collections/counts": {
66966
+ "/v1/collections/config": {
66596
66967
  "get": {
66597
- "operationId": "getCollectionCounts",
66968
+ "operationId": "getCollectionsConfig",
66598
66969
  "x-audience": "public",
66599
66970
  "tags": [
66600
66971
  "Collections"
66601
66972
  ],
66602
- "summary": "Count documents per collection",
66603
- "description": "Visible-document counts per collection. Requires the `read` scope (or `documents:read`). Any member of the workspace may call it.",
66973
+ "summary": "Get the collections configuration",
66974
+ "description": "The workspace's collections as one configuration document: each collection that has a `key` with its name, the labels it sorts by (`match`, or `any` for several label sets) and its children, plus the workspace's relationship kinds, own domains and whether relationships may be inferred. Who may read a limited collection (`only`), the directory's configured entries and the default views appear for a workspace owner only. Requires the `read` scope (or `documents:read`). Any member of the workspace may call it.",
66604
66975
  "security": [
66605
66976
  {
66606
66977
  "BearerAuth": []
@@ -66616,18 +66987,277 @@
66616
66987
  "application/json": {
66617
66988
  "schema": {
66618
66989
  "type": "object",
66619
- "properties": {
66620
- "collections": {
66621
- "type": "array",
66622
- "items": {
66623
- "type": "object",
66624
- "additionalProperties": true
66990
+ "additionalProperties": true
66991
+ }
66992
+ }
66993
+ }
66994
+ },
66995
+ "400": {
66996
+ "$ref": "#/components/responses/BadRequest"
66997
+ },
66998
+ "401": {
66999
+ "$ref": "#/components/responses/Unauthorized"
67000
+ },
67001
+ "403": {
67002
+ "$ref": "#/components/responses/Forbidden"
67003
+ },
67004
+ "429": {
67005
+ "$ref": "#/components/responses/RateLimitExceeded"
67006
+ }
67007
+ }
67008
+ },
67009
+ "put": {
67010
+ "operationId": "applyCollectionsConfig",
67011
+ "x-audience": "public",
67012
+ "tags": [
67013
+ "Collections"
67014
+ ],
67015
+ "summary": "Apply a collections configuration",
67016
+ "description": "Applies a configuration document: every problem is reported at once (400 with `details.problems`) before anything changes, then everything is saved together. Collections are matched by their path of keys, so applying the same document twice changes nothing. With `dry_run=true` nothing is saved and the answer lists what would be created, changed and removed, how many documents each collection would hold for you, and for each limit how many documents it hides from how many people. `prune=true` removes keyed collections the document does not name, and refuses (409) one that still has a limit or documents placed by hand. A key with no person cannot change `only` (403). Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app.",
67017
+ "security": [
67018
+ {
67019
+ "BearerAuth": []
67020
+ }
67021
+ ],
67022
+ "x-required-scopes": [
67023
+ "documents:write"
67024
+ ],
67025
+ "parameters": [
67026
+ {
67027
+ "name": "dry_run",
67028
+ "in": "query",
67029
+ "required": false,
67030
+ "schema": {
67031
+ "type": "boolean",
67032
+ "default": false
67033
+ },
67034
+ "description": "Check and preview the change; nothing is saved."
67035
+ },
67036
+ {
67037
+ "name": "prune",
67038
+ "in": "query",
67039
+ "required": false,
67040
+ "schema": {
67041
+ "type": "boolean",
67042
+ "default": false
67043
+ },
67044
+ "description": "Remove keyed collections the document does not name."
67045
+ }
67046
+ ],
67047
+ "requestBody": {
67048
+ "required": true,
67049
+ "content": {
67050
+ "application/json": {
67051
+ "schema": {
67052
+ "type": "object",
67053
+ "properties": {
67054
+ "document": {
67055
+ "type": "object",
67056
+ "additionalProperties": true,
67057
+ "description": "The configuration document."
67058
+ },
67059
+ "yaml": {
67060
+ "type": "string",
67061
+ "maxLength": 1000000,
67062
+ "description": "The configuration document as YAML or JSON text."
67063
+ }
67064
+ }
67065
+ }
67066
+ }
67067
+ }
67068
+ },
67069
+ "responses": {
67070
+ "200": {
67071
+ "description": "OK",
67072
+ "content": {
67073
+ "application/json": {
67074
+ "schema": {
67075
+ "type": "object",
67076
+ "additionalProperties": true
67077
+ }
67078
+ }
67079
+ }
67080
+ },
67081
+ "400": {
67082
+ "$ref": "#/components/responses/BadRequest"
67083
+ },
67084
+ "401": {
67085
+ "$ref": "#/components/responses/Unauthorized"
67086
+ },
67087
+ "403": {
67088
+ "$ref": "#/components/responses/Forbidden"
67089
+ },
67090
+ "409": {
67091
+ "$ref": "#/components/responses/Conflict"
67092
+ },
67093
+ "429": {
67094
+ "$ref": "#/components/responses/RateLimitExceeded"
67095
+ }
67096
+ }
67097
+ }
67098
+ },
67099
+ "/v1/collections/proposal": {
67100
+ "post": {
67101
+ "operationId": "proposeCollectionsConfig",
67102
+ "x-audience": "public",
67103
+ "tags": [
67104
+ "Collections"
67105
+ ],
67106
+ "summary": "Propose a collections configuration",
67107
+ "description": "A configuration document built from the workspace's own documents, as far as the key's person may read them: one top-level collection per channel with documents, children for the labels common enough to be worth one, and, when the workspace has conversations and fewer than two relationship kinds, kinds suggested from its most frequent outside organisations (only when relationships may be inferred). Nothing is saved, and no limit is ever proposed: edit it and apply it with `PUT /v1/collections/config`. Requires the `read` scope (or `documents:read`). The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app.",
67108
+ "security": [
67109
+ {
67110
+ "BearerAuth": []
67111
+ }
67112
+ ],
67113
+ "x-required-scopes": [
67114
+ "read"
67115
+ ],
67116
+ "responses": {
67117
+ "200": {
67118
+ "description": "OK",
67119
+ "content": {
67120
+ "application/json": {
67121
+ "schema": {
67122
+ "type": "object",
67123
+ "additionalProperties": true
67124
+ }
67125
+ }
67126
+ }
67127
+ },
67128
+ "400": {
67129
+ "$ref": "#/components/responses/BadRequest"
67130
+ },
67131
+ "401": {
67132
+ "$ref": "#/components/responses/Unauthorized"
67133
+ },
67134
+ "403": {
67135
+ "$ref": "#/components/responses/Forbidden"
67136
+ },
67137
+ "429": {
67138
+ "$ref": "#/components/responses/RateLimitExceeded"
67139
+ }
67140
+ }
67141
+ }
67142
+ },
67143
+ "/v1/collections/directory": {
67144
+ "get": {
67145
+ "operationId": "listCollectionsDirectory",
67146
+ "x-audience": "public",
67147
+ "tags": [
67148
+ "Collections"
67149
+ ],
67150
+ "summary": "List the relationship directory",
67151
+ "description": "Who is who: each identifier (an address, a domain, a phone number, a handle) with what that party is to the workspace and where that came from (`person`, `config`, `record` or `read`). Each entry is shown only where the key's person may see its evidence: configured and corrected entries for an owner, an entry from a record when the person may read that record, an entry from a conversation when the person may read that conversation. Requires the `read` scope (or `documents:read`). Any member of the workspace may call it.",
67152
+ "security": [
67153
+ {
67154
+ "BearerAuth": []
67155
+ }
67156
+ ],
67157
+ "x-required-scopes": [
67158
+ "read"
67159
+ ],
67160
+ "responses": {
67161
+ "200": {
67162
+ "description": "OK",
67163
+ "content": {
67164
+ "application/json": {
67165
+ "schema": {
67166
+ "type": "object",
67167
+ "additionalProperties": true
67168
+ }
67169
+ }
67170
+ }
67171
+ },
67172
+ "400": {
67173
+ "$ref": "#/components/responses/BadRequest"
67174
+ },
67175
+ "401": {
67176
+ "$ref": "#/components/responses/Unauthorized"
67177
+ },
67178
+ "403": {
67179
+ "$ref": "#/components/responses/Forbidden"
67180
+ },
67181
+ "429": {
67182
+ "$ref": "#/components/responses/RateLimitExceeded"
67183
+ }
67184
+ }
67185
+ },
67186
+ "put": {
67187
+ "operationId": "saveCollectionsDirectory",
67188
+ "x-audience": "public",
67189
+ "tags": [
67190
+ "Collections"
67191
+ ],
67192
+ "summary": "Correct the relationship directory",
67193
+ "description": "Sets entries as a person's correction (they outrank configuration, records and conversations for their identifier) and removes entries by id. The documents of every identifier touched are relabelled; `wait` waits up to 60 seconds and `pending` counts what is still to follow. Requires the `documents:write` scope. The key's person must be an Admin of the workspace (the `workspace` permission), as in the web app.",
67194
+ "security": [
67195
+ {
67196
+ "BearerAuth": []
67197
+ }
67198
+ ],
67199
+ "x-required-scopes": [
67200
+ "documents:write"
67201
+ ],
67202
+ "requestBody": {
67203
+ "required": true,
67204
+ "content": {
67205
+ "application/json": {
67206
+ "schema": {
67207
+ "type": "object",
67208
+ "properties": {
67209
+ "entries": {
67210
+ "type": "array",
67211
+ "maxItems": 200,
67212
+ "items": {
67213
+ "type": "object",
67214
+ "required": [
67215
+ "match_value",
67216
+ "relationship"
67217
+ ],
67218
+ "properties": {
67219
+ "match_value": {
67220
+ "type": "string",
67221
+ "description": "A typed identifier: `domain:acme.com`, `email:jane@acme.com`, `phone:…`, `handle:…` or `entity:…`."
67222
+ },
67223
+ "relationship": {
67224
+ "type": "string",
67225
+ "description": "A relationship kind of the workspace (its slug), or `own` / `other`."
67226
+ }
66625
67227
  }
66626
67228
  }
67229
+ },
67230
+ "remove": {
67231
+ "type": "array",
67232
+ "maxItems": 200,
67233
+ "items": {
67234
+ "type": "string",
67235
+ "format": "uuid"
67236
+ }
67237
+ },
67238
+ "wait": {
67239
+ "type": "boolean",
67240
+ "description": "Wait up to 60 seconds for the documents to be relabelled."
66627
67241
  }
66628
67242
  }
66629
67243
  }
66630
67244
  }
67245
+ }
67246
+ },
67247
+ "responses": {
67248
+ "200": {
67249
+ "description": "OK",
67250
+ "content": {
67251
+ "application/json": {
67252
+ "schema": {
67253
+ "type": "object",
67254
+ "additionalProperties": true
67255
+ }
67256
+ }
67257
+ }
67258
+ },
67259
+ "400": {
67260
+ "$ref": "#/components/responses/BadRequest"
66631
67261
  },
66632
67262
  "401": {
66633
67263
  "$ref": "#/components/responses/Unauthorized"
@@ -66635,6 +67265,9 @@
66635
67265
  "403": {
66636
67266
  "$ref": "#/components/responses/Forbidden"
66637
67267
  },
67268
+ "404": {
67269
+ "$ref": "#/components/responses/NotFound"
67270
+ },
66638
67271
  "429": {
66639
67272
  "$ref": "#/components/responses/RateLimitExceeded"
66640
67273
  }
@@ -84866,6 +85499,31 @@
84866
85499
  }
84867
85500
  },
84868
85501
  "schemas": {
85502
+ "DocumentParty": {
85503
+ "type": "object",
85504
+ "required": [
85505
+ "id"
85506
+ ],
85507
+ "description": "One party of a document: a typed identifier and, optionally, its role. An address also stands for its domain unless it is a public mail provider's.",
85508
+ "properties": {
85509
+ "id": {
85510
+ "type": "string",
85511
+ "maxLength": 320,
85512
+ "description": "`email:jane@acme.com`, `domain:acme.com`, `phone:+4930123456`, `handle:<scope>:<id>` or `entity:<id>` (a bare address reads as `email:`).",
85513
+ "example": "email:jane@acme.com"
85514
+ },
85515
+ "role": {
85516
+ "type": "string",
85517
+ "enum": [
85518
+ "from",
85519
+ "to",
85520
+ "cc",
85521
+ "attendee",
85522
+ "author"
85523
+ ]
85524
+ }
85525
+ }
85526
+ },
84869
85527
  "Account": {
84870
85528
  "type": "object",
84871
85529
  "required": [