Skip to main content
POST
/
projects
/
{projectName}
/
packages
/
{packageName}
/
models
/
{path}
/
query
Execute Malloy query
curl --request POST \
  --url https://{organization}.data.credibledata.com/api/v0/projects/{projectName}/packages/{packageName}/models/{path}/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "sourceName": "<string>",
  "queryName": "<string>",
  "compactJson": false,
  "versionId": "<string>"
}
'
{
  "result": "<string>",
  "resource": "<string>"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

projectName
string
required

Name of the project Standard identifier pattern for resource names

Pattern: ^[a-zA-Z0-9_-]+$
packageName
string
required

Name of the package Version identifier pattern supporting dots and dashes

Pattern: ^[a-zA-Z0-9_.-]+$
path
string
required

Path to the model within the package Path pattern supporting slashes, dots, and dashes

Pattern: ^[a-zA-Z0-9_/.-]+$

Body

application/json

Request body for executing a Malloy query

query
string

Query string to execute on the model. If the query parameter is set, the queryName parameter must be empty.

sourceName
string

Name of the source in the model to use for queryName, search, and topValue requests.

queryName
string

Name of a query to execute on a source in the model. Requires the sourceName parameter is set. If the queryName parameter is set, the query parameter must be empty.

compactJson
boolean
default:false

If true, returns a simple JSON array of row objects in the form {"columnName": value}. If false (default), returns the full Malloy result with type metadata for rendering.

versionId
string

Version ID

Response

Query execution results

Results from executing a Malloy query

result
string

JSON string containing the query results, metadata, and execution information

resource
string

Resource path to the query result