cURL
curl --request POST \ --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/components/{id}/discard
Discard unpublished changes and revert to last published version
draft
modified
lastPublishedVersion
published
{ "id": "c123", "name": "ProductCard", "status": "published", "version": 2, "lastPublishedVersion": 2, "content": "// Content reset to match version 2", "compiled": "...", "schema": {...}, "metadata": { "discardedAt": "2024-03-22T10:00:00Z", "discardedBy": "user123" }, "createdAt": "2024-03-20T10:00:00Z", "updatedAt": "2024-03-22T10:00:00Z" }
{ "error": { "code": "INVALID_STATUS", "message": "Can only discard changes for draft or modified components", "details": { "currentStatus": "published" } } }
{ "error": { "code": "NO_PUBLISHED_VERSION", "message": "Cannot discard - component has never been published", "details": { "hint": "Use DELETE to remove unpublished draft components" } } }
curl -X POST "https://api.metabind.ai/v1/organizations/org123/projects/proj456/components/c123/discard" \ -H "Authorization: Bearer YOUR_API_KEY"