Skip to main content
GET
/
v2
/
queries
/
{query_id}
Get a query by id
curl --request GET \
  --url https://api-dev.narrative.io/v2/queries/{query_id} \
  --header 'Authorization: Bearer <token>'
{
  "name": "query1",
  "id": "7409b999-2a9a-40cd-89dc-8430d85e0391",
  "display_name": "Query One",
  "owner": {
    "company_id": 456,
    "company_name": "ExampleCorp",
    "company_slug": "examplecorp"
  },
  "tags": [
    "tag1",
    "tag2"
  ],
  "collaborators": {
    "query": {
      "type": "inclusion",
      "company_ids": [
        789
      ]
    },
    "view": {
      "type": "all"
    }
  },
  "is_owned": true,
  "metadata": {
    "created_at": "2024-04-12T19:57:05.012908",
    "created_by_user_id": 321,
    "updated_at": "2024-04-12T20:03:48.031825",
    "updated_by_user_id": 321
  },
  "ast": {
    "type": "select",
    "nql": "SELECT age FROM narrative.rosetta_stone",
    "budget": null,
    "columns": [
      {
        "type": "table",
        "nql": "age",
        "db": null,
        "schema": null,
        "table": "age"
      }
    ],
    "from": {
      "type": "table",
      "nql": "narrative.rosetta_stone",
      "db": null,
      "schema": "narrative",
      "table": "rosetta_stone"
    },
    "group_by": [],
    "having": null,
    "is_distinct": false,
    "limit": null,
    "order_by": [],
    "qualify": null,
    "where": null,
    "windows": [],
    "with": []
  }
}

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

200 - application/json

OK

id
string<uuid>
required
name
string
required

It should be unique. Must be <= 256 characters and consist of only alphanumeric characters and underscores.

collaborators
object
required

Describes who can view or query a resource

owner
object
required

Information about the owner of the query

metadata
object
required

Metadata about when and by whom a query was created/updated

ast
object
required

The AST representing the query.

display_name
string

Optional. Display Name must be non-empty and less than 1000 chars.

description
string

A human-friendly description of the query.

tags
string[]

Optional. Each tag must be less than 256 chars.

is_owned
boolean

Whether the requestor owns the query.