API access

Let your own systems send chats and discount offers

Your keys

A key is shown once, when you create it. Store it somewhere safe — we keep only a scrambled copy.

No keys yet

Create your first key to let another system open chats and send discount offers.

How to use it

Send your key in the Authorization header on every request. Base address: https://your-workspace.lovable.app

Start a chat

curl -X POST https://your-workspace.lovable.app/api/public/v1/conversations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada","email":"ada@example.com","message":"Is this in stock?"}'

Read and reply

# read the thread
curl https://your-workspace.lovable.app/api/public/v1/conversations/CONVERSATION_ID/messages \
  -H "Authorization: Bearer YOUR_API_KEY"

# post a reply
curl -X POST https://your-workspace.lovable.app/api/public/v1/conversations/CONVERSATION_ID/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"author":"agent","authorName":"Sales","body":"Yes, 4 left."}'

Push a discount offer

curl -X POST https://your-workspace.lovable.app/api/public/v1/offers \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"visitorId":"visitor-42","visitorName":"Ada","page":"/products/red-shoes",
       "productName":"Red shoes","price":49.9,"percent":15,"validMinutes":20,
       "message":"15% off the red shoes for the next 20 minutes."}'

Add GET /offers to see whether an offer was claimed, dismissed or expired. Everything created this way lands in your inbox and visitor screens like any other conversation.