Jobs API
Base URL: https://jobs.opteryx.app
Overview
Job submission, execution status tracking, result retrieval, recent-query listing, and edit-time statement checking.
Job flow
Jobs run asynchronously: submitting a query returns immediately with an execution_id, and the query keeps running in the background until you poll it to completion.
-
1
POST /api/v1/jobs -
2
201 ·
execution_id,status,status_url -
-
GET /api/v1/jobs/{execution_id}/status -
200 ·
status,results_url
Repeat on an interval untilstatusis no longer in progress -
-
3
GET /api/v1/jobs/{execution_id}/results -
4
200 ·
data[],total_rows,next_page -
-
GET /api/v1/jobs/{execution_id}/download?file_format=csv|json|parquet - 200 · file
-
- Poll
status, notresults.GET .../statusis cheap and returnsresults_urlonce the job is done;GET .../resultsis what actually pages through the data,num_rows/offsetat a time, followingnext_pagefor more. resultsanddownloadare independent, not exclusive. Pull a page inline withresultsto inspect it in your app, or stream the whole set withdownloadas CSV, newline-delimited JSON, or Parquet — call either, neither, or both once the job has finished.
Endpoints
| Service | Docs |
|---|---|
Check a SQL statement without running itpost/api/v1/check |
View |
Create and execute SQL jobpost/api/v1/jobs |
View |
Retrieve recent user queriesget/api/v1/jobs/recent |
View |
Download job resultsget/api/v1/jobs/{identifier}/download |
View |
Get job resultsget/api/v1/jobs/{identifier}/results |
View |
Get job statusget/api/v1/jobs/{identifier}/status |
View |
List saved variablesget/api/v1/variables |
View |
Create or update a saved variableput/api/v1/variables/{name} |
View |
Delete a saved variabledelete/api/v1/variables/{name} |
View |
Check a SQL statement without running it
Request: post/api/v1/check
Tags: Query Check
Resolve and type-check one statement against the catalog, as the caller, and report what was found: a positioned error to underline, the result shape, and the relations and columns in scope for completion. Reads no data and changes nothing, so it is safe to call as a statement is typed. A statement that is wrong is a 200 with ok: false - the error is the answer, not a failure of the request.
Header Parameters
- authorization
string | null[header; optional]
Request Body
- Content-Type:
application/jsonSchema:QueryCheckRequest- sql_text
string[required] One SQL statement to check. Not a batch. - parameters
object | null[optional] Values for the statement's:nameplaceholders. Anything not passed is resolved from the caller's saved variables, exactly as job submission resolves them - see the Variables API.
- sql_text
Responses
- 200 — Successful Response (
application/jsonQueryCheckResponse) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
post https://jobs.opteryx.app/api/v1/check
Create and execute SQL job
Request: post/api/v1/jobs
Tags: Jobs Management
Submit a SQL job for execution. :name placeholders in sql_text are resolved from the parameters field, falling back to the caller's saved variables for anything not passed explicitly - see parameters below and the Variables API.
Header Parameters
- authorization
string | null[header; optional]
Request Body
- Content-Type:
application/jsonSchema:JobCreateRequest- sql_text
string[required] SQL statement to execute - client_info
object | null[optional] Client information, e.g. application name/version - parameters
object | null[optional] Values for any:nameplaceholders in sql_text, as key-value pairs. Values passed here always take priority. Any placeholder the query references that isn't included here is automatically resolved from the caller's saved variables (see the Variables API) - this is what lets a shared query stay generic (e.g.WHERE department = :department) while each caller's own saved value fills in without them passing it explicitly. A placeholder that's neither passed nor saved is left unresolved, and the job fails at execution with a parameter-not-defined error.
- sql_text
Responses
- 201 — Successful Response (
application/jsonJobCreateResponse) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
post https://jobs.opteryx.app/api/v1/jobs
Retrieve recent user queries
Request: get/api/v1/jobs/recent
Tags: Jobs Management
Get recent user queries.
Query Parameters
- filter
string | null[query; optional]
Header Parameters
- authorization
string | null[header; optional]
Responses
- 200 — Successful Response (
application/jsonarray<QueryJob>) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
get https://jobs.opteryx.app/api/v1/jobs/recent
Download job results
Request: get/api/v1/jobs/{identifier}/download
Tags: Jobs Management
Download the results of a previously submitted job as CSV, newline-delimited JSON, or Parquet.
Path Parameters
- identifier
string[path; required]
Query Parameters
- file_format
string[query; optional] Allowed values:csv,json,parquetDefault:csv - limit
integer[query; optional] Default:10000 - offset
integer[query; optional] Default:0
Header Parameters
- authorization
string | null[header; optional]
Responses
- 200 — Successful Response (
application/jsonobject) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
get https://jobs.opteryx.app/api/v1/jobs/{identifier}/download
Get job results
Request: get/api/v1/jobs/{identifier}/results
Tags: Jobs Management
Retrieve the results of a previously submitted job.
Path Parameters
- identifier
string[path; required]
Query Parameters
- num_rows
integer[query; optional] Default:5000 - offset
integer[query; optional] Default:0 - verbose
boolean[query; optional] Default:false
Header Parameters
- authorization
string | null[header; optional]
Responses
- 200 — Successful Response (
application/jsonJobResultsResponse) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
get https://jobs.opteryx.app/api/v1/jobs/{identifier}/results
Get job status
Request: get/api/v1/jobs/{identifier}/status
Tags: Jobs Management
Retrieve the execution status of a previously submitted job.
Path Parameters
- identifier
string[path; required]
Header Parameters
- authorization
string | null[header; optional]
Responses
- 200 — Successful Response (
application/jsonJobStatusResponse) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
get https://jobs.opteryx.app/api/v1/jobs/{identifier}/status
List saved variables
Request: get/api/v1/variables
Tags: Variables
List the caller's saved query-parameter variables.
Header Parameters
- authorization
string | null[header; optional]
Responses
- 200 — Successful Response (
application/jsonVariableListResponse) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
get https://jobs.opteryx.app/api/v1/variables
Create or update a saved variable
Request: put/api/v1/variables/{name}
Tags: Variables
Create (or replace) a named query-parameter variable for the caller.
Path Parameters
- name
string[path; required]
Header Parameters
- authorization
string | null[header; optional]
Request Body
- Content-Type:
application/jsonSchema:VariableUpsertRequest- type
string[required] One of 'string', 'number', or 'boolean' - value
object[required] The variable's value; its JSON type must matchtype
- type
Responses
- 200 — Successful Response (
application/jsonVariableListResponse) - 422 — Validation Error (
application/jsonHTTPValidationError)
Try it live
put https://jobs.opteryx.app/api/v1/variables/{name}
Delete a saved variable
Request: delete/api/v1/variables/{name}
Tags: Variables
Delete a named query-parameter variable for the caller.
Path Parameters
- name
string[path; required]
Header Parameters
- authorization
string | null[header; optional]
Responses
- 204 — Successful Response
- 422 — Validation Error (
application/jsonHTTPValidationError)