docs: POST /api/catalogs create-catalog contract
Merged
SW
4mo ago+126+126+012345678901234567890123456789-4-4-0123456789
What
Documents a new endpoint POST /api/catalogs — creates a catalog owned by the authenticated account, and optionally materializes it from a completed valuation run.
- Account from credentials, never the body. Owner is derived from the Privy bearer JWT or
x-api-key. Closes the IDOR risk of letting a client name the account. from.snapshot_idmaterialization. When supplied, the snapshot's measured ISRCs becomecatalog_songsand the catalog is linked viaaccount_catalogs— fixing the "catalog empty after sign-in" gap.- Idempotent. Re-submitting the same snapshot returns the catalog already created for that run (no duplicates).
Contract
POST /api/catalogs
- Body:
CreateCatalogRequest—{ name?, from?: { snapshot_id } }; at least one ofname/fromrequired. - 200
CreateCatalogResponse—{ status, catalog, songs_added }(also the idempotent re-claim response). - 400 (neither name nor from / bad snapshot_id), 401 (unauth), 403 (snapshot owned by another account), 404 (snapshot not found).
Files
api-reference/openapi/releases.json— new path + 3 schemas (CreateCatalogRequest,CreateCatalogResponse,CatalogMaterializationSource); 124 insertions, 0 deletions (additive, re-validated parse).api-reference/songs/catalogs-create.mdx— frontmatter-only reference page.docs.json— nav entry under Songs & Catalogs.
Merge order
Part of recoupable/chat#1801, Phase 2. Docs merge first, then the api implementation PR (which links back here). The api endpoint matches this contract exactly.
🤖 Generated with Claude Code
Summary by cubic
Documents the new POST /api/catalogs endpoint to create a catalog and optionally materialize it from a completed measurement snapshot. Materialization is idempotent: sending the same snapshot returns the existing catalog.
- New Features
- Added OpenAPI path for
/api/catalogswithCreateCatalogRequestandCreateCatalogResponse; defined 200/400/401/403/404 responses; shortened operation summary to “Create a catalog.” - Flattened request to use root
snapshot(UUID) instead offrom.snapshot_id; removedCatalogMaterializationSource. - Cross-links: the
snapshotfield references “Create measurement job,” and that endpoint links back to “Create catalog.” - Added
api-reference/songs/catalogs-create.mdx(frontmatter-only) and updateddocs.json: renamed the "Releases" tab to "Catalog" and split "Songs" and "Catalogs" groups.
- Added OpenAPI path for
Summary by CodeRabbit
-
New Features
- Added a new
POST /api/catalogsendpoint to create or idempotently re-materialize catalogs for the authenticated account, with optional catalog name and snapshot-based source. - Responses include creation status, the created catalog, and a count of songs added; error details are returned for invalid or missing snapshots.
- Added a new
-
Documentation
- Added an API reference page for the catalog creation endpoint.
- Updated navigation to split Songs and Catalogs, and linked the new documentation page.