---
title: Query
summary: Query one or more IFC models
order: 1427
section: IFC - Industry Foundation Classes
method: POST
operation: Query
auth: true
scopes: [query:run]
schemas: [QueryRequest, ModelIdentifier, QidColors, ErrorResponse]
link-terms: true
path: /ifc/Query
---

# Query

<div class="api-path"><div class="api-path-method"><span class="pill pill-method">POST</span></div><pre><span class="host" data-api-host></span>/openapi/ifc/Query</pre></div>

Queries one or more models with BQL (BIM.works Query Language): the `query` text, or a stored query action by `action_uuid`. Running a stored query needs read rights on it, not actions:read.

`format` chooses what comes back; it wins over the Accept header, which is only read when `format` is absent
(`application/ifc`, `application/xml`, `text/csv` and the xlsx type then ask for those formats):

- `json` (the default): one record per object (or group), with one field per `GET` column. A plain query
  answers an array of records. With `compression: 1`, or a slice (`groupPath`, `groupKeys`), it answers an
  object: the records under `objects` (or `groups`), the slice it addressed, and the compact tables.
- `count`: `{count}`, the number of matching objects, without building records.
- `qids`: `{qids: {<version uuid>: [oid, …]}}`, the matching objects as the selection the viewers take. Only
  for a query whose result is plain objects (no `GROUP BY` other than the leaf of a slice, no aggregate, no
  `ORDER BY`).
- `csv` and `xlsx`: the records as a table, one column per `GET` feature.
- `ifc` and `ifcxml`: the matching objects as an IFC STEP or an ifcXML model, with what they need to be
  valid (their geometry, placement and spatial structure).

An empty `models` array validates the query instead of running it: the answer is
`{messages: [{code, severity, line, column, message}]}`, empty for a clean query, whatever the format.

## Try it {#try-it}

Edit the request and send it; it runs against this instance with your token, and the examples follow the form.

<div class="try-it" id="try-query" data-operation="Query" data-method="POST" data-path="/ifc/Query" data-content-type="application/json" data-auth="bearer" data-schema="QueryRequest" data-tag="IFC" data-scopes="query:run"><div class="try-it-bar"><div class="tabs" role="tablist"><button type="button" role="tab" class="tab active" data-try-tab="request">Request</button><button type="button" role="tab" class="tab" data-try-tab="headers">Headers</button><button type="button" role="tab" class="tab" data-try-tab="snippet" data-try-snippet-tab>curl</button></div><span class="try-it-cred" data-try-cred></span><div class="try-it-actions"><button type="button" class="btn" data-try-reset>Reset</button><button type="button" class="btn btn-primary" data-try-send>Send</button></div></div><div class="try-it-body"><div class="try-it-request"><div class="try-it-pane active" data-try-pane="request"><div class="try-it-kv"><div class="try-it-key">Authorization</div><div class="try-it-val"><code data-try-auth>Bearer &lt;auth token&gt;</code><button type="button" class="link-button try-it-paste" data-try-paste>Paste another token</button></div><div class="try-it-key">Content-Type</div><div class="try-it-val"><code>application/json</code></div></div><div class="try-it-caption"><span>Body</span><span class="try-it-valid" data-try-valid></span></div><div class="try-it-editor lesson-code"><div class="lesson-gutter" data-try-gutter>1
2
3
4
5
6
7
8
9
10</div><textarea class="lesson-input try-it-textarea" data-try-body spellcheck="false" aria-label="Request body" rows="10">{
  &quot;models&quot;: [
    {
      &quot;type&quot;: &quot;VersionModelIdentifier&quot;,
      &quot;name&quot;: &quot;My model name&quot;,
      &quot;uuid&quot;: &quot;BIM_WORKS_FIRST_MODEL&quot;
    }
  ],
  &quot;query&quot;: &quot;GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true&quot;
}</textarea></div></div><div class="try-it-pane" data-try-pane="headers"><pre class="code"><code data-try-headers>Authorization: Bearer &lt;auth token&gt;
Content-Type: application/json
Accept: application/json</code></pre></div><div class="try-it-pane" data-try-pane="snippet"><pre class="code"><code class="language-shell" data-try-snippet>curl -X POST &quot;$BIMWORKS_URL/openapi/ifc/Query&quot; \
  -H &quot;Authorization: Bearer $BIMWORKS_TOKEN&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d '{
  &quot;models&quot;: [
    {
      &quot;type&quot;: &quot;VersionModelIdentifier&quot;,
      &quot;name&quot;: &quot;My model name&quot;,
      &quot;uuid&quot;: &quot;BIM_WORKS_FIRST_MODEL&quot;
    }
  ],
  &quot;query&quot;: &quot;GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true&quot;
}'</code></pre></div></div><div class="try-it-response"><div class="try-it-status"><span class="pill-status" data-try-status hidden></span><span class="try-it-meta" data-try-meta>Send to see the response</span><span class="try-it-spacer"></span><div class="tabs try-it-rtabs" data-try-rtabs hidden><button type="button" class="tab active" data-try-rtab="body">Body</button><button type="button" class="tab" data-try-rtab="headers">Headers</button></div><a class="try-it-download" data-try-download hidden download>Download</a></div><pre class="code try-it-out" data-try-out></pre></div></div><script type="application/json" data-try-sdk>{"java":{"program":"import nl.bimbase.bimworks.sdk.api.AuthApi;\nimport nl.bimbase.bimworks.sdk.api.IfcApi;\nimport nl.bimbase.bimworks.sdk.client.ApiClient;\nimport nl.bimbase.bimworks.sdk.model.Auth;\nimport nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;\nimport nl.bimbase.bimworks.sdk.model.QueryRequest;\n\npublic class Example {\n    public static void main(String[] args) throws Exception {\n        // 1. Connect to BIM.works and log in with your API token\n        ApiClient client = new ApiClient();\n        client.updateBaseUri(\"BIM_WORKS_ADDRESS/openapi\");\n        Auth auth = new AuthApi(client)\n                .loginWithApiToken(new LoginWithApiTokenRequest().token(\"BIM_WORKS_API_TOKEN\"))\n                .getAuth();\n        client.setRequestInterceptor(builder -> builder.setHeader(\"Authorization\", \"Bearer \" + auth.getBase64()));\n\n        // 2. The request\n        QueryRequest request = client.getObjectMapper().readValue(\"\"\"\n                {\n                  \"models\": [\n                    {\n                      \"type\": \"VersionModelIdentifier\",\n                      \"name\": \"My model name\",\n                      \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n                    }\n                  ],\n                  \"query\": \"GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true\"\n                }\n                \"\"\", QueryRequest.class);\n\n        // 3. The call\n        var result = new IfcApi(client).query(request);\n\n        // 4. The result\n        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));\n    }\n}","template":"import nl.bimbase.bimworks.sdk.api.AuthApi;\nimport nl.bimbase.bimworks.sdk.api.IfcApi;\nimport nl.bimbase.bimworks.sdk.client.ApiClient;\nimport nl.bimbase.bimworks.sdk.model.Auth;\nimport nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;\nimport nl.bimbase.bimworks.sdk.model.QueryRequest;\n\npublic class Example {\n    public static void main(String[] args) throws Exception {\n        // 1. Connect to BIM.works and log in with your API token\n        ApiClient client = new ApiClient();\n        client.updateBaseUri(\"BIM_WORKS_ADDRESS/openapi\");\n        Auth auth = new AuthApi(client)\n                .loginWithApiToken(new LoginWithApiTokenRequest().token(\"BIM_WORKS_API_TOKEN\"))\n                .getAuth();\n        client.setRequestInterceptor(builder -> builder.setHeader(\"Authorization\", \"Bearer \" + auth.getBase64()));\n\n        // 2. The request\n        QueryRequest request = client.getObjectMapper().readValue(\"\"\"\n                @@BODY@@\n                \"\"\", QueryRequest.class);\n\n        // 3. The call\n        var result = new IfcApi(client).query(request);\n\n        // 4. The result\n        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));\n    }\n}","escape":"backslash"},"csharp":{"program":"using System.Text.Json;\nusing BIMworks.Sdk.Api;\nusing BIMworks.Sdk.Client;\nusing BIMworks.Sdk.Extensions;\nusing BIMworks.Sdk.Model;\nusing Microsoft.Extensions.DependencyInjection;\n\n// 1. Connect to BIM.works and log in with your API token\nIServiceProvider Connect(string bearer)\n{\n    var services = new ServiceCollection();\n    services.AddApi(options =>\n    {\n        options.AddTokens(new BearerToken(bearer));\n        options.AddApiHttpClients(http =>\n        {\n            http.BaseAddress = new Uri(\"BIM_WORKS_ADDRESS\" + \"/openapi\");\n            http.Timeout = Timeout.InfiniteTimeSpan;\n        });\n    });\n    return services.BuildServiceProvider();\n}\nvar login = await Connect(\"\").GetRequiredService<IAuthApi>().LoginWithApiTokenAsync(new LoginWithApiTokenRequest(\"BIM_WORKS_API_TOKEN\"));\nvar auth = login.Ok()?.Auth ?? throw new HttpRequestException(login.RawContent, null, login.StatusCode);\nvar client = Connect(auth.Base64);\nvar json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;\n\n// 2. The request\nvar request = JsonSerializer.Deserialize<QueryRequest>(\"\"\"\n    {\n      \"models\": [\n        {\n          \"type\": \"VersionModelIdentifier\",\n          \"name\": \"My model name\",\n          \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n        }\n      ],\n      \"query\": \"GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true\"\n    }\n    \"\"\", json);\n\n// 3. The call\nvar response = await client.GetRequiredService<IIFCApi>().QueryAsync(request);\n\n// 4. The result\nvar result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);\nConsole.WriteLine(JsonSerializer.Serialize(result, json));","template":"using System.Text.Json;\nusing BIMworks.Sdk.Api;\nusing BIMworks.Sdk.Client;\nusing BIMworks.Sdk.Extensions;\nusing BIMworks.Sdk.Model;\nusing Microsoft.Extensions.DependencyInjection;\n\n// 1. Connect to BIM.works and log in with your API token\nIServiceProvider Connect(string bearer)\n{\n    var services = new ServiceCollection();\n    services.AddApi(options =>\n    {\n        options.AddTokens(new BearerToken(bearer));\n        options.AddApiHttpClients(http =>\n        {\n            http.BaseAddress = new Uri(\"BIM_WORKS_ADDRESS\" + \"/openapi\");\n            http.Timeout = Timeout.InfiniteTimeSpan;\n        });\n    });\n    return services.BuildServiceProvider();\n}\nvar login = await Connect(\"\").GetRequiredService<IAuthApi>().LoginWithApiTokenAsync(new LoginWithApiTokenRequest(\"BIM_WORKS_API_TOKEN\"));\nvar auth = login.Ok()?.Auth ?? throw new HttpRequestException(login.RawContent, null, login.StatusCode);\nvar client = Connect(auth.Base64);\nvar json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;\n\n// 2. The request\nvar request = JsonSerializer.Deserialize<QueryRequest>(\"\"\"\n    @@BODY@@\n    \"\"\", json);\n\n// 3. The call\nvar response = await client.GetRequiredService<IIFCApi>().QueryAsync(request);\n\n// 4. The result\nvar result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);\nConsole.WriteLine(JsonSerializer.Serialize(result, json));","escape":"none"},"typescript":{"program":"import { AuthApi, Configuration, IFCApi, QueryRequestFromJSON } from \"@bimworks/sdk\";\n\n// 1. Connect to BIM.works and log in with your API token\nconst basePath = \"BIM_WORKS_ADDRESS/openapi\";\nconst auth = await new AuthApi(new Configuration({ basePath }))\n  .loginWithApiToken({ loginWithApiTokenRequest: { token: \"BIM_WORKS_API_TOKEN\" } });\nconst client = new Configuration({ basePath, accessToken: typeof auth === \"string\" ? auth : auth.base64 });\n\n// 2. The request\nconst request = QueryRequestFromJSON({\n  \"models\": [\n    {\n      \"type\": \"VersionModelIdentifier\",\n      \"name\": \"My model name\",\n      \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n    }\n  ],\n  \"query\": \"GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true\"\n});\n\n// 3. The call\nconst result = await new IFCApi(client).query({ queryRequest: request });\n\n// 4. The result\nconsole.log(JSON.stringify(result, null, 2));","template":"import { AuthApi, Configuration, IFCApi, QueryRequestFromJSON } from \"@bimworks/sdk\";\n\n// 1. Connect to BIM.works and log in with your API token\nconst basePath = \"BIM_WORKS_ADDRESS/openapi\";\nconst auth = await new AuthApi(new Configuration({ basePath }))\n  .loginWithApiToken({ loginWithApiTokenRequest: { token: \"BIM_WORKS_API_TOKEN\" } });\nconst client = new Configuration({ basePath, accessToken: typeof auth === \"string\" ? auth : auth.base64 });\n\n// 2. The request\nconst request = QueryRequestFromJSON(@@BODY@@);\n\n// 3. The call\nconst result = await new IFCApi(client).query({ queryRequest: request });\n\n// 4. The result\nconsole.log(JSON.stringify(result, null, 2));","escape":"none"},"php":{"program":"<?php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse BIMworks\\Api\\AuthApi;\nuse BIMworks\\Api\\IFCApi;\nuse BIMworks\\Configuration;\nuse BIMworks\\Model\\LoginWithApiTokenRequest;\nuse BIMworks\\Model\\QueryRequest;\nuse BIMworks\\ObjectSerializer;\n\n// 1. Connect to BIM.works and log in with your API token\n$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');\n$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));\n$client->setAccessToken($auth->getBase64());\n\n// 2. The request\n$request = ObjectSerializer::deserialize(<<<'JSON'\n{\n  \"models\": [\n    {\n      \"type\": \"VersionModelIdentifier\",\n      \"name\": \"My model name\",\n      \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n    }\n  ],\n  \"query\": \"GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true\"\n}\nJSON, QueryRequest::class);\n\n// 3. The call\n$result = (new IFCApi(config: $client))->query($request);\n\n// 4. The result\necho json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;","template":"<?php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse BIMworks\\Api\\AuthApi;\nuse BIMworks\\Api\\IFCApi;\nuse BIMworks\\Configuration;\nuse BIMworks\\Model\\LoginWithApiTokenRequest;\nuse BIMworks\\Model\\QueryRequest;\nuse BIMworks\\ObjectSerializer;\n\n// 1. Connect to BIM.works and log in with your API token\n$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');\n$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));\n$client->setAccessToken($auth->getBase64());\n\n// 2. The request\n$request = ObjectSerializer::deserialize(<<<'JSON'\n@@BODY@@\nJSON, QueryRequest::class);\n\n// 3. The call\n$result = (new IFCApi(config: $client))->query($request);\n\n// 4. The result\necho json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;","escape":"none"},"python":{"program":"import json\n\nimport bimworks\n\n# 1. Connect to BIM.works and log in with your API token\nclient = bimworks.ApiClient(bimworks.Configuration(host=\"BIM_WORKS_ADDRESS/openapi\"))\nauth = bimworks.AuthApi(client).login_with_api_token(\n    bimworks.LoginWithApiTokenRequest(token=\"BIM_WORKS_API_TOKEN\"))\nclient.configuration.access_token = auth.actual_instance.var_base64\n\n# 2. The request\nrequest = bimworks.QueryRequest.from_json(r\"\"\"\n{\n  \"models\": [\n    {\n      \"type\": \"VersionModelIdentifier\",\n      \"name\": \"My model name\",\n      \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n    }\n  ],\n  \"query\": \"GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true\"\n}\n\"\"\")\n\n# 3. The call\nresult = bimworks.IFCApi(client).query(request)\n\n# 4. The result\nprint(json.dumps(client.sanitize_for_serialization(result), indent=2))","template":"import json\n\nimport bimworks\n\n# 1. Connect to BIM.works and log in with your API token\nclient = bimworks.ApiClient(bimworks.Configuration(host=\"BIM_WORKS_ADDRESS/openapi\"))\nauth = bimworks.AuthApi(client).login_with_api_token(\n    bimworks.LoginWithApiTokenRequest(token=\"BIM_WORKS_API_TOKEN\"))\nclient.configuration.access_token = auth.actual_instance.var_base64\n\n# 2. The request\nrequest = bimworks.QueryRequest.from_json(r\"\"\"\n@@BODY@@\n\"\"\")\n\n# 3. The call\nresult = bimworks.IFCApi(client).query(request)\n\n# 4. The result\nprint(json.dumps(client.sanitize_for_serialization(result), indent=2))","escape":"none"}}</script></div>

## Examples {#examples}

<div class="examples" data-examples="try-query"><div class="examples-bar"><span class="examples-lang" data-ex-lang>curl</span><span class="examples-note" data-ex-note>shell</span><button type="button" class="link-button" data-ex-change>Change language</button><button type="button" class="code-copy" data-ex-copy title="Copy">Copy</button></div><pre class="code"><code class="language-shell" data-ex-code>curl -X POST &quot;$BIMWORKS_URL/openapi/ifc/Query&quot; \
  -H &quot;Authorization: Bearer $BIMWORKS_TOKEN&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d '{
  &quot;models&quot;: [
    {
      &quot;type&quot;: &quot;VersionModelIdentifier&quot;,
      &quot;name&quot;: &quot;My model name&quot;,
      &quot;uuid&quot;: &quot;BIM_WORKS_FIRST_MODEL&quot;
    }
  ],
  &quot;query&quot;: &quot;GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true&quot;
}'</code></pre></div>

The examples are complete programs in the [[page:reference/sdk#openapi|OpenAPI SDKs]], all in the same four steps. The method in each SDK's reference: [[page:reference/sdk/java/ifcapi#query|Java]] · [[page:reference/sdk/dotnet/ifcapi#query|.NET]] · [[page:reference/sdk/typescript/ifcapi#query|TypeScript]] · [[page:reference/sdk/php/ifcapi#query|PHP]] · [[page:reference/sdk/python/ifcapi#query|Python]].

## Request body {#request-body}

[[page:api/schemas#QueryRequest|QueryRequest]] · `application/json`

<table class="dense">
<thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr id="field-models"><td><code>models</code></td><td>array of [[page:api/schemas#ModelIdentifier|ModelIdentifier]]<span class="opt">optional</span></td><td>Models to query, by Version or Node identifier (a Node stands for its latest Version). An empty model set validates the query instead</td></tr>
<tr id="field-query"><td><code>query</code></td><td><code>string</code><span class="opt">optional</span></td><td>The query, in BQL. Pass either <code>query</code> or <code>action_uuid</code></td></tr>
<tr id="field-action-uuid"><td><code>action_uuid</code></td><td><code>uuid</code><span class="opt">optional</span></td><td>A stored query (BQL) action to run instead of <code>query</code></td></tr>
<tr id="field-action-version"><td><code>action_version</code></td><td><code>integer</code><span class="opt">optional</span></td><td>The version of the stored action to run; its current version when absent</td></tr>
<tr id="field-format"><td><code>format</code></td><td><code>string</code><span class="opt">optional</span></td><td>Absent, the Accept header decides, and json when it names none of these. <code>json</code>: the records (<code>application/json</code>); <code>count</code>: <code>{count}</code> (<code>application/json</code>); <code>qids</code>: <code>{qids: {version uuid: [oid]}}</code> (<code>application/json</code>); <code>csv</code>: the records as a table (<code>text/csv</code>); <code>xlsx</code>: the same as a spreadsheet; <code>ifc</code>: the matching objects as IFC STEP (<code>application/ifc</code>); <code>ifcxml</code>: the same as ifcXML (<code>application/xml</code>). The IFC formats are a download of model content and also need the model:read scope One of <code>json</code>, <code>count</code>, <code>qids</code>, <code>csv</code>, <code>xlsx</code>, <code>ifc</code>, <code>ifcxml</code>.</td></tr>
<tr id="field-parameters"><td><code>parameters</code></td><td><code>object</code><span class="opt">optional</span></td><td>Values for the <code>$name</code> parameters of the query, by name. Every parameter of the query then needs a value. Not for formats ifc and ifcxml</td></tr>
<tr id="field-virtual-features"><td><code>virtual_features</code></td><td><code>object</code><span class="opt">optional</span></td><td>The virtual features to apply (formats json, count, qids, csv and xlsx): <code>&quot;enabled&quot;</code> (the enabled definitions of the workspace the call works in: your default workspace, or the published workspace of a visitor), <code>&quot;none&quot;</code> (the default), an array of definition uuids, or an object <code>{apply, include, exclude}</code></td></tr>
<tr id="field-force-get-qid"><td><code>force_get_qid</code></td><td><code>boolean</code><span class="opt">optional</span></td><td>Format json; add the <code>qid</code> of each object to its record, also when the query does not <code>GET</code> it Default <code>false</code>.</td></tr>
<tr id="field-columns"><td><code>columns</code></td><td><code>boolean</code><span class="opt">optional</span></td><td>Format json; answer an object instead of the bare array of a plain query: the records under <code>objects</code> and the columns table under <code>columns</code>, one entry per <code>GET</code> item with its alias, its text and where its value is in a record (QueryColumn). A compact (<code>compression: 1</code>) or sliced answer is an object already and always carries <code>columns</code> Default <code>false</code>.</td></tr>
<tr id="field-alias-keys"><td><code>alias_keys</code></td><td><code>boolean</code><span class="opt">optional</span></td><td>Format json; put values under their <code>AS</code> aliases, as before 3.0: an aliased attribute, property, quantity, calculated value, relation or model field is written at a root key named after its alias, and an aliased computed column (aggregate, arithmetic, shape, ...) under its alias. By default an alias only names its column (see <code>columns</code>) and every value stays where it is without one. For clients written against the old placement; read values through <code>columns</code> instead Default <code>false</code>.</td></tr>
<tr id="field-filename"><td><code>filename</code></td><td><code>string</code><span class="opt">optional</span></td><td>The file name of the Content-Disposition, for the formats csv, xlsx, ifc and ifcxml</td></tr>
<tr id="field-colors"><td><code>colors</code></td><td>[[page:api/schemas#QidColors|QidColors]]<span class="opt">optional</span></td><td>Formats ifc and ifcxml; the objects' colours, written as IfcStyledItems</td></tr>
<tr id="field-bvl"><td><code>bvl</code></td><td><code>string</code><span class="opt">optional</span></td><td>Formats ifc and ifcxml, instead of colors; a BVL text: the export keeps the selected objects it shows (begin it with <code>SHOW;</code> to keep them all) and writes the colours it gives them</td></tr>
<tr id="field-compression"><td><code>compression</code></td><td><code>0 | 1</code><span class="opt">optional</span></td><td>Output format of the JSON results. 0 (default): plain output, each object contains readable values such as qid and type. 1: compact output, version UUIDs and entity types are returned once in top-level vids/types arrays, and objects reference them by index (_v/_t) with _o as the object id. Only use 1 when you explicitly want the compact format, for example to reduce response size Default <code>0</code>.</td></tr>
<tr id="field-grouppath"><td><code>groupPath</code></td><td><code>object</code><span class="opt">optional</span></td><td>Slice mode for queries with a (multi-key) GROUP BY. Each entry addresses one group per nesting level, as an index into that level's groups (sorted by group key value). An empty array returns the level-0 groups. When entries remain below the addressed path, the response contains the next level's groups in a top-level &quot;groups&quot; array (same record shape as regular grouped results, plus &quot;groupKey&quot; and &quot;groupValue&quot; columns carrying the group's own key and display value); when the path consumes all group keys, the member objects of the addressed group are returned in &quot;objects&quot;. Objects without a value for a level's group feature are grouped under a synthetic &quot;[none]&quot; group at that level, so every level fully partitions its parent. Group indices are stable for an identical model set and query. Without groupPath, a multi-key GROUP BY returns flat records, one per non-empty key combination (including [none] combinations), ordered by key 1, then key 2, etc.</td></tr>
<tr id="field-groupkeys"><td><code>groupKeys</code></td><td><code>object</code><span class="opt">optional</span></td><td>The same slice as groupPath, addressed by value instead of by index - the <code>groupKey</code> of one group per level, as the slice records carry it. A key still names its group after the models change. Pass groupPath or groupKeys, not both</td></tr>
<tr id="field-grouplevel"><td><code>groupLevel</code></td><td><code>integer</code><span class="opt">optional</span></td><td>Optional validation aid for groupPath and groupKeys: must equal the number of their entries (the nesting level of the returned groups)</td></tr>
</tbody>
</table>

## Responses {#responses}

<table class="dense">
<thead><tr><th>Status</th><th>Schema</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code class="status-2xx">200</code></td><td><code>object</code> <span class="opt">application/json</span></td><td>Query results in the requested format. Format json: the BIM.works query results JSON. A plain query answers an array of records with readable values; with <code>columns: true</code> it answers {objects, columns}, columns being an array of QueryColumn. With compression 1 the records reference top-level vids/types arrays by index, and columns is there too. With groupPath or groupKeys the response echoes the slice and groupLevel, and the records are under &quot;groups&quot; (the next level's groups) or &quot;objects&quot; (the member objects, when the slice consumed all group keys). Format count: {count}. Format qids: {qids}. An empty models array: {messages}</td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">text/csv</span></td><td>Format csv, the records as a table</td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</span></td><td>Format xlsx, the records as a spreadsheet</td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">application/ifc</span></td><td>Format ifc, the matching objects as an IFC STEP model</td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">application/xml</span></td><td>Format ifcxml, the matching objects as an ifcXML model (dialect follows the models' schema)</td></tr>
<tr><td><code class="status-4xx">400</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Invalid input: a missing or invalid argument, an invalid query/identifier/path, a state conflict caused by the request (for example a Node name that already exists), or an uploaded file that was rejected because it cannot be read (<code>type</code> for example <code>INVALID_INPUT_FILE</code>, <code>NO_CONVERTIBLE_CONTENT</code> or one of the <code>StepParserErrorCode</code> codes; uploading the same file again fails the same way)</td></tr>
<tr><td><code class="status-4xx">401</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Authentication failed: the bearer token is missing, malformed, expired or otherwise invalid, or the provided login credentials are incorrect</td></tr>
<tr><td><code class="status-4xx">403</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Authenticated, but not allowed: no read/write rights on the target Node, the token's task or IP scope does not allow this call, or a required user feature is missing</td></tr>
<tr><td><code class="status-4xx">404</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>The referenced entity (Node, Version, model file, upload, ...) does not exist</td></tr>
<tr><td><code class="status-4xx">429</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Too many requests from this client in a short time, on an installation that limits the request rate. Wait the number of seconds in <code>Retry-After</code> before trying again</td></tr>
<tr><td><code class="status-5xx">500</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>An unexpected server-side error (database, routing, IO, unknown)</td></tr>
<tr><td><code class="status-5xx">503</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>BIM.works is temporarily unavailable: it is restarting, stopped, or down for scheduled maintenance (<code>type</code> <code>SERVICE_UNAVAILABLE</code> or <code>MAINTENANCE</code>). Wait the number of seconds in <code>Retry-After</code> before trying again</td></tr>
<tr><td><code class="status-5xx">504</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>BIM.works did not respond in time (<code>type</code> <code>REQUEST_TIMED_OUT</code>). The request may still be completed: check its result before trying again</td></tr>
</tbody>
</table>
