{"openapi":"3.1.0","info":{"title":"VaultLens Studio API","version":"1.1.0","description":"Manage Knack apps, syncs and archives, and read your analytics copy, with the same rules as the VaultLens app: plan limits and your Knack API budget apply to every call.\n\n## Quickstart\n\n1. In VaultLens, open **Settings → API keys** and create a key with the `read` scope. Copy it: it’s shown once.\n2. Call the API with it:\n\n```bash\ncurl https://api.vaultlens.studio/v1/me \\\n  -H \"Authorization: Bearer vls_XXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n```\n\n3. List your apps with `GET /v1/apps`, then use an app’s `id` with the other endpoints.\n\nAny HTTP client works. To get a typed client in your language, generate one from this reference’s OpenAPI document, `GET /v1/openapi.json` (for example with openapi-generator or openapi-typescript).\n\n## Authentication\n\nSend an API key as a bearer token: `Authorization: Bearer vls_…`. Keys belong to a workspace and act with an admin’s access, narrowed by their scopes: `read` (Apps, schema, jobs, sync status, archive settings and runs (no record values).); `write` (Start syncs, pause or resume live sync, manage archive settings.); `archive:run` (Start archive runs that remove records from Knack (test runs only need Write).); `data:query` (Read records from the analytics copy, and download archive files.); `phi:read` (HIPAA workspaces: required with Query data, because record values are PHI.). A key can also be limited to some apps, to IP addresses, or to an expiry date. Revoked and expired keys stop working immediately. HIPAA workspaces: keys must expire within a year, reading record values needs `phi:read`, and every call is audited.\n\n## Errors\n\nErrors are JSON with a stable `code`, a message you can show, and the request id:\n\n```json\n{ \"error\": { \"code\": \"PLAN_REQUIRED\", \"message\": \"Archive isn’t included in the Analytics plan…\", \"requestId\": \"req_…\" } }\n```\n\nStatuses: 400 invalid request, 401 no or bad key, 402 not on your plan or a plan limit reached, 403 missing scope, app or IP, 404 not found, 409 conflicts with the current state (a job already running, no destination yet), 422 an `Idempotency-Key` reused for a different request, 429 rate limited. Every response carries `X-Request-Id`: quote it when contacting support. You can send your own `X-Request-Id` (8–64 letters, digits, `._-`) to trace a call.\n\n## Pagination\n\nLists return `{ \"data\": [...], \"nextCursor\": string | null }`. Pass `cursor=<nextCursor>` for the next page and stop when it’s `null`. `limit` sets the page size.\n\n## Rate limits\n\nPer key, per minute, by plan: Analytics 60, Archive 60, Studio 120, Business 300. Responses include `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (seconds). Over the limit you get 429 with `Retry-After`. Endpoints that call Knack (syncs, archive runs) also use your Knack API budget, exactly as in the app.\n\n## Idempotency\n\nTo retry a POST safely, send `Idempotency-Key: <your unique id>`. Repeating the same request with the same key within 24 hours returns the first response (with `Idempotent-Replayed: true`) instead of starting the work again.\n\n## Webhooks\n\nAdd endpoints in **Settings → Webhooks** to receive events as signed JSON POSTs (the event schemas are under Webhooks below). Payloads carry ids and event types only, never record values. Each request has `VaultLens-Event`, `VaultLens-Delivery` and `VaultLens-Signature: t=<unix seconds>,v1=<signature>`, where the signature is the hex HMAC-SHA256 of `\"<t>.<raw body>\"` with your webhook’s signing secret. Check it, and that `t` is recent, before trusting a delivery. In Node:\n\n```ts\nimport { createHmac, timingSafeEqual } from 'node:crypto';\n\nfunction verifyWebhook(rawBody: string, header: string, secret: string): boolean {\n  const parts = Object.fromEntries(header.split(',').map((p) => p.trim().split('=')));\n  const t = Number(parts.t);\n  if (!t || !parts.v1 || Math.abs(Date.now() / 1000 - t) > 300) return false;\n  const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');\n  return expected.length === parts.v1.length &&\n    timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));\n}\n```\n\nAnswer with any 2xx within 10 seconds. Anything else is retried with backoff, up to 8 attempts over about two hours; the delivery log in Settings shows each attempt and can resend. Use the event `id` to ignore repeats."},"webhooks":{"ping":{"post":{"operationId":"webhook_ping","summary":"A test delivery from Settings → Webhooks.","description":"Sent to your webhook URL when you subscribe to `ping`. Check the `VaultLens-Signature` header (see Webhooks above) and answer 2xx within 10 seconds.","tags":["Webhooks"],"parameters":[{"name":"VaultLens-Event","in":"header","required":true,"schema":{"const":"ping"}},{"name":"VaultLens-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"VaultLens-Signature","in":"header","required":true,"description":"`t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">`","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"id":"evt_Wm9rQ2x1c3Rlcg","type":"ping","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{}}}}},"responses":{"200":{"description":"Received (any 2xx)."}}}},"clone.completed":{"post":{"operationId":"webhook_clone_completed","summary":"A clone of an app’s tables finished.","description":"Sent to your webhook URL when you subscribe to `clone.completed`. Check the `VaultLens-Signature` header (see Webhooks above) and answer 2xx within 10 seconds.","tags":["Webhooks"],"parameters":[{"name":"VaultLens-Event","in":"header","required":true,"schema":{"const":"clone.completed"}},{"name":"VaultLens-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"VaultLens-Signature","in":"header","required":true,"description":"`t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">`","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"id":"evt_Wm9rQ2x1c3Rlcg","type":"clone.completed","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{"appId":"6b05a32b031b09796ccc7d52","jobId":"Jb3k2LxQ9"}}}}},"responses":{"200":{"description":"Received (any 2xx)."}}}},"job.failed":{"post":{"operationId":"webhook_job_failed","summary":"A clone, scheduled sync, archive run or restore failed.","description":"Sent to your webhook URL when you subscribe to `job.failed`. Check the `VaultLens-Signature` header (see Webhooks above) and answer 2xx within 10 seconds.","tags":["Webhooks"],"parameters":[{"name":"VaultLens-Event","in":"header","required":true,"schema":{"const":"job.failed"}},{"name":"VaultLens-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"VaultLens-Signature","in":"header","required":true,"description":"`t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">`","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"id":"evt_Wm9rQ2x1c3Rlcg","type":"job.failed","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{"appId":"6b05a32b031b09796ccc7d52","jobId":"Jb3k2LxQ9","jobType":"archive"}}}}},"responses":{"200":{"description":"Received (any 2xx)."}}}},"archive.run.completed":{"post":{"operationId":"webhook_archive_run_completed","summary":"An archive run finished.","description":"Sent to your webhook URL when you subscribe to `archive.run.completed`. Check the `VaultLens-Signature` header (see Webhooks above) and answer 2xx within 10 seconds.","tags":["Webhooks"],"parameters":[{"name":"VaultLens-Event","in":"header","required":true,"schema":{"const":"archive.run.completed"}},{"name":"VaultLens-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"VaultLens-Signature","in":"header","required":true,"description":"`t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">`","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"id":"evt_Wm9rQ2x1c3Rlcg","type":"archive.run.completed","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{"appId":"6b05a32b031b09796ccc7d52","jobId":"Jb3k2LxQ9"}}}}},"responses":{"200":{"description":"Received (any 2xx)."}}}},"schema.changed":{"post":{"operationId":"webhook_schema_changed","summary":"VaultLens found changes in an app’s Knack schema.","description":"Sent to your webhook URL when you subscribe to `schema.changed`. Check the `VaultLens-Signature` header (see Webhooks above) and answer 2xx within 10 seconds.","tags":["Webhooks"],"parameters":[{"name":"VaultLens-Event","in":"header","required":true,"schema":{"const":"schema.changed"}},{"name":"VaultLens-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"VaultLens-Signature","in":"header","required":true,"description":"`t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">`","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"id":"evt_Wm9rQ2x1c3Rlcg","type":"schema.changed","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{"appId":"6b05a32b031b09796ccc7d52","jobId":"Jb3k2LxQ9"}}}}},"responses":{"200":{"description":"Received (any 2xx)."}}}},"sync.unhealthy":{"post":{"operationId":"webhook_sync_unhealthy","summary":"Live sync errors piled up, or the live sync snippet went quiet.","description":"Sent to your webhook URL when you subscribe to `sync.unhealthy`. Check the `VaultLens-Signature` header (see Webhooks above) and answer 2xx within 10 seconds.","tags":["Webhooks"],"parameters":[{"name":"VaultLens-Event","in":"header","required":true,"schema":{"const":"sync.unhealthy"}},{"name":"VaultLens-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"VaultLens-Signature","in":"header","required":true,"description":"`t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">`","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"id":"evt_Wm9rQ2x1c3Rlcg","type":"sync.unhealthy","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{"appId":"6b05a32b031b09796ccc7d52","reason":"sync_errors"}}}}},"responses":{"200":{"description":"Received (any 2xx)."}}}}},"servers":[{"url":"https://api.vaultlens.studio"}],"security":[{"apiKey":[]}],"tags":[{"name":"Meta"},{"name":"Apps"},{"name":"Sync"},{"name":"Jobs"},{"name":"Archive"},{"name":"Data"}],"paths":{"/v1/openapi.json":{"get":{"operationId":"getOpenApi","summary":"This API’s OpenAPI 3.1 document","tags":["Meta"],"security":[],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","description":"An OpenAPI 3.1 document."}}}},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/me":{"get":{"operationId":"getMe","summary":"The key making the call: workspace, scopes, apps and rate limit","description":"Scope: `read`.","tags":["Meta"],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["workspace","key","plan","rateLimitPerMinute"],"properties":{"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"hipaa":{"type":"boolean"}}},"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"enum":["read","write","archive:run","data:query","phi:read"]}},"appIds":{"type":["array","null"],"items":{"type":"string"}},"expiresAt":{"type":["string","null"],"format":"date-time"}}},"plan":{"type":"object","properties":{"id":{"type":["string","null"]},"standing":{"enum":["ok","grace","locked"]},"analytics":{"type":"boolean"},"archive":{"type":"boolean"}}},"rateLimitPerMinute":{"type":"integer"}}},"example":{"workspace":{"id":"Wk7dQ2mFz9LpT4xR8bN1","name":"Acme","hipaa":false},"key":{"id":"k1","name":"Reporting","prefix":"vls_a1B2c3D4","scopes":["read"],"appIds":null,"expiresAt":null},"plan":{"id":"studio","standing":"ok","analytics":true,"archive":true},"rateLimitPerMinute":120}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps":{"get":{"operationId":"listApps","summary":"List connected Knack apps","description":"Scope: `read`.","tags":["Apps"],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"knackAppId":{"type":"string"},"timezone":{"type":["string","null"]},"connectedAt":{"type":["string","null"],"format":"date-time"},"schemaStatus":{"type":"string"},"schemaFetchedAt":{"type":["string","null"],"format":"date-time"},"objectCount":{"type":["integer","null"]},"totalRecords":{"type":["integer","null"]},"apiDailyLimit":{"type":"integer"},"knackHost":{"enum":["standard","hipaa"]},"credentialsRevoked":{"type":"boolean"}}}},"nextCursor":{"type":["string","null"]}}},"example":{"data":[{"id":"6b05a32b031b09796ccc7d52","name":"Sales CRM","knackAppId":"6b05a32b031b09796ccc7d52","timezone":"America/Denver","connectedAt":"2026-11-20T15:04:05.000Z","schemaStatus":"ready","schemaFetchedAt":"2026-12-01T09:00:00.000Z","objectCount":12,"totalRecords":48210,"apiDailyLimit":2000,"knackHost":"standard","credentialsRevoked":false}],"nextCursor":null}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}":{"get":{"operationId":"getApp","summary":"Get one app","description":"Scope: `read`.","tags":["Apps"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"knackAppId":{"type":"string"},"timezone":{"type":["string","null"]},"connectedAt":{"type":["string","null"],"format":"date-time"},"schemaStatus":{"type":"string"},"schemaFetchedAt":{"type":["string","null"],"format":"date-time"},"objectCount":{"type":["integer","null"]},"totalRecords":{"type":["integer","null"]},"apiDailyLimit":{"type":"integer"},"knackHost":{"enum":["standard","hipaa"]},"credentialsRevoked":{"type":"boolean"}}},"example":{"id":"6b05a32b031b09796ccc7d52","name":"Sales CRM","knackAppId":"6b05a32b031b09796ccc7d52","timezone":"America/Denver","connectedAt":"2026-11-20T15:04:05.000Z","schemaStatus":"ready","schemaFetchedAt":"2026-12-01T09:00:00.000Z","objectCount":12,"totalRecords":48210,"apiDailyLimit":2000,"knackHost":"standard","credentialsRevoked":false}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/schema":{"get":{"operationId":"getSchema","summary":"The app’s Knack schema: tables, fields and record counts","description":"Scope: `read`.","tags":["Apps"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"fetchedAt":{"type":["string","null"],"format":"date-time"},"objects":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"records":{"type":["integer","null"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"required":{"type":"boolean"}}}}}}}}},"example":{"fetchedAt":"2026-12-01T09:00:00.000Z","objects":[{"key":"object_1","name":"Customers","records":1200,"fields":[{"key":"field_1","name":"Name","type":"name","required":true}]}]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/workflows":{"get":{"operationId":"getWorkflows","summary":"What’s set up for the app: analytics and archive settings","description":"Scope: `read`.","tags":["Apps"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"analytics":{"type":"object","properties":{"status":{"enum":["not_set_up","setting_up","active"]},"destination":{"type":["object","null"],"properties":{"type":{"enum":["postgres_hosted","postgres_own","bigquery_hosted","bigquery_byo"]}}},"tables":{"type":"array","items":{"type":"string"}},"schedule":{"type":"string"},"lastCloneAt":{"type":["string","null"],"format":"date-time"},"lastReconcileAt":{"type":["string","null"],"format":"date-time"},"lastReconcileStatus":{"type":["string","null"]},"nextReconcileAt":{"type":["string","null"],"format":"date-time"},"liveSyncPaused":{"type":"boolean"}}},"archive":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"tables":{"type":"array","items":{"type":"object","properties":{"objectKey":{"type":"string"},"flagField":{"type":"string"},"keyField":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}}}},"afterArchive":{"enum":["delete","reset_flag"]},"schedule":{"enum":["manual","daily","weekly"]},"testMode":{"type":"boolean"},"enabled":{"type":"boolean"},"destination":{"type":["object","null"],"properties":{"type":{"type":"string"}}},"nextRunAt":{"type":["string","null"],"format":"date-time"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"lastJobId":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/sync/status":{"get":{"operationId":"getSyncStatus","summary":"Live sync health, dead letters and today’s Knack API budget","description":"Scope: `read`.","tags":["Sync"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"liveSync":{"type":"object","properties":{"installed":{"type":"boolean"},"paused":{"type":"boolean"},"lastHeartbeatAt":{"type":["string","null"],"format":"date-time"},"lastEventAt":{"type":["string","null"],"format":"date-time"},"today":{"type":"object","properties":{"events":{"type":"integer"},"failed":{"type":"integer"},"averageLagMs":{"type":["integer","null"]}}}}},"deadLetters":{"type":"integer"},"quarantined":{"type":"integer"},"lastReconcileAt":{"type":["string","null"],"format":"date-time"},"lastReconcileStatus":{"type":["string","null"]},"apiBudget":{"type":"object","properties":{"limit":{"type":"integer"},"used":{"type":"integer"},"left":{"type":"integer"},"knackRemaining":{"type":["integer","null"]},"resetAt":{"type":"string","format":"date-time"}}}}},"example":{"liveSync":{"installed":true,"paused":false,"lastHeartbeatAt":"2026-12-01T16:55:00.000Z","lastEventAt":"2026-12-01T16:58:12.000Z","today":{"events":312,"failed":0,"averageLagMs":2400}},"deadLetters":0,"quarantined":0,"lastReconcileAt":"2026-12-01T07:00:00.000Z","lastReconcileStatus":"ok","apiBudget":{"limit":2000,"used":340,"left":1560,"knackRemaining":4100,"resetAt":"2026-12-02T00:00:00.000Z"}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/clone":{"post":{"operationId":"startClone","summary":"Copy the app’s selected tables into the analytics destination","description":"Starts a clone job (the first copy, or tables added later). Uses the app’s Knack API budget; the first clone needs the live sync snippet installed.\n\nScope: `write`.","tags":["Sync"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Repeat a POST safely: the same key returns the first response for 24 hours.","schema":{"type":"string","maxLength":200}}],"responses":{"202":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["jobId"],"properties":{"jobId":{"type":"string"}}},"example":{"jobId":"Jb3k2LxQ9"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/reconcile":{"post":{"operationId":"startReconcile","summary":"Run a sync now (catch up changes since the last one)","description":"Scope: `write`.","tags":["Sync"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Repeat a POST safely: the same key returns the first response for 24 hours.","schema":{"type":"string","maxLength":200}}],"responses":{"202":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["jobId"],"properties":{"jobId":{"type":"string"}}},"example":{"jobId":"Jb3k2LxQ9"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/sync:pause":{"post":{"operationId":"pauseLiveSync","summary":"Pause live sync (changes are held and applied on resume)","description":"Scope: `write`.","tags":["Sync"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Repeat a POST safely: the same key returns the first response for 24 hours.","schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"paused":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/sync:resume":{"post":{"operationId":"resumeLiveSync","summary":"Resume live sync and apply the held changes","description":"Scope: `write`.","tags":["Sync"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Repeat a POST safely: the same key returns the first response for 24 hours.","schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"paused":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/jobs":{"get":{"operationId":"listJobs","summary":"List jobs (syncs, archive runs, restores), newest first","description":"Scope: `read`.","tags":["Jobs"],"parameters":[{"name":"appId","in":"query","required":false,"description":"Only this app’s jobs.","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"Only jobs of this type.","schema":{"enum":["clone","reconcile","reclone","schema_check","archive","restore"]}},{"name":"limit","in":"query","required":false,"description":"Page size.","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","required":false,"description":"From the previous page’s `nextCursor`.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"appId":{"type":["string","null"]},"type":{"enum":["clone","reconcile","reclone","schema_check","archive","restore"]},"state":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"apiCalls":{"type":"integer"},"summary":{"type":["string","null"]},"error":{"type":["string","null"]},"progress":{"type":["object","null"],"properties":{"tables":{"type":"integer"},"tablesDone":{"type":"integer"},"rowsDone":{"type":"integer"},"totalRecords":{"type":["integer","null"]}}},"archive":{"type":["object","null"],"properties":{"configId":{"type":"string"},"testMode":{"type":"boolean"},"afterArchive":{"type":"string"},"selected":{"type":"integer"},"archived":{"type":"integer"},"removed":{"type":"integer"},"files":{"type":"integer"}}},"restore":{"type":["object","null"],"properties":{"archiveJobId":{"type":["string","null"]},"restored":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}}}}}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/jobs/{jobId}":{"get":{"operationId":"getJob","summary":"Get one job and its progress","description":"Scope: `read`.","tags":["Jobs"],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"appId":{"type":["string","null"]},"type":{"enum":["clone","reconcile","reclone","schema_check","archive","restore"]},"state":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"apiCalls":{"type":"integer"},"summary":{"type":["string","null"]},"error":{"type":["string","null"]},"progress":{"type":["object","null"],"properties":{"tables":{"type":"integer"},"tablesDone":{"type":"integer"},"rowsDone":{"type":"integer"},"totalRecords":{"type":["integer","null"]}}},"archive":{"type":["object","null"],"properties":{"configId":{"type":"string"},"testMode":{"type":"boolean"},"afterArchive":{"type":"string"},"selected":{"type":"integer"},"archived":{"type":"integer"},"removed":{"type":"integer"},"files":{"type":"integer"}}},"restore":{"type":["object","null"],"properties":{"archiveJobId":{"type":["string","null"]},"restored":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}}}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/archive-configs":{"get":{"operationId":"listArchiveConfigs","summary":"List the app’s archive settings","description":"Scope: `read`.","tags":["Archive"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"tables":{"type":"array","items":{"type":"object","properties":{"objectKey":{"type":"string"},"flagField":{"type":"string"},"keyField":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}}}},"afterArchive":{"enum":["delete","reset_flag"]},"schedule":{"enum":["manual","daily","weekly"]},"testMode":{"type":"boolean"},"enabled":{"type":"boolean"},"destination":{"type":["object","null"],"properties":{"type":{"type":"string"}}},"nextRunAt":{"type":["string","null"],"format":"date-time"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"lastJobId":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}},"post":{"operationId":"createArchiveConfig","summary":"Create an archive setting","description":"Validated like the app’s wizard: the flag must be a Yes/No field and the key a suitable field.\n\nScope: `write`.","tags":["Archive"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Repeat a POST safely: the same key returns the first response for 24 hours.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"tables":{"type":"array","items":{"type":"object","required":["objectKey","keyField","flagField"],"properties":{"objectKey":{"type":"string","pattern":"^object_\\d+$"},"keyField":{"type":"string","pattern":"^(field_\\d+|id)$","description":"A text, number, auto-increment or email field, or `id` for the Knack record ID."},"flagField":{"type":"string","pattern":"^field_\\d+$","description":"A Yes/No field."},"fields":{"type":"array","items":{"type":"string"},"description":"Fields to include; empty = all."}}},"minItems":1},"afterArchive":{"enum":["delete","reset_flag"]},"schedule":{"enum":["manual","daily","weekly"]},"testMode":{"type":"boolean","description":"Write files but change nothing in Knack."},"enabled":{"type":"boolean"},"confirmDeletion":{"type":"boolean","description":"Required the first time `afterArchive` is `delete` outside test mode."},"acknowledgeFiles":{"type":"boolean","description":"Required when a table has file or image fields."},"destination":{"type":["object","null"],"required":["type"],"description":"Where files go. `knack` needs `runsObject`; buckets and drives are set up in the app first (their saved credentials are referenced by `secretRef`).","properties":{"type":{"enum":["knack","gcs","s3","azure","gdrive","onedrive"]}}}},"required":["tables","afterArchive","schedule","testMode"]}}}},"responses":{"201":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"tables":{"type":"array","items":{"type":"object","properties":{"objectKey":{"type":"string"},"flagField":{"type":"string"},"keyField":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}}}},"afterArchive":{"enum":["delete","reset_flag"]},"schedule":{"enum":["manual","daily","weekly"]},"testMode":{"type":"boolean"},"enabled":{"type":"boolean"},"destination":{"type":["object","null"],"properties":{"type":{"type":"string"}}},"nextRunAt":{"type":["string","null"],"format":"date-time"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"lastJobId":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/archive-configs/{configId}":{"get":{"operationId":"getArchiveConfig","summary":"Get one archive setting","description":"Scope: `read`.","tags":["Archive"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"configId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"tables":{"type":"array","items":{"type":"object","properties":{"objectKey":{"type":"string"},"flagField":{"type":"string"},"keyField":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}}}},"afterArchive":{"enum":["delete","reset_flag"]},"schedule":{"enum":["manual","daily","weekly"]},"testMode":{"type":"boolean"},"enabled":{"type":"boolean"},"destination":{"type":["object","null"],"properties":{"type":{"type":"string"}}},"nextRunAt":{"type":["string","null"],"format":"date-time"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"lastJobId":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}},"patch":{"operationId":"updateArchiveConfig","summary":"Change an archive setting (fields you leave out keep their values)","description":"Scope: `write`.","tags":["Archive"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"configId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"tables":{"type":"array","items":{"type":"object","required":["objectKey","keyField","flagField"],"properties":{"objectKey":{"type":"string","pattern":"^object_\\d+$"},"keyField":{"type":"string","pattern":"^(field_\\d+|id)$","description":"A text, number, auto-increment or email field, or `id` for the Knack record ID."},"flagField":{"type":"string","pattern":"^field_\\d+$","description":"A Yes/No field."},"fields":{"type":"array","items":{"type":"string"},"description":"Fields to include; empty = all."}}},"minItems":1},"afterArchive":{"enum":["delete","reset_flag"]},"schedule":{"enum":["manual","daily","weekly"]},"testMode":{"type":"boolean","description":"Write files but change nothing in Knack."},"enabled":{"type":"boolean"},"confirmDeletion":{"type":"boolean","description":"Required the first time `afterArchive` is `delete` outside test mode."},"acknowledgeFiles":{"type":"boolean","description":"Required when a table has file or image fields."},"destination":{"type":["object","null"],"required":["type"],"description":"Where files go. `knack` needs `runsObject`; buckets and drives are set up in the app first (their saved credentials are referenced by `secretRef`).","properties":{"type":{"enum":["knack","gcs","s3","azure","gdrive","onedrive"]}}}}}}}},"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"tables":{"type":"array","items":{"type":"object","properties":{"objectKey":{"type":"string"},"flagField":{"type":"string"},"keyField":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}}}}},"afterArchive":{"enum":["delete","reset_flag"]},"schedule":{"enum":["manual","daily","weekly"]},"testMode":{"type":"boolean"},"enabled":{"type":"boolean"},"destination":{"type":["object","null"],"properties":{"type":{"type":"string"}}},"nextRunAt":{"type":["string","null"],"format":"date-time"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"lastJobId":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}},"delete":{"operationId":"deleteArchiveConfig","summary":"Delete an archive setting (runs and their files are kept)","description":"Scope: `write`.","tags":["Archive"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"configId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/archive-configs/{configId}/run":{"post":{"operationId":"runArchive","summary":"Run an archive setting now, or see what a run would do (`dryRun`)","description":"`dryRun: true` starts nothing and returns the flagged records and Knack API calls a run would use. A real run of a setting that removes records from Knack (not in test mode) needs the `archive:run` scope; test-mode runs only need `write`.\n\nScope: `write`.","tags":["Archive"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"configId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Repeat a POST safely: the same key returns the first response for 24 hours.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dryRun":{"type":"boolean","default":false}}}}}},"responses":{"202":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["jobId"],"properties":{"jobId":{"type":"string"}}},{"type":"object","description":"What a run of this setting would do, from today’s flagged records. Nothing is started.","properties":{"dryRun":{"const":true},"flagged":{"type":"integer"},"calls":{"type":"integer","description":"Knack API calls the run would use."},"outlook":{"type":"object","description":"Today’s Knack API budget for archive."}}}]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/archive-runs":{"get":{"operationId":"listArchiveRuns","summary":"List archive runs, newest first","description":"Scope: `read`.","tags":["Archive"],"parameters":[{"name":"appId","in":"query","required":false,"description":"Only this app’s runs.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size.","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","required":false,"description":"From the previous page’s `nextCursor`.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"appId":{"type":["string","null"]},"type":{"enum":["clone","reconcile","reclone","schema_check","archive","restore"]},"state":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"apiCalls":{"type":"integer"},"summary":{"type":["string","null"]},"error":{"type":["string","null"]},"progress":{"type":["object","null"],"properties":{"tables":{"type":"integer"},"tablesDone":{"type":"integer"},"rowsDone":{"type":"integer"},"totalRecords":{"type":["integer","null"]}}},"archive":{"type":["object","null"],"properties":{"configId":{"type":"string"},"testMode":{"type":"boolean"},"afterArchive":{"type":"string"},"selected":{"type":"integer"},"archived":{"type":"integer"},"removed":{"type":"integer"},"files":{"type":"integer"}}},"restore":{"type":["object","null"],"properties":{"archiveJobId":{"type":["string","null"]},"restored":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}}}}}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/archive-runs/{runId}":{"get":{"operationId":"getArchiveRun","summary":"Get an archive run and its files","description":"Scope: `read`.","tags":["Archive"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"appId":{"type":["string","null"]},"type":{"enum":["clone","reconcile","reclone","schema_check","archive","restore"]},"state":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"apiCalls":{"type":"integer"},"summary":{"type":["string","null"]},"error":{"type":["string","null"]},"progress":{"type":["object","null"],"properties":{"tables":{"type":"integer"},"tablesDone":{"type":"integer"},"rowsDone":{"type":"integer"},"totalRecords":{"type":["integer","null"]}}},"archive":{"type":["object","null"],"properties":{"configId":{"type":"string"},"testMode":{"type":"boolean"},"afterArchive":{"type":"string"},"selected":{"type":"integer"},"archived":{"type":"integer"},"removed":{"type":"integer"},"files":{"type":"integer"}}},"restore":{"type":["object","null"],"properties":{"archiveJobId":{"type":["string","null"]},"restored":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}}},"files":{"type":"array","items":{"type":"object","properties":{"fileId":{"type":"string"},"objectKey":{"type":["string","null"]},"rows":{"type":"integer"},"sha256":{"type":"string"},"location":{"type":"string"},"format":{"type":["string","null"]},"downloadable":{"type":"boolean","description":"False for bucket destinations (VaultLens can only write there)."}}}}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/archive-runs/{runId}/files/{fileId}/download":{"get":{"operationId":"downloadArchiveFile","summary":"Download one archive file as CSV","description":"Fetched from where the run wrote it (Knack or your drive) and checked against the run’s SHA-256 (sent as `X-Content-SHA256`). Files in your own bucket can’t be read by VaultLens: get those from the bucket. Audited.\n\nScope: `data:query` (HIPAA workspaces also `phi:read`).","tags":["Archive"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string"}},{"name":"fileId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"string","description":"The CSV (`text/csv`)."}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/archive/lookup":{"get":{"operationId":"lookupArchivedRecord","summary":"Find which run and file an archived record went to, and whether it was restored","description":"By archive key (exact match; case and surrounding spaces ignored) or Knack record ID.\n\nScope: `read` (HIPAA workspaces also `phi:read`).","tags":["Archive"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"key","in":"query","required":true,"description":"Archive key value or Knack record ID.","schema":{"type":"string","minLength":1,"maxLength":500}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","properties":{"matches":{"type":"array","items":{"type":"object","properties":{"jobId":{"type":"string"},"recordId":{"type":"string"},"objectKey":{"type":"string"},"tableName":{"type":["string","null"]},"runAt":{"type":["string","null"],"format":"date-time"},"settingName":{"type":["string","null"]},"testMode":{"type":"boolean"},"file":{"type":["string","null"]},"restored":{"type":["object","null"],"properties":{"at":{"type":["string","null"],"format":"date-time"},"newId":{"type":"string"},"restoreJobId":{"type":"string"}}}}}}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/apps/{appId}/tables/{table}/records":{"get":{"operationId":"queryRecords","summary":"Read records from the analytics copy, with filters, sorting and pages","description":"Reads your Postgres or BigQuery copy, not Knack, so it uses none of your Knack API budget. `table` is the Knack object key (e.g. `object_1`; see the schema endpoint). Columns are the copy’s column names, listed in `columns` with the Knack field each came from. Pass `updatedSince` to get rows VaultLens wrote since then, oldest first: keep the last row’s `_synced_at` for next time. Every call is audited.\n\nScope: `data:query` (HIPAA workspaces also `phi:read`).","tags":["Data"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"table","in":"path","required":true,"schema":{"type":"string"}},{"name":"filter","in":"query","required":false,"description":"JSON array of conditions, ANDed: `[{\"column\":\"status\",\"op\":\"eq\",\"value\":\"Open\"}]`. Ops: eq, ne, gt, gte, lt, lte, contains (case-insensitive), is_null, not_null.","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"A column, `-column` for descending. Default `id`. Ignored with `updatedSince`.","schema":{"type":"string"}},{"name":"updatedSince","in":"query","required":false,"description":"Only rows VaultLens wrote at or after this time.","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","required":false,"description":"Rows per page (at most 1000).","schema":{"type":"integer","minimum":1,"maximum":1000,"default":100}},{"name":"cursor","in":"query","required":false,"description":"From the previous page’s `nextCursor`.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["table","columns","data","nextCursor"],"properties":{"table":{"type":"string","description":"The table’s name in your copy."},"columns":{"type":"array","items":{"type":"object","properties":{"column":{"type":"string"},"type":{"type":"string"},"fieldKey":{"type":["string","null"]},"fieldName":{"type":["string","null"]},"fieldType":{"type":["string","null"]}}}},"data":{"type":"array","items":{"type":"object","description":"Column → value, plus `_synced_at` and `_archived_at`."}},"nextCursor":{"type":["string","null"]}}},"example":{"table":"customers","columns":[{"column":"id","type":"text","fieldKey":null,"fieldName":"Record ID","fieldType":"id"},{"column":"name","type":"text","fieldKey":"field_1","fieldName":"Name","fieldType":"name"}],"data":[{"id":"5f1c0e…","name":"Ada Lovelace","_synced_at":"2026-12-01T16:58:12.000Z","_archived_at":null}],"nextCursor":null}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"vls_<id>_<secret>","description":"An API key from Settings → API keys."}},"headers":{"RequestId":{"description":"Quote this when contacting support.","schema":{"type":"string"}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","requestId"],"properties":{"code":{"type":"string","examples":["PERMISSION_DENIED"]},"message":{"type":"string"},"requestId":{"type":"string","examples":["req_Q2x1c3RlcjE2Ynl0ZXM"]}}}}},"WebhookPayload":{"type":"object","required":["id","type","createdAt","workspaceId","data"],"properties":{"id":{"type":"string","description":"Event id; the same on retries and resends."},"type":{"enum":["ping","clone.completed","job.failed","archive.run.completed","schema.changed","sync.unhealthy"]},"createdAt":{"type":"string","format":"date-time"},"workspaceId":{"type":"string"},"data":{"type":"object","description":"Ids only, never record values.","properties":{"appId":{"type":["string","null"]},"jobId":{"type":["string","null"]},"jobType":{"enum":["clone","reconcile","archive","restore",null]},"reason":{"enum":["sync_errors","snippet_silent",null]}}}}}},"responses":{"E400":{"description":"The request isn’t valid (see `error.message`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E401":{"description":"No API key, or it is invalid, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E402":{"description":"The workspace’s plan doesn’t include this, or a plan limit is reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E403":{"description":"The key lacks the scope, app access or IP address for this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E409":{"description":"Conflicts with the current state (e.g. a job is already running).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E429":{"description":"Rate limited. Retry after `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}