Skip to main content
POST
/
projects
/
{projectName}
/
packages
/
{packageName}
/
models
/
{path}
/
compile
Compile Malloy source code
curl --request POST \
  --url https://{organization}.data.credibledata.com/api/v0/projects/{projectName}/packages/{packageName}/models/{path}/compile \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source": "<string>",
  "includeSql": false
}
'
{
  "status": "success",
  "problems": [
    {
      "message": "<string>",
      "severity": "error",
      "code": "<string>",
      "at": {
        "url": "<string>",
        "range": {}
      }
    }
  ],
  "sql": "<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

path
string
required

Path to the model within the package (used to resolve relative imports) Path pattern supporting slashes, dots, and dashes

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

Body

application/json

Request body for compiling Malloy source code

source
string
required

Malloy source code to compile

includeSql
boolean
default:false

If true, returns the generated SQL alongside compilation results (only available when compilation succeeds and the source contains a runnable query).

Response

Compilation result with status and any problems

Result of a Malloy source compilation check

status
enum<string>

Overall compilation status — "error" if any problems have error severity

Available options:
success,
error
problems
object[]

List of compilation problems (errors and warnings)

sql
string

Generated SQL for the compiled query. Only present when includeSql is true and compilation succeeds with a runnable query.