curl --request POST \
--url https://app.codealive.ai/api/tools/query_artifact_metadata \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"statement": "SELECT path, language FROM files LIMIT 20",
"data_sources": [
"CodeAlive-AI/agent-framework"
]
}
'import requests
url = "https://app.codealive.ai/api/tools/query_artifact_metadata"
payload = {
"statement": "SELECT path, language FROM files LIMIT 20",
"data_sources": ["CodeAlive-AI/agent-framework"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
statement: 'SELECT path, language FROM files LIMIT 20',
data_sources: ['CodeAlive-AI/agent-framework']
})
};
fetch('https://app.codealive.ai/api/tools/query_artifact_metadata', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.codealive.ai/api/tools/query_artifact_metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'statement' => 'SELECT path, language FROM files LIMIT 20',
'data_sources' => [
'CodeAlive-AI/agent-framework'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.codealive.ai/api/tools/query_artifact_metadata"
payload := strings.NewReader("{\n \"statement\": \"SELECT path, language FROM files LIMIT 20\",\n \"data_sources\": [\n \"CodeAlive-AI/agent-framework\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.codealive.ai/api/tools/query_artifact_metadata")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"statement\": \"SELECT path, language FROM files LIMIT 20\",\n \"data_sources\": [\n \"CodeAlive-AI/agent-framework\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codealive.ai/api/tools/query_artifact_metadata")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"statement\": \"SELECT path, language FROM files LIMIT 20\",\n \"data_sources\": [\n \"CodeAlive-AI/agent-framework\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"obj": {
"rawStatement": "SELECT count() AS count, language FROM files GROUP BY language LIMIT 20",
"version": "V1",
"resultShape": "GroupedAggregate",
"columns": [
"count",
"language"
],
"rows": [
{
"count": 214,
"language": "python"
},
{
"count": 32,
"language": "markdown"
}
],
"returnedRows": 2,
"truncated": false,
"limit": 20,
"dataSourceIds": [
"665f1c2ab3e77d0c9a1b4d21"
]
},
"rendered": "{\"rawStatement\":\"SELECT count() AS count, language FROM files GROUP BY language LIMIT 20\",\"columns\":[\"count\",\"language\"],\"rows\":[{\"count\":214,\"language\":\"python\"},{\"count\":32,\"language\":\"markdown\"}],\"returnedRows\":2,\"limit\":20}"
}Query artifact metadata
Executes one bounded, read-only ArtifactQuery statement over indexed artifact metadata for repository-level analytics: language and file-type mix, lines, cognitive complexity, largest files, public API surface, relationship counts. Statements must end with LIMIT. Invalid statements are not executed and return repairable diagnostics — fix the statement per the hint (see get_artifact_query_schema) and retry.
curl --request POST \
--url https://app.codealive.ai/api/tools/query_artifact_metadata \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"statement": "SELECT path, language FROM files LIMIT 20",
"data_sources": [
"CodeAlive-AI/agent-framework"
]
}
'import requests
url = "https://app.codealive.ai/api/tools/query_artifact_metadata"
payload = {
"statement": "SELECT path, language FROM files LIMIT 20",
"data_sources": ["CodeAlive-AI/agent-framework"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
statement: 'SELECT path, language FROM files LIMIT 20',
data_sources: ['CodeAlive-AI/agent-framework']
})
};
fetch('https://app.codealive.ai/api/tools/query_artifact_metadata', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.codealive.ai/api/tools/query_artifact_metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'statement' => 'SELECT path, language FROM files LIMIT 20',
'data_sources' => [
'CodeAlive-AI/agent-framework'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.codealive.ai/api/tools/query_artifact_metadata"
payload := strings.NewReader("{\n \"statement\": \"SELECT path, language FROM files LIMIT 20\",\n \"data_sources\": [\n \"CodeAlive-AI/agent-framework\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.codealive.ai/api/tools/query_artifact_metadata")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"statement\": \"SELECT path, language FROM files LIMIT 20\",\n \"data_sources\": [\n \"CodeAlive-AI/agent-framework\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codealive.ai/api/tools/query_artifact_metadata")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"statement\": \"SELECT path, language FROM files LIMIT 20\",\n \"data_sources\": [\n \"CodeAlive-AI/agent-framework\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"obj": {
"rawStatement": "SELECT count() AS count, language FROM files GROUP BY language LIMIT 20",
"version": "V1",
"resultShape": "GroupedAggregate",
"columns": [
"count",
"language"
],
"rows": [
{
"count": 214,
"language": "python"
},
{
"count": 32,
"language": "markdown"
}
],
"returnedRows": 2,
"truncated": false,
"limit": 20,
"dataSourceIds": [
"665f1c2ab3e77d0c9a1b4d21"
]
},
"rendered": "{\"rawStatement\":\"SELECT count() AS count, language FROM files GROUP BY language LIMIT 20\",\"columns\":[\"count\",\"language\"],\"rows\":[{\"count\":214,\"language\":\"python\"},{\"count\":32,\"language\":\"markdown\"}],\"returnedRows\":2,\"limit\":20}"
}Authorizations
API Key authentication using Bearer token. Example: "Authorization: Bearer {apiKey}"
Body
One read-only ArtifactQuery statement. Use get_artifact_query_schema for supported entities, fields, and examples.
Optional success projection. Omit to return both obj and rendered; use json for obj only; use agentic for rendered text only. Repairable errors always return both obj.error and rendered.
json, agentic Repository or workspace names returned by get_data_sources. Omit only when the API key has a single unambiguous scope.
Response
Success envelope. obj is the execution result: rawStatement, resultShape, columns, rows[] (column-keyed dictionaries), returnedRows, truncated, limit, dataSourceIds; rendered is the JSON-serialized form of obj. Repairable failures (missing or invalid arguments, ambiguous or unknown data sources) also return HTTP 200 with obj.error = { code, message, retry, try } and a rendered <tool_error> block; repair the arguments and retry.
Was this page helpful?