Documentation

Welcome to the BrandUp API

The BrandUp API enables you to seamlessly interact with our platform. This documentation guides you through all available endpoints, integrations and best practices.

Installation

The BrandUp SDK can be installed via npm, yarn or pnpm. Make sure you have Node.js 14 or higher installed.

npm install @brandup/sdk
# oder
yarn add @brandup/sdk
# oder
pnpm add @brandup/sdk

Quick Start

With just a few lines of code you can use the BrandUp API. Here's a complete example to get started:

import { BrandUpClient } from '@brandup/sdk'

// Initialize the client
const client = new BrandUpClient({
  apiKey: process.env.BRANDUP_API_KEY,
  environment: 'production',
  timeout: 30000 // 30 seconds
})

// Fetch shop data
const shops = await client.shops.list({
  limit: 10,
  offset: 0,
  sortBy: 'createdAt',
  order: 'desc'
})

// Get shop details
const shop = await client.shops.get('shop-123')
console.log(shop)

Authentication

The BrandUp API supports two authentication methods: Bearer Token and API Key.

// Bearer Token Authentication
const response = await fetch('https://api.brandup.de/v1/shops', {
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
})

// API Key Authentication
const client = new BrandUpClient({
  apiKey: 'YOUR_API_KEY',
  apiSecret: 'YOUR_API_SECRET' // Optional for enhanced security
})

Shop Management API

Manage your shops programmatically via our RESTful API.

// Create a new shop
const newShop = await client.shops.create({
  name: 'My New Shop',
  description: 'A brand new shop',
  location: {
    address: 'Hauptstraße 1',
    city: 'Hamburg',
    postalCode: '20095',
    country: 'DE'
  },
  settings: {
    currency: 'EUR',
    timezone: 'Europe/Berlin'
  }
})

// Update shop information
const updatedShop = await client.shops.update('shop-123', {
  name: 'Updated Shop Name',
  settings: {
    notifications: {
      email: true,
      sms: false
    }
  }
})

// Delete a shop
await client.shops.delete('shop-123')

BrandUp Weather Integration

Use our Weather API for weather-based product recommendations and alerts:

// BrandUp Weather Integration
const weather = await client.weather.getCurrent({
  shopId: 'shop-123',
  units: 'metric'
})

// Get weather-based recommendations
const recommendations = await client.weather.getRecommendations({
  shopId: 'shop-123',
  conditions: weather.conditions,
  temperature: weather.temperature,
  season: 'summer'
})

// Subscribe to weather alerts
const subscription = await client.weather.subscribeToAlerts({
  shopId: 'shop-123',
  alertTypes: ['storm', 'heatwave', 'frost'],
  webhookUrl: 'https://your-app.com/weather-alerts'
})

Webhooks

Receive real-time notifications about events in your BrandUp account.

// Register a webhook
const webhook = await client.webhooks.create({
  url: 'https://your-app.com/webhooks/brandup',
  events: ['shop.created', 'shop.updated', 'order.completed'],
  secret: 'your-webhook-secret'
})

// Verify webhook signature (in your webhook handler)
const signature = request.headers['x-brandup-signature']
const isValid = client.webhooks.verifySignature(
  signature,
  request.body,
  'your-webhook-secret'
)

if (!isValid) {
  throw new Error('Invalid webhook signature')
}

// Handle webhook events
switch (event.type) {
  case 'shop.created':
    console.log('New shop created:', event.data)
    break
  case 'order.completed':
    console.log('Order completed:', event.data)
    break
}

Error Handling

Robust error handling is essential for production applications.

// Error handling with try-catch
try {
  const shop = await client.shops.get('shop-123')
} catch (error) {
  if (error.code === 'SHOP_NOT_FOUND') {
    console.error('Shop does not exist')
  } else if (error.code === 'RATE_LIMIT_EXCEEDED') {
    console.error('Too many requests, retry after:', error.retryAfter)
  } else if (error.code === 'INVALID_API_KEY') {
    console.error('Invalid API credentials')
  } else {
    console.error('Unexpected error:', error.message)
  }
}

// Global error handler
client.on('error', (error) => {
  console.error('BrandUp SDK Error:', error)
  // Send to your error tracking service
})
Error CodeDescriptionHTTP Status
INVALID_API_KEYUngültiger oder fehlender API-Schlüssel401
RATE_LIMIT_EXCEEDEDZu viele Anfragen429
RESOURCE_NOT_FOUNDRessource nicht gefunden404

Security & Best Practices

Keep API keys secure

  • • Niemals im Frontend-Code speichern
  • • Umgebungsvariablen verwenden
  • • Regelmäßig rotieren
  • • Zugriffsrechte minimieren

HTTPS required

  • • Alle API-Anfragen über HTTPS
  • • TLS 1.2 oder höher
  • • Zertifikatsvalidierung aktivieren
  • • HTTP-Anfragen werden abgelehnt

SDKs & Libraries

Additional Resources