Get a forecast job
curl --request GET \
--url https://api-dev.narrative.io/nql/{job_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/nql/{job_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/nql/{job_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.narrative.io/nql/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-dev.narrative.io/nql/{job_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-dev.narrative.io/nql/{job_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/nql/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "ef628399-1c83-44ff-8525-69c3796cfc7c",
"company_id": 1,
"completed_at": null,
"created_at": "2025-04-11T23:37:40.796820Z",
"failures": [],
"idempotency_key": "9c987819-b5e9-4357-abe6-52c1e6a2e8b5",
"input": {
"nql": "EXPLAIN SELECT company_data.\"9561\".\"STATE\" FROM company_data.\"9561\"",
"compiled_sql": "..."
},
"request_source": {
"type": "api_user",
"company_id": 1,
"user_id": 1414
},
"result": null,
"state": "running",
"updated_at": "2025-04-11T23:37:41.168859Z"
}NQL
Get a forecast job
Poll a forecast job started by POST /v1/nql/execute with an EXPLAIN statement. The execute response
carries the workflow run id (run_id), not the job id; find the job with GET /jobs?workflow_run_id=<run_id>.
result is null until the job reaches completed or failed, then carries either the forecast or the
failure message.
Only forecast jobs are served here. For other statements run through POST /v1/nql/execute, follow the
workflow run through the workflows endpoints.
GET
/
nql
/
{job_id}
Get a forecast job
curl --request GET \
--url https://api-dev.narrative.io/nql/{job_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/nql/{job_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/nql/{job_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.narrative.io/nql/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-dev.narrative.io/nql/{job_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-dev.narrative.io/nql/{job_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/nql/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "ef628399-1c83-44ff-8525-69c3796cfc7c",
"company_id": 1,
"completed_at": null,
"created_at": "2025-04-11T23:37:40.796820Z",
"failures": [],
"idempotency_key": "9c987819-b5e9-4357-abe6-52c1e6a2e8b5",
"input": {
"nql": "EXPLAIN SELECT company_data.\"9561\".\"STATE\" FROM company_data.\"9561\"",
"compiled_sql": "..."
},
"request_source": {
"type": "api_user",
"company_id": 1,
"user_id": 1414
},
"result": null,
"state": "running",
"updated_at": "2025-04-11T23:37:41.168859Z"
}Authorizations
Response
OK
A forecast job, started by an EXPLAIN statement.
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 
