Get Draft Package
curl --request GET \
--url https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draftimport requests
url = "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft', 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://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"version": "<string>",
"components": {},
"assets": {},
"dependencies": {}
}
}Draft Packages
Get Draft Package
Preview what would be included in a new package
GET
/
app
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
packages
/
draft
Get Draft Package
curl --request GET \
--url https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draftimport requests
url = "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft', 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://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"version": "<string>",
"components": {},
"assets": {},
"dependencies": {}
}
}The draft package endpoint returns a preview of what components and dependencies would be included if you created a new package right now. This is useful for understanding the current state before committing to a new version.
Path Parameters
string
required
Organization ID
string
required
Project ID
Query Parameters
boolean
default:"false"
Set to
true to include resolved dependencies in the responseResponse
Returns the draft package in the same format as the resolved package endpoint.object
Draft package
Show data properties
Show data properties
Example Response
{
"data": {
"id": "draft",
"version": "draft",
"components": {
"Button": "const body = (props) => { return Button(props.label); }",
"Card": "const body = (props) => { return VStack([...]); }",
"Header": "const body = (props) => { return HStack([...]); }"
},
"assets": {},
"dependencies": {}
}
}
The draft endpoint is read-only. It does not create or modify any data. It returns the same format as the resolved package endpoint, making it easy to switch between draft and published packages in client code.
Use Cases
Preview Components Before Publishing
Get the draft package to test components before creating a formal package:// Get draft package
const draftResponse = await fetch(
'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/packages/draft',
{ headers: { 'Authorization': 'Bearer YOUR_JWT' } }
);
const { data: draft } = await draftResponse.json();
// List available components
const componentNames = Object.keys(draft.components);
console.log(`Draft package has ${componentNames.length} components`);
componentNames.forEach(name => console.log(`- ${name}`));
Code Examples
curl -X GET "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/packages/draft" \
-H "Authorization: Bearer YOUR_JWT"
const response = await fetch(
'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/packages/draft',
{
headers: {
'Authorization': 'Bearer YOUR_JWT'
}
}
);
const { data: draft } = await response.json();
console.log(`Draft package contains ${Object.keys(draft.components).length} components`);