Skip to main content
Widgets are embeddable UI components that you configure once and deploy anywhere. Each widget stores its type, configuration, and theme so you can render consistent payment experiences across multiple pages or apps.
Widget CRUD endpoints require write permission. Listing and retrieving widgets (including stats) require read permission.

Authentication

Authorization: Bearer asp_xxx
Base URL: https://platform-api.anyspend.com/api/v1

Endpoints

List Widgets

GET /widgets
read
List all widget configurations for your account.
curl -X GET https://platform-api.anyspend.com/api/v1/widgets \
  -H "Authorization: Bearer asp_xxx"
Response
{
  "success": true,
  "data": [
    {
      "id": "wgt_abc123",
      "name": "Homepage Checkout",
      "widget_type": "checkout",
      "description": "Primary checkout widget for the homepage",
      "config": {
        "recipient_address": "0x...",
        "destination_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "destination_chain_id": 8453,
        "amount": "10000000"
      },
      "theme": {
        "primary_color": "#4f46e5",
        "border_radius": 12,
        "font_family": "Inter"
      },
      "views_count": 1240,
      "created_at": "2026-01-10T08:00:00Z",
      "updated_at": "2026-02-20T14:30:00Z"
    }
  ]
}

Create Widget

POST /widgets
write
Create a new widget configuration.
name
string
required
Human-readable name for the widget.
widget_type
string
required
The type of widget to create. One of: swap, checkout, nft, deposit.
config
object
required
Widget-specific configuration object. Contents vary by widget_type (see Widget Types below).
description
string
Optional description for internal reference.
theme
object
Visual theme overrides. See Theme Object below.
curl -X POST https://platform-api.anyspend.com/api/v1/widgets \
  -H "Authorization: Bearer asp_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Checkout",
    "widget_type": "checkout",
    "description": "Checkout widget for the product page",
    "config": {
      "recipient_address": "0x1234567890abcdef1234567890abcdef12345678",
      "destination_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "destination_chain_id": 8453,
      "amount": "25000000"
    },
    "theme": {
      "primary_color": "#2563eb",
      "border_radius": 8
    }
  }'
Response
{
  "success": true,
  "data": {
    "id": "wgt_def456",
    "name": "Product Checkout",
    "widget_type": "checkout",
    "description": "Checkout widget for the product page",
    "config": {
      "recipient_address": "0x1234567890abcdef1234567890abcdef12345678",
      "destination_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "destination_chain_id": 8453,
      "amount": "25000000"
    },
    "theme": {
      "primary_color": "#2563eb",
      "border_radius": 8
    },
    "views_count": 0,
    "created_at": "2026-02-27T12:00:00Z",
    "updated_at": "2026-02-27T12:00:00Z"
  }
}

Get Widget

GET /widgets/:id
read
Retrieve a single widget configuration by ID.
curl -X GET https://platform-api.anyspend.com/api/v1/widgets/wgt_def456 \
  -H "Authorization: Bearer asp_xxx"

Update Widget

PATCH /widgets/:id
write
Update an existing widget configuration. All fields are optional — only provided fields are changed.
curl -X PATCH https://platform-api.anyspend.com/api/v1/widgets/wgt_def456 \
  -H "Authorization: Bearer asp_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Checkout",
    "config": {
      "recipient_address": "0x1234567890abcdef1234567890abcdef12345678",
      "destination_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "destination_chain_id": 8453,
      "amount": "50000000"
    },
    "theme": {
      "primary_color": "#059669"
    }
  }'

Delete Widget

DELETE /widgets/:id
write
Permanently delete a widget configuration. Existing embeds using this widget ID will stop rendering.
curl -X DELETE https://platform-api.anyspend.com/api/v1/widgets/wgt_def456 \
  -H "Authorization: Bearer asp_xxx"

Get Widget Stats

GET /widgets/:id/stats
read
Retrieve view statistics for a widget. Includes total views and a daily breakdown.
curl -X GET https://platform-api.anyspend.com/api/v1/widgets/wgt_def456/stats \
  -H "Authorization: Bearer asp_xxx"
Response
{
  "success": true,
  "data": {
    "widget_id": "wgt_def456",
    "total_views": 1240,
    "daily": [
      { "date": "2026-02-27", "views": 85 },
      { "date": "2026-02-26", "views": 102 },
      { "date": "2026-02-25", "views": 93 }
    ]
  }
}

Widget Object

FieldTypeDescription
idstringUnique widget identifier (e.g., wgt_abc123)
namestringHuman-readable widget name
widget_typestringWidget type: swap, checkout, nft, or deposit
descriptionstring | nullOptional description
configobjectWidget-type-specific configuration
themeobject | nullVisual theme overrides
views_countnumberTotal number of widget renders
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last update timestamp

Widget Types

Payment checkout widget for accepting crypto or fiat payments.
Config FieldTypeDescription
recipient_addressstringMerchant wallet address
destination_tokenstringToken contract address to receive
destination_chain_idnumberChain ID for destination token
amountstringPayment amount in smallest unit

Theme Object

FieldTypeDefaultDescription
primary_colorstring#4f46e5Primary accent color (hex)
border_radiusnumber12Border radius in pixels
font_familystringInterFont family name
dark_modebooleanfalseEnable dark mode rendering