Aller au contenu
← Documentation

Designs API

Gérez les designs personnalisés

Endpoints

GET /v1/designs
GET /v1/designs/:id
POST /v1/designs
PATCH /v1/designs/:id
DELETE /v1/designs/:id
POST /v1/designs/:id/export

Créer un Design

// Create Design
const design = await fetch('https://api.luneo.app/v1/designs', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    product_id: 'prod_xxx',
    name: 'Mon Design',
    canvas_data: {
      objects: [
        { type: 'text', content: 'Hello', x: 100, y: 100 }
      ]
    }
  })
});

Lister les Designs

// List User Designs
const designs = await fetch('https://api.luneo.app/v1/designs?user_id=user_xxx', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { data } = await designs.json();

Exporter

// Export Design
const exported = await fetch('https://api.luneo.app/v1/designs/design_xxx/export', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
  body: JSON.stringify({
    format: 'png',
    dpi: 300,
    width: 4000
  })
});
const { url } = await exported.json();