Skip to content

Hi Coactive team!

This is a sample of what your docs might look like on Starport, based on your public docs.

Take a look! Ask AI, search, the MCP server, and Markdown copies all work.

Starport is a free and open-source docs framework based on Starlight and maintained by Promptless. Promptless is the AI agent that automatically updates your customer-facing docs.

Every annual Promptless plan comes with white-glove migration to Starport, where we migrate the content, tune the result with you, and you own the repository so you're never locked in.

Book a 15-minute walkthrough

Sample migration of Coactive docs to Starport, prepared by PromptlessBook 15-minute call

Programmatically Retrieve SQL results

This tutorial focuses on programmatically retrieving SQL query results to extract metadata using the Coactive API and Coactive SQL Engine functionality.

  1. Refer to our API Authenication page

To automate queries, use the Coactive API’s asynchronous query submission functionality.

Use the following curl command to submit a SQL query:

Curl

Terminal window
curl -X POST https://api.coactive.ai/api/v1/queries \
-H "Authorization: Bearer <CLIENT_ID>:<CLIENT_SECRET>" \
-H "Content-Type: application/json" \
-d '{"query": "SELECT * FROM coactive_table", \
"dataset_id": "<DATASET_ID>" \
}'

The API responds with query details including the query_id:

API_Response

Terminal window
{ "query_id": "<QUERY_ID>",
"status": "Queued",
"dataset_id": "<DATASET_ID>" }

To check the status of your query, use the query_id returned in the previous response:

Curl

Terminal window
curl https://api.coactive.ai/api/v1/queries/<QUERY_ID> \
-H "Authorization: Bearer <CLIENT_ID>:<CLIENT_SECRET>"

wordwrap

Terminal window
{"query_id": "<QUERY_ID>",
"status": "Complete",
"dataset_id": "<DATASET_ID>",
"total_row_count": 100 }

Once the query status is “Complete,” retrieve the results download URL:

Curl

Terminal window
curl https://api.coactive.ai/api/v1/queries/<QUERY_ID>/results \
-H "Authorization: Bearer <CLIENT_ID>:<CLIENT_SECRET>"

The response provides a temporary link to download the results:

API Response

Terminal window
{ "query_id": "<QUERY_ID>",
"download_url": "https://api.coactive.ai/presigned/...." }
  • The download link expires 15 minutes after it is generated (configurable via the expiration_seconds query parameter).
  1. Submit a query via POST.

  2. Use the query_id to check the status of the query.

  3. Once the status is “Complete,” download the results.