PermuteDocs
Go to Permute

Queries · queriesGet

Get SQL query status and results

Poll the same native query using its queryId. Never resubmit SQL to poll. Results are retained for 24 hours and require the initiating principal, app context, and current source access. Failed jobs include a structured error. Missing or expired results are reported explicitly.

GET/v1/queries/{queryId}
betaauthenticatedworkspace

When to use

Check an existing SQL execution without starting another query.

For agents

Use the queryId from submission. When completed, read result.rows; when failed, inspect error.code, message and details. Recheck current permissions before interpreting a missing or denied result.

Example

typescript
import { PermuteClient } from '@permute/sdk';

const orgClient = new PermuteClient({
  apiKey: process.env.PERMUTE_API_KEY!,
});

const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);

const result = await client.getQuery('qry_abcdefghijklmnopqrstuvwx');

Response

json
{
  "data": {
    "queryId": "qry_abcdefghijklmnopqrstuvwx",
    "status": "running",
    "statusUrl": "/v1/queries/qry_abcdefghijklmnopqrstuvwx",
    "pollAfterMs": 1500
  }
}