Skip to main content
GET
Get a query by id

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

query_id
string<uuid>
required

Query identifier.

Response

OK

A saved query. is_owned tells the two forms apart: the owning company also sees collaborators and who created and updated the query.

id
string<uuid>
required
name
string
required

Unique among the owning company's queries. At most 256 characters, letters, digits and underscores only.

Maximum string length: 256
Pattern: ^[a-zA-Z0-9_]+$
tags
string[]
required

Each tag is between 1 and 255 characters.

Required string length: 1 - 255
collaborators
object
required

Describes who can view or query a resource

owner
object
required

Information about the owner of the query

is_owned
enum<boolean>
required
Available options:
true
metadata
object
required

When and by whom the query was created and last updated.

ast
object
required

The saved query body. The API stores the object exactly as it was sent and returns it unchanged. It does not validate the contents, so a reader has to cope with whatever an earlier client wrote. That is why the schema lists no fields.

The Narrative platform app writes an object with these fields, and older rows can lack any of them:

  • parsed: the parsed statement. Its shape is set by ast_metadata.version. With no version it is the platform app's original parser output.
  • compiled: the NQL text the statement was printed to when it was saved.
  • ast_metadata: an object with node_type and, on rows written since versioning, version. Absent on some older rows.
  • markdown, sources and placeholdersWithContext: present on some rows.

Some rows instead hold a bare parsed statement at the top level (type, nql, columns, from and so on) with none of these fields.

display_name
string | null

At most 999 characters, and not blank once surrounding whitespace is trimmed. Null when the query has none.

description
string | null

A human-friendly description of the query. Null when the query has none.