Reseller API

Public documentation for resellers to check API status, fetch products, check wallet balance and place orders programmatically.

Base URL

https://aidigitaltools.lovable.app/api/public/v1

Authentication

Send your API key on every protected request. Health check does not require authentication.

Authorization: Bearer YOUR_API_KEY

Alternative:
X-API-Key: YOUR_API_KEY

Endpoints

1. Health check

GET https://aidigitaltools.lovable.app/api/public/v1/health
{
  "success": true,
  "message": "Reseller API is running successfully",
  "version": "v1"
}

2. Get wallet balance

GET https://aidigitaltools.lovable.app/api/public/v1/balance
{
  "balance": 125.5,
  "discount_percent": 10,
  "rate_limit_per_minute": 60
}

3. List products

GET https://aidigitaltools.lovable.app/api/public/v1/products
GET https://aidigitaltools.lovable.app/api/public/v1/products?category_id=<uuid>
{
  "products": [
    {
      "id": "PRODUCT_UUID",
      "name": "Product name",
      "description": "Product description",
      "price": 10,
      "stock": 25,
      "category_id": "CATEGORY_UUID",
      "auto_deliver": true,
      "your_price": 9,
      "your_discount_percent": 10
    }
  ],
  "default_discount_percent": 10
}

4. Get a single product

GET https://aidigitaltools.lovable.app/api/public/v1/products/{id}
{
  "product": {
    "id": "PRODUCT_UUID",
    "name": "Product name",
    "price": 10,
    "stock": 25,
    "custom_fields": [],
    "your_price": 9,
    "your_discount_percent": 10
  }
}

5. Create an order

POST https://aidigitaltools.lovable.app/api/public/v1/orders
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "product_id": "PRODUCT_UUID",
  "quantity": 1,
  "customer_ref": "your-internal-id",
  "custom_data": {}
}
{
  "order": {
    "id": "ORDER_UUID",
    "status": "delivered",
    "product_id": "PRODUCT_UUID",
    "product_name": "Product name",
    "quantity": 1,
    "unit_price": 9,
    "total": 9,
    "customer_ref": "your-internal-id",
    "created_at": "2026-06-20T10:00:00.000Z",
    "delivery": {
      "text": "Delivered item content"
    }
  },
  "balance": 116.5
}

6. Get order status

GET https://aidigitaltools.lovable.app/api/public/v1/orders/{id}
{
  "order": {
    "id": "ORDER_UUID",
    "status": "delivered",
    "product_id": "PRODUCT_UUID",
    "product_name": "Product name",
    "quantity": 1,
    "total": 9,
    "customer_ref": "your-internal-id",
    "created_at": "2026-06-20T10:00:00.000Z",
    "delivered_at": "2026-06-20T10:00:05.000Z",
    "cancel_reason": null,
    "delivery": { "text": "Delivered item content", "image_url": null, "video_url": null }
  }
}

Possible status values: pending, processing, delivered, cancelled, refunded.

7. Cancel an order

Only orders that are not yet delivered, cancelled, or refunded can be cancelled. Full order amount is refunded back to your wallet.

POST https://aidigitaltools.lovable.app/api/public/v1/orders/{id}/cancel
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{ "reason": "Customer changed their mind" }
{
  "order": { "id": "ORDER_UUID", "status": "cancelled", "refunded": 9, "cancel_reason": "Customer changed their mind" },
  "balance": 125.5
}

cURL examples

curl -X GET "https://aidigitaltools.lovable.app/api/public/v1/health"   -H "Accept: application/json"
curl -X GET "https://aidigitaltools.lovable.app/api/public/v1/balance"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Accept: application/json"
curl -X POST "https://aidigitaltools.lovable.app/api/public/v1/orders"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{
    "product_id": "PRODUCT_UUID",
    "quantity": 1,
    "customer_ref": "order-1001",
    "custom_data": {}
  }'
curl -X GET "https://aidigitaltools.lovable.app/api/public/v1/orders/ORDER_UUID"   -H "Authorization: Bearer YOUR_API_KEY"
curl -X POST "https://aidigitaltools.lovable.app/api/public/v1/orders/ORDER_UUID/cancel"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"reason":"Customer changed their mind"}'

Error codes

  • 400 — Invalid request body or missing required field
  • 401 — Missing or invalid API key
  • 402 — Insufficient wallet balance
  • 403 — API key revoked
  • 404 — Product not found or route does not exist
  • 409 — Out of stock
  • 429 — Rate limit exceeded

Keep your API key private. If it leaks, ask admin to revoke and reissue a new one.