Skip to main content
GET
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
packages
/
draft
Get Draft Package
curl --request GET \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/packages/draft
{
  "components": [
    {
      "id": "<string>",
      "name": "<string>",
      "version": 123,
      "status": "<string>",
      "content": "<string>"
    }
  ],
  "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

Response

Returns a preview of the draft package state.
components
object[]
Array of components that would be included
dependencies
object[]
Array of project dependencies

Example Response

{
  "components": [
    {
      "id": "comp123",
      "name": "Button",
      "version": null,
      "status": "draft",
      "content": "const body = (props) => { ... }"
    },
    {
      "id": "comp124",
      "name": "Card",
      "version": 2,
      "status": "modified",
      "content": "const body = (props) => { ... }"
    },
    {
      "id": "comp125",
      "name": "Header",
      "version": 1,
      "status": "published",
      "content": "const body = (props) => { ... }"
    }
  ],
  "dependencies": [
    {
      "projectId": "proj456",
      "version": "2.0.0"
    }
  ]
}

Understanding the Response

Component StatusVersionWhat Happens on Package Create
draftnullGets version 1
modifiednGets version n+1
publishednStays at version n (no change)
The draft endpoint is read-only. It does not create or modify any data. Use this to preview changes before creating a package.

Use Cases

Preview Before Publishing

Check what components will be affected before creating a package:
// Check draft state
const draftResponse = await fetch(
  'https://api.metabind.ai/v1/organizations/org123/projects/proj456/packages/draft',
  { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const draft = await draftResponse.json();

// Count components by status
const draftComponents = draft.components.filter(c => c.status === 'draft');
const modifiedComponents = draft.components.filter(c => c.status === 'modified');

console.log(`Creating package will:`);
console.log(`- Publish ${draftComponents.length} new components`);
console.log(`- Update ${modifiedComponents.length} existing components`);

Code Examples

curl -X GET "https://api.metabind.ai/v1/organizations/org123/projects/proj456/packages/draft" \
  -H "Authorization: Bearer YOUR_API_KEY"