Create a virtual view (saved query).
POST/api/v1/virtual-viewsanalytics:write
The definition is validated as a query-builder document, and the view's columns are derived from it. With foreign_data_connection_id (which needs Use Foreign Data Connections) the view runs on that foreign database and its columns are derived there, with the connection's stored credentials (422 reference_not_found when the connection does not exist). Configured document-type sources also require Configure Virtual View Datasources.
| Scope | analytics:write |
| Asynchronous | No |
| MCP tool | create_virtual_view |
| Portal permissions | create_virtual_views |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Docwize-Version | header | string (date) | Optional | |
Idempotency-Key | header | string | Optional | max 255 |
Request body
| Content type | Type |
|---|---|
application/json | VirtualViewCreateInput |
Responses
| Status | Description | Body |
|---|---|---|
201 | Success. | application/json VirtualView or object |
400 | invalid_version, malformed_json | application/problem+json Problem |
401 | token_expired, unauthenticated | application/problem+json Problem |
403 | forbidden, insufficient_scope, token_owner_inactive | application/problem+json Problem |
405 | method_not_allowed | application/problem+json Problem |
406 | not_acceptable | application/problem+json Problem |
409 | idempotency_in_progress | application/problem+json Problem |
413 | payload_too_large | application/problem+json Problem |
415 | unsupported_media_type | application/problem+json Problem |
421 | wrong_region | application/problem+json Problem |
422 | idempotency_key_reused, validation_failed | application/problem+json Problem |
500 | internal_error | application/problem+json Problem |
503 | tenant_unavailable, unavailable | application/problem+json Problem |
504 | timeout | application/problem+json Problem |
Errors
The problem codes this operation can answer with. Each code links to its page.
Schemas
UserRef
| Field | Type | Required | Description |
|---|---|---|---|
display_name | string | Required | |
kind | string: user, system, integration or string | Required | |
user_id | string or null | Required |
VirtualView
| Field | Type | Required | Description |
|---|---|---|---|
created_by | UserRef or null | Required | |
definition | object or null | Required | format query_builder: body {json_logic, builder_config, context}; null in list items. |
document_type_ids | array of string | Required | |
foreign_data_connection_id | string or null | Required | The foreign data connection the view's query runs on; null for a view on the Docwize database, and null without View Foreign Data Connections. Set when the view is created and never changed. |
name | string | Required | |
settings | object or null | Required | format query_builder_settings: the view's settings with its derived columns; null in list items. |
updated_at | string (date-time) or null | Required | |
view_type | string | Required | The view's data type (grid unless the view says otherwise). |
virtual_view_id | string | Required |
VirtualViewCreateInput
| Field | Type | Required | Description |
|---|---|---|---|
definition | object | Required | |
document_type_ids | array of string | Optional | |
foreign_data_connection_id | string or null | Optional | Run the view's query on this foreign data connection instead of the Docwize database (list_foreign_data_connections; its tables are in get_foreign_data_connection_database_schema). The columns are derived on that connection. Cannot be changed afterwards. |
name | string | Required | |
settings | object or null | Optional | |
view_type | string or null | Optional |