The Contazen API supports multi-work-point (multi-branch) access, allowing you to manage data across all locations of your business using a single API key. This is particularly useful for businesses with multiple offices, stores, or branches.
By default, API requests operate on the work point where the API key was created. To access data from a different work point, include the work_point_id parameter in your request.
Work points don’t change frequently. Cache the list to reduce API calls:
Copy
Ask AI
let workPointCache = null;async function getWorkPoints(apiKey) { if (!workPointCache) { const response = await fetch('https://api.contazen.ro/v1/settings', { headers: { 'Authorization': `Bearer ${apiKey}` } }); const data = await response.json(); workPointCache = data.work_points; } return workPointCache;}
Handle Work Point Permissions
Always handle cases where a work point might not be accessible:
Copy
Ask AI
try { const invoice = await createInvoice(workPointId, data);} catch (error) { if (error.code === 'work_point_not_found') { console.error('Work point not accessible or does not exist'); }}