Skip to main content

API Documentation

Overview

Euro Gadgets Exchange provides a RESTful API for B2B electronics trading. All API endpoints require authentication.

Authentication

All API requests require a valid session token. Use NextAuth.js for authentication.

// Example: Get session
import { auth } from "@/lib/auth";

const session = await auth();
if (!session?.user) {
  return { error: "Unauthorized" };
}

Available Endpoints

Listings

Manage supply listings (Want to Sell)

POST/api/listings- Create listing
GET/api/listings- Get all listings

Want to Buy Requests

Manage demand requests (WTB)

POST/api/wtb- Create WTB request
GET/api/wtb- Get all WTB requests

Matches

Manage matches between supply and demand

GET/api/matches- Get all matches
PUT/api/matches/:id/stage- Update match stage

Messages

Manage deal messages

POST/api/messages- Send message
GET/api/messages/:matchId- Get match messages

Rate Limiting

API requests are rate limited to prevent abuse. Current limits:

  • 100 requests per minute for authenticated users
  • 1000 requests per hour for authenticated users
  • 10 requests per minute for unauthenticated users

Error Handling

All errors return JSON with the following format:

{
  "error": "Error message",
  "code": "ERROR_CODE",
  "details": { ... }
}

Support

For API support, contact: support@euro-gadgets.com