Update Mode
Update mode lets your end users register a new version of a work already on the blockchain. Common use cases include:
- The work was registered as a work in progress and a final version is now ready
- Contributors have changed — new creators joined or existing ones were removed
- The metadata needs updating (roles, identifiers like IPI/ISNI)
How It Works
Section titled “How It Works”In update mode, the work is identified by its access code — the unique 68-character string (atc_...) returned when the work was first registered. The user enters the access code in the widget, which verifies it against the API and pre-fills the form with the existing work’s metadata.
Set mode="update" on the widget:
<ats-widget id="ats-widget" site-key="cpk_your_public_key" ats-url="https://ats.api.allfeat.org" network="testnet" mode="update"></ats-widget>Backend Token Setup
Section titled “Backend Token Setup”app.post('/api/ats-token/update', async (req, res) => { const user = await getAuthenticatedUser(req); if (!user) return res.status(401).json({ error: 'Unauthorized' });
// Verify the user owns this work before issuing a token const work = await db.works.findByUser(user.id, req.body.atsId); if (!work) return res.status(403).json({ error: 'Not allowed' });
const response = await fetch('https://ats.api.allfeat.org/v1/sessions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://yoursite.com', // domain where the widget is embedded }, body: JSON.stringify({ secret_key: process.env.ALLFEAT_SECRET_KEY, action_type: 'update_version', allowed_network: 'testnet', allowed_ats_id: work.ats_id, // restrict to this specific work }), });
const { token } = await response.json(); res.json({ token });});User Flow
Section titled “User Flow”When the widget opens in update mode, the user goes through the following steps:
-
Access Code
Section titled “Access Code”The user enters the access code for the work they want to update. The widget verifies the code against the API, which returns the current work metadata (title, creators). The form is pre-filled with this data.
-
File (optional)
Section titled “File (optional)”The user can choose to upload a new audio file or skip this step to reuse the existing one.
-
The work title, pre-filled from the current version. The title cannot be modified.
-
Creators
Section titled “Creators”The creators list, pre-filled from the current version. The user can add, remove, or modify creators and their roles.
-
Review & Submit
Section titled “Review & Submit”Summary of all changes before submission. The widget then handles the upload (if applicable), blockchain transaction, and tracking.
With a New Audio File
Section titled “With a New Audio File”The full flow — the new file is uploaded to S3, a new commitment hash is generated, and a new version is registered on-chain.
Without a New File (Metadata Only)
Section titled “Without a New File (Metadata Only)”The user skips the file step. Only the creators metadata is updated on-chain, reusing the existing audio’s commitment.
Events
Section titled “Events”Update mode emits the same events as register mode. The allfeat:complete event payload:
{ atsId: number | null; // The work's ATS ID txHash: string; // New transaction hash for this version blockNumber: number; explorerUrl: string;}Switching Modes Dynamically
Section titled “Switching Modes Dynamically”You can switch between modes by updating the mode attribute:
const widget = document.getElementById('ats-widget');
// Switch to update modewidget.setAttribute('mode', 'update');
// Switch back to register modewidget.setAttribute('mode', 'register');The widget automatically resets its form state when the mode attribute changes.