Wexlyn
Back to the docs

Developers

Developers: API, webhooks and MCP

How to read and write Wexlyn data from your own code or from Claude.

GET /v1/sales?from=2026-10-01

Authorization: Bearer wx_live_…

200 OK · 212 sales · $148,920

Agency workspace

  • Harbor Coffee
  • Northwind Dental
  • + unlimited clients
webhooks · HMACMCP serverZapierwhite label

Settings → Developers is where API keys, outbound webhooks, the MCP connection and request logs live.

API keys

Create a key with a name, a scope (read-only or read + write) and a per-minute limit. The full key is shown once and starts with wx_live_. Wexlyn stores only a peppered SHA-256 hash, so keep your copy safe. Revoke any time; the last-used time is shown per key. Keys belong to the account that was active when you created them.

REST API v1

Base URL https://app.wexlyn.ai/api/v1, bearer authentication, JSON in and out. The OpenAPI 3.1 description is served at /api/v1/openapi.json.

# Who am I
curl https://app.wexlyn.ai/api/v1/me -H "Authorization: Bearer wx_live_..."

# Search leads
curl "https://app.wexlyn.ai/api/v1/leads?search=jane" -H "Authorization: Bearer wx_live_..."

# Record a sale (write key)
curl -X POST https://app.wexlyn.ai/api/v1/sales \
  -H "Authorization: Bearer wx_live_..." -H "Content-Type: application/json" \
  -d '{"email":"jane@example.com","amount":997,"currency":"USD","order_id":"A1001","product":"Coaching program"}'

# Performance report, Scientific model, last 30 days, grouped by campaign
curl "https://app.wexlyn.ai/api/v1/reports/performance?model=scientific&groupBy=campaign" \
  -H "Authorization: Bearer wx_live_..."
EndpointScopeWhat it does
GET /mereadAccount and key scopes
GET /leads, GET /leads/{id}readSearch leads; one lead with sales, calls and journey
POST /leads, POST /leads/{id}/stagewriteCreate/identify a lead; move it to a stage
GET /sales, POST /salesread / writeList sales; record a sale (deduped by order_id)
GET /subscriptions, POST /subscriptionsread / writeList subscriptions; record or update one (one record per subscription_id)
GET /calls, POST /callsread / writeList calls; record a call with outcome and closer
GET /sources, POST /sourcesread / writeList sources; create a manual source with its ?sl= link
GET /reports/performancereadThe Performance report with every setting the UI has
GET /reports/adsreadAd-level metrics keyed by platform ids (what the Chrome extension reads)
GET /reports/entity-drillreadThe sales, calls or leads behind one number of one campaign, ad set or ad: platform, level, id, column, plus from, to, model. Newest 200
Agency keysread / writeA key created from the Agency Hub reaches every client account: add Wexlyn-Account: <account id> (the public id from the Clients page) on each call; GET /me without it lists the accounts
POST /aevent/eventswriteWebinar registrations and attendance from AEvent's built-in Wexlyn integration (one registrant or a batch of up to 500; see Connecting AEvent)

Errors come back as { "error": { "code", "message" } } with 401 (bad key), 403 (missing scope), 422 (validation), 429 (rate limit). Re-sending a sale with the same order_id updates instead of duplicating.

Webhooks

Sale recorded

Stripe webhook

Wexlyn signs it

X-Wexlyn-Signature · HMAC

Your endpoint

verify, then act

POST https://yourapp.com/hooks/wexlyn
X-Wexlyn-Signature: t=1760000000,v1=9f2a…
{ "type": "sale.created", "data": { "amount": 2400, "source": "meta/webinar/hook-a" } }

Endpoints live under Settings → Developers, on the Webhooks tab (1): enter the address, switch on the events it should receive and press Add endpoint (2). Send test (3) posts a sample delivery to an endpoint you already have.

Register an https endpoint and pick events: lead.created, lead.stage_changed, sale.created, call.created, subscription.updated. Every delivery is a JSON POST:

{ "id": "evt_…", "event": "sale.created", "created_at": "2026-10-08T21:30:00Z",
  "data": { "order_id": "…", "lead_id": "…", "amount": 997, "currency": "USD", "products": ["Coaching program"] } }

Headers: Wexlyn-Event, Wexlyn-Delivery and Wexlyn-Signature: t=<unix>,v1=<hex> where v1 = HMAC_SHA256(secret, t + "." + body). Reject anything older than five minutes or with a bad signature. Non-2xx answers retry after 1, 5, 30, 120 and 720 minutes; the delivery log shows every attempt and lets you retry or send a test ping.

MCP server

Claude Code, Claude Desktop and claude.ai can talk to your account through https://app.wexlyn.ai/api/mcp (Streamable HTTP). Authenticate with an API key in the Authorization header:

claude mcp add --transport http wexlyn https://app.wexlyn.ai/api/mcp \
  --header "Authorization: Bearer wx_live_..."

Tools: list_accounts, get_account, list_sources, get_performance_report, search_leads, get_lead, list_sales, list_calls with any key, plus create_lead, create_sale, create_call, set_lead_stage with a write key. Every call shows under Request logs with source MCP.

An agency key (one key for every client account) works here too: each tool takes an account argument with the client account's name or id, and list_accounts names them.

Claude and other MCP clients

Wexlyn is a connector for Claude, Grok and ChatGPT. In claude.ai or Claude Desktop open Settings → Customize → Connectors, find Wexlyn in the directory (or Add custom connector with https://app.wexlyn.ai/api/mcp) and press Connect: a Wexlyn sign-in opens, you choose one account or all of your accounts (an agency reaches every client account from one connection) and allow read (or read and write) access, and Claude can then run every tool below. With several accounts the assistant calls list_accounts and passes the account's name as the account argument of each tool; a call that names no account is refused with the list of accounts. In Grok open grok.com/connectors, choose New Connector → Custom, paste the same URL and save. In ChatGPT (Business, Enterprise and Edu) turn on Developer mode under Settings → Apps → Advanced settings, then Settings → Apps → Create, paste the URL, choose OAuth, press Scan Tools and sign in; on the plugins page (chatgpt.com/plugins) press + → Add custom MCP server. In Claude Code run claude mcp add --transport http wexlyn https://app.wexlyn.ai/api/mcp and type /mcp to sign in. Cursor and other MCP clients work the same way (OAuth 2.1 with PKCE, dynamic client registration open to any client, client ID metadata documents, metadata at /.well-known/oauth-authorization-server). The consent screen names the app that is asking, and every connected session is listed under Settings → Integrations → AI Assistants (one tile each for Claude, Grok and ChatGPT), where it can be disconnected. ChatGPT's deep research and company knowledge use the search and fetch tools; get_health returns the hourly health alerts and get_match_quality the ad-platform match-quality check, so a scheduled task in your assistant can run a morning check-in; the rest of the catalogue is shared by every client.

Zapier

Wexlyn has its own Zapier app. Open the Zapier card under Settings → Integrations and add the app with the invite button, then connect it with an API key that has read and write access (Settings → API keys).

  • Triggers: New Sale, New Lead, New Call Booked, Lead Stage Changed. They are instant: Zapier subscribes through POST /api/v1/hooks and Wexlyn delivers the same signed payload as any outbound webhook.
  • Actions: Send Sale / Conversion, Create or Update Lead, Log Call, Update Lead Stage (the stage dropdown comes from Settings → Lead stages, and a name that is not on that list yet is added to it; POST /api/v1/leads/stage and GET /api/v1/stages behind it). Each takes the person's email or phone, optional UTM values and click ids (fbclid, gclid, ttclid, msclkid) so the record lands on the right ad, and is idempotent on order_id / call_id / email.
  • Search: Find Lead by email or phone, also available as Find or Create Lead.

The same endpoints work from any HTTP client: GET /api/v1/leads/find?email=…, POST /api/v1/hooks with { "target_url", "event" } (events lead.created, lead.stage_changed, sale.created, call.created, call.booked, subscription.updated) and DELETE /api/v1/hooks/{id}.

Subscriptions and lifetime value

Lifetime value is worked out from sales, so every charge has to reach Wexlyn as its own sale: the first payment and each renewal, with the same email (or external_id) for the person, a unique and stable order_id per charge, the real charge time in date, and the plan as product. A refund is the same order_id sent again with "status": "refunded".

A subscription record adds what sales alone cannot show: monthly recurring revenue, who is active, trialing or past due, and who canceled when. Send one when a subscription starts and again whenever it changes:

curl -X POST https://app.wexlyn.ai/api/v1/subscriptions \
  -H "Authorization: Bearer wx_live_..." -H "Content-Type: application/json" \
  -d '{"email":"jane@example.com","subscription_id":"sub_1001","status":"active","plan":"Pro monthly","amount":49,"currency":"USD","interval":"month","started_at":"2026-11-01T15:04:05Z"}'
FieldRequiredNotes
email, phone or external_idone of themThe person; the same value you send with their sales
subscription_idyesYour id for the subscription. Sending it again updates the record instead of adding one
amountyesThe price of one billing period, in currency (default USD)
intervalnoday, week, month (default) or year
statusnoactive (default), trialing, past_due, canceled, paused, incomplete
plannoPlan name as you want to see it in Wexlyn
started_at, canceled_at, current_period_endnoISO 8601 times. A canceled subscription sent without canceled_at is dated at the time of the call
testnotrue keeps it out of the numbers

Fields left out of a later call keep their stored value, so a status change can be as short as {"email":"jane@example.com","subscription_id":"sub_1001","status":"canceled","amount":49}. Monthly recurring revenue counts a subscription while it is active or past_due; a yearly price is divided by twelve. Each change also fires the subscription.updated webhook event.

Your own definition of "new"

New Customers (and Cost per New Customer) count people whose first ever sale is in the date range, and New Leads count people Wexlyn saw for the first time. Both are judged from what Wexlyn holds, so somebody who bought or signed up before you started sending data looks new. Two ways to make them match your own books:

  • Say it yourself. Add "new_customer": true or false to POST /api/v1/sales when your system knows whether this is the person's first purchase (a first-time donor, a first order). Wexlyn then takes your answer instead of working it out.
  • Load the history once. Import past customers and subscribers with their original dates (CRM → Sales → Import and CRM → Leads → Import, with the file's date column mapped to Date; or POST /api/v1/sales with date set to the original time). Everyone already on file then stops counting as new.

To report them under your own names, add custom metrics under Settings → Custom metrics, for example "New donors" as newCustomers, "Cost per new donor" as cost / newCustomers, "Net new leads" as newLeads and "Cost per net new lead" as cost / newLeads. They appear as columns in every report and widget.

Dates and times

Any time you send (occurred_at or date on a sale, scheduled_at on a call, a subscription's dates, and the Sale time field of the Zapier step) can be written as 2026-11-19T14:30:00Z, with an offset such as 2026-11-19T14:30:00+13:00, as a plain day 2026-11-19, or as Unix time. A time without a zone is read as UTC. A sale sent with a time lands on that day in your reports; without one it is dated now.

Make and n8n

For other no-code tools use the Make / n8n / Webhook integration under Settings → Integrations: it gives you a private URL that accepts the same lead, sale, call and stage payloads without an API key, or call the REST API above with a key.

Match keys on leads and sales

POST /api/v1/leads and POST /api/v1/sales take, besides the person, the browser facts you have: fbclid, gclid, msclkid, ttclid, fbc, fbp, ip, user_agent, the utm_* values, and the address city, state, zip, country. Wexlyn stores them on the person and sends them to Meta, Google and the other platforms with every conversion as match keys. A sale pushed from a data warehouse with an email alone matches far fewer people than one with the phone, name, postcode and the click id of the visit; send what you have.