Skip to main content
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/draft
{
  "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

organizationId
string
required
Organization ID
projectId
string
required
Project ID

Query Parameters

includeDependencies
boolean
default:"false"
Set to true to include resolved dependencies in the response

Response

Returns the draft package in the same format as the resolved package endpoint.
id
string
Always “draft” for the draft package
version
string
Always “draft” for the draft package
components
object
Map of component names to compiled JavaScript code
assets
object
Always empty for draft packages
dependencies
object
Map of dependency identifiers to their resolved content (only present if includeDependencies=true)

Example Response

{
  "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 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"