API Documentation

Integrate Euler's AI-powered shopping assistant into your e-commerce platform.

Getting Started

Euler provides a set of APIs that allow you to integrate our AI-powered shopping assistant into your e-commerce platform. Our APIs are RESTful and return JSON responses.

To get started, you'll need an API key. You can obtain one by signing up for an account on our website and navigating to the API section of your dashboard.

Authorization: Bearer YOUR_API_KEY

Chat API

The Chat API allows you to interact with our AI-powered shopping assistant. You can send messages and receive responses that help users find products, answer questions, and provide recommendations.

POST /api/chat

Request Body

{
  "message": "Show me black boots under $200",
  "conversationId": "optional-conversation-id",
  "userId": "optional-user-id"
}

Response

{
  "id": "msg_123456789",
  "role": "assistant",
  "content": "I found several black boots under $200. Here are the top options based on customer ratings.",
  "timestamp": "2023-06-15T14:30:00Z"
}

Integration Guide

Integrating Euler into your e-commerce platform is easy. You can either use our pre-built components or build your own using our APIs.

Option 1: Embed Script

The easiest way to integrate Euler is to use our embed script. Simply add the following code to your website:

<script>
  (function(w,d,s,o,f,js,fjs){
    w['EulerWidget']=o;w[o]=w[o]||function(){(w[o].q=w[o].q||[]).push(arguments)};
    js=d.createElement(s),fjs=d.getElementsByTagName(s)[0];
    js.id=o;js.src=f;js.async=1;fjs.parentNode.insertBefore(js,fjs);
  }(window,document,'script','euler','https://eulerai.app/api/widget.js'));
  euler('init', { apiKey: 'YOUR_API_KEY' });
</script>

Option 2: React Component

If you're using React, you can use our React component:

import { EulerChat } from '@euler/react';

function App() {
  return (
    <div>
      <h1>My E-commerce Store</h1>
      <EulerChat apiKey="YOUR_API_KEY" />
    </div>
  );
}

Option 3: Custom Integration

If you want more control over the integration, you can use our APIs directly:

// Example: Sending a message to the Chat API
async function sendMessage(message) {
  const response = await fetch('https://api.eulerai.app/chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({ message })
  });
  
  return response.json();
}

Rate Limits

Our API has rate limits to ensure fair usage and maintain service quality. The limits vary based on your subscription plan:

  • Free: 100 requests per day
  • Basic: 1,000 requests per day
  • Pro: 10,000 requests per day
  • Enterprise: Custom limits

If you exceed your rate limit, you'll receive a 429 Too Many Requests response. The response will include a Retry-After header indicating how long you should wait before making another request.

Error Handling

Our API uses standard HTTP status codes to indicate the success or failure of a request. In case of an error, the response will include an error object with a message and code:

{
  "error": {
    "code": "invalid_request",
    "message": "The request was invalid. Please check your parameters and try again."
  }
}

Common error codes include:

  • invalid_request: The request was malformed or missing required parameters
  • authentication_error: Invalid or missing API key
  • rate_limit_exceeded: You've exceeded your rate limit
  • server_error: An internal server error occurred

Support

If you have any questions or need help with our API, please contact our support team at api-support@eulerai.app or visit our contact page.