API DOCUMENTATION

OneDollar provides a simple REST API for widget integration and data management.

BASE URL

https://onedollar.dev/api/v1

WIDGET ENDPOINTS

Submit Widget Data

Submit data to a widget (feedback, contact, waitlist)

POST /widgets/{widget_key}/submit

Get Widget Configuration

Retrieve widget settings and configuration

GET /widgets/{widget_key}/configuration

List Widget Entries

Get all submissions for a widget (requires authentication)

GET /widgets/{widget_key}/entries

Query params: ?unread=true&limit=100&offset=0&since=2024-01-01&until=2024-12-31

Get Single Entry

Get a specific entry by ID (requires authentication)

GET /widgets/{widget_key}/entries/{id}

AUTHENTICATION

Widget submission endpoints (/submit and /configuration) are public and don't require authentication. Entry management endpoints (/entries) require API key authentication.

Authorization: Bearer YOUR_API_KEY

API keys can be generated in Dashboard → API Settings

CORS

The API supports CORS for widget submissions. Widgets hosted on onedollar.dev can be embedded on any domain. Domain restrictions can be configured per widget in the dashboard settings.

REQUEST/RESPONSE FORMAT

Submit Widget Data

POST /api/v1/widgets/{widget_key}/submit
Content-Type: application/json

{
  "email": "user@example.com",
  "message": "Your feedback here"
  // Additional fields based on widget configuration
}

Response (200 OK):
{
  "success": true,
  "message": "Thank you for your feedback!"
}

Get Entries Response

GET /api/v1/widgets/{widget_key}/entries
Authorization: Bearer YOUR_API_KEY

Response (200 OK):
{
  "entries": [
    {
      "id": 123,
      "data": {
        "email": "...",
        "message": "..."
      },
      "created_at": "2024-01-01T12:00:00Z",
      "read": false,
      "page_url": "https://example.com",
      "user_agent": "Mozilla/5.0..."
    }
  ],
  "total": 42,
  "widget": {
    "key": "fdb-abc123",
    "type": "FeedbackWidget",
    "name": "Main Feedback"
  }
}

ERROR RESPONSES

403 Forbidden

Origin not whitelisted or API key invalid

404 Not Found

Widget key doesn't exist

422 Unprocessable Entity

Widget inactive or validation errors

429 Too Many Requests

Rate limit exceeded

RATE LIMITS

• 1000 requests per hour per widget
• Monthly submission limits based on widget configuration
• Burst protection: max 10 requests per second