Skip to main content
POST
Run a NQL Query

Authorizations

Authorization
string
header
required

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

Body

application/json
nql
string
required

A NQL query.

data_plane_id
string<uuid>

A dataplane represent where you would run the query. Your query get compiled to the SQL dialect that your data engine understands. If you leave it blank, your query will target Narrative's dataplane on AWS using Apache Spark. We currently support Snowflake and we plan to support other dataplanes in the future. See https://next.narrative.io/products/narrative-anywhere for more details.

compute_pool_id
string<uuid>

The ID of the compute pool to run on. The compute pool must be active, belong to your company, and be associated with the target data plane. If not specified, the default compute pool for the data plane will be used (if one is configured).

Example:

"5c8f4a2e-3b1d-4f6a-9c7e-2d8b1a0f5e93"

create_as_view
boolean
default:false

When true, a CREATE MATERIALIZED VIEW statement creates a view over the query rather than a materialized table, so reads run the query instead of returning stored rows. Ignored for any other statement type, and not compatible with MERGE, DELTA, CHUNKING_STRATEGY, or PARTITIONED_BY.

Example:

false

Response

Created

A forecast job, started by an EXPLAIN statement.

id
string<uuid>
required

Unique identifier for the job.

company_id
integer<int64>
required

Company that ran the job.

Example:

345

created_at
string<date-time>
required

The timestamp representing when the job was created.

failures
object[]
required

causes of job failure

idempotency_key
string
required

The unique ID associated with the job.

request_source
object
required

Who asked for the job. Discriminated by type: api_user for a job requested through the API on behalf of a user, process for one enqueued by a Narrative process.

Example:
state
enum<string>
required

Where a job is in its lifecycle.

  • pending — enqueued and waiting to be picked up.
  • scheduled — claimed by an executor but not yet started.
  • running — being executed.
  • pending_cancellation — cancellation has been requested and the data plane has yet to stop the work.
  • completed, cancelled, failed — terminal states.
Available options:
pending,
scheduled,
running,
pending_cancellation,
completed,
cancelled,
failed
updated_at
string<date-time>
required

The timestamp representing when the job was updated.

input
object
required

The query and its compiled SQL as sent to the executor.

completed_at
string<date-time> | null

When the job finished, or null while it is still pending or running.

result
object

The forecast once the job has completed, or the failure that ended it. Null while the job is pending or running.