Skip to main content
POST
/
app
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
packages
Create Package
curl --request POST \
  --url https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/packages \
  --header 'Content-Type: application/json' \
  --data '
{
  "version": "<string>",
  "metadata": {
    "metadata.description": "<string>",
    "metadata.tags": [
      "<string>"
    ]
  }
}
'

Request Body

version
string
required
Semantic version number (e.g., 1.0.0, 2.1.0)
metadata
object
required

Example Request

{
  "version": "1.0.0",
  "metadata": {
    "description": "Initial release with core UI components",
    "tags": ["ui", "core"]
  }
}
Creating a package will automatically publish all draft and modified components, assigning them new version numbers. This action cannot be undone.

Response

Returns the created Package object along with validation results showing what changed.
{
  "package": {
    "id": "pkg123",
    "projectId": "proj123",
    "version": "1.0.0",
    "components": [
      {
        "id": "comp123",
        "name": "ProductCard",
        "type": "view",
        "version": 1
      },
      {
        "id": "comp124",
        "name": "ArticleLayout",
        "type": "layout",
        "version": 1
      }
    ],
    "assets": [...],
    "compiled": {...},
    "dependencies": [...],
    "metadata": {
      "author": "user123",
      "description": "Initial release with core UI components",
      "tags": ["ui", "core"]
    },
    "createdAt": "2024-03-20T10:00:00Z",
    "updatedAt": "2024-03-20T10:00:00Z"
  },
  "validation": {
    "componentChanges": {
      "added": ["comp123"],
      "updated": ["comp124", "comp125"],
      "deleted": []
    },
    "statusChanges": {
      "draft": ["comp123"],
      "modified": ["comp124"],
      "published": ["comp125"]
    },
    "versionIncrements": {
      "comp123": { "from": null, "to": 1 },
      "comp124": { "from": 2, "to": 3 }
    }
  }
}

Error Responses

Version Already Exists

{
  "error": {
    "code": "PACKAGE_VERSION_EXISTS",
    "message": "Package version 1.0.0 already exists"
  }
}

No Components

{
  "error": {
    "code": "NO_COMPONENTS_TO_PACKAGE",
    "message": "Cannot create package: project contains no components. Create at least one component before creating a package."
  }
}

Code Examples

curl -X POST "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/packages" \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "1.0.0",
    "metadata": {
      "description": "Initial release"
    }
  }'