Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
packages
Create Package
curl --request POST \
  --url https://api.example.com/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

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": "VERSION_EXISTS",
    "message": "Package version 1.0.0 already exists",
    "details": {
      "version": "1.0.0"
    }
  }
}

Invalid Version Format

{
  "error": {
    "code": "INVALID_VERSION",
    "message": "Version must follow semantic versioning (MAJOR.MINOR.PATCH)",
    "details": {
      "provided": "1.0",
      "expected": "X.Y.Z format"
    }
  }
}

Conflicting Dependencies

{
  "error": {
    "code": "INVALID_PACKAGE_DEPENDENCY",
    "message": "Incompatible package versions",
    "details": {
      "conflicts": [
        {
          "package": "core",
          "required": {
            "by": "[email protected]",
            "version": "1.0.0"
          },
          "provided": {
            "by": "[email protected]",
            "version": "1.2.0"
          }
        }
      ]
    }
  }
}

Circular Dependencies

{
  "error": {
    "code": "CIRCULAR_DEPENDENCY",
    "message": "Package dependency cycle detected",
    "details": {
      "cycle": [
        "[email protected]",
        "[email protected]",
        "[email protected]"
      ]
    }
  }
}

Code Examples

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