Customer data
When a customer writes in, the first thing an agent does is look them up: which plan are they on, when did they last pay, what did they order. Connect your product's data and that is already on the ticket, for the agent and for AI drafts, without anyone leaving the page.
There are two ways to connect it. Use either, or both.
| Live lookup | Pushed records | |
|---|---|---|
| How | We call an endpoint of yours with the customer's email address. | You send records to our REST API, tagged with the addresses they belong to. |
| Freshness | Always current: asked when the ticket is opened. | As current as your last push. |
| Stored by us | No. Answers are held for 60 seconds, then forgotten. | Yes, until you delete them. |
| You build | One HTTPS endpoint. | A sync job, or a call wherever a record changes. |
Both need the Production data capability, which a workspace administrator switches on under Settings → Capabilities. A third way, a private read-only copy of your database that we keep in step for you, is planned and not available yet.
Whose records are shown
Records are found by one thing: the email address the ticket is from. An address that is only on CC never unlocks anything, and neither does a name. If a customer writes from an address your product doesn't know, the ticket says there are no records for it.
Live lookup
An administrator opens Settings → Production data, saves your endpoint's address and switches lookups on. Saving the address the first time shows a signing secret (it starts with dsec_). It is shown once. The Test button on the same page asks your endpoint about any address and shows what came back.
What we send
One GET per lookup, with the address added to your URL's query string:
GET /support/customer?email=carol%40example.com HTTP/1.1
Host: api.yourcompany.com
Accept: application/json
User-Agent: Lagotto-Data/1
X-Lagotto-Timestamp: 1767225600
X-Lagotto-Signature: v1=5f2b…c41e
- The address is lowercased. Any query string already on your URL is kept.
- Your endpoint has to be
https, on the standard port, and reachable from the public internet. Addresses on private networks are refused. - Answer within 5 seconds, with
Content-Type: application/jsonand at most 256KB. Redirects are not followed.
These requests come from 34.42.72.117. If your firewall only lets in addresses it knows, add it.
What to answer
For one record about the customer, answer with found, an optional title and url (a link to them in your own admin), and data, an object holding whatever your support team should see:
{
"found": true,
"title": "Carol Customer",
"url": "https://admin.yourcompany.com/customers/381",
"data": {
"plan": "Team",
"seats": 12,
"trial": false,
"renews_at": "2026-09-01T00:00:00Z",
"billing_portal": "https://billing.yourcompany.com/c/381",
"owner": {
"name": "Carol Customer",
"role": "Admin"
},
"recent_orders": [
{
"number": "A-1042",
"total": "$240.00",
"placed_at": "2026-05-02T14:11:00Z",
"url": "https://admin.yourcompany.com/orders/1042"
}
]
}
}
For several records (an account and its orders, say), answer with a list. Each has its own type, title, url and data; up to 20 are read:
{
"records": [
{
"type": "account",
"title": "Carol Customer",
"url": "https://admin.yourcompany.com/customers/381",
"data": {
"plan": "Team",
"seats": 12
}
},
{
"type": "order",
"title": "Order A-1042",
"url": "https://admin.yourcompany.com/orders/1042",
"data": {
"total": "$240.00",
"status": "shipped"
}
}
]
}
When you don't know the address, say so. Either of these means "no such customer":
{
"found": false
}
or a 404 status with any body. Anything else (another status, a timeout, a body that isn't a JSON object) is treated as your endpoint being unavailable, which is shown differently: the ticket says the data couldn't be reached and offers to try again, and the AI is told it could not check. An outage is never shown as a customer with no records.
How it is shown
We know nothing about your fields, so data is read generically. Shape it for the people who will read it:
- A plain value becomes a row. The key is the label:
renews_atreads "Renews at". trueandfalseread Yes and No.- A key ending in
_at,_onor_dateholding an ISO 8601 time is shown as a date in the workspace's time zone. - A value that is an
http(s)address becomes a link. - A list of objects becomes rows, each named by its first field. Give a row a
urland its name links there. The first 10 rows are shown. - An object inside
databecomes a small group of rows, one level deep. - The first 40 fields of a record are shown, in the order you sent them. Put what matters first.
Checking the signature
Your endpoint hands out customer data, so it must be sure the request is ours. Every lookup is signed with your signing secret, the same way as webhooks:
- Take the
X-Lagotto-Timestampheader, a full stop, and theemailparameter as you received it (decoded):timestamp + "." + email. - Compute the HMAC-SHA256 of that string with the signing secret as the key, written in lowercase hex.
- Compare
v1=plus that hex with theX-Lagotto-Signatureheader, using a constant-time comparison. - Refuse a timestamp more than five minutes from your own clock.
Ruby
require "openssl"
require "rack/utils"
# request is a Rack::Request (in Rails: `request`).
def genuine_lookup?(request, secret)
timestamp = request.get_header("HTTP_X_LAGOTTO_TIMESTAMP").to_s
signature = request.get_header("HTTP_X_LAGOTTO_SIGNATURE").to_s
email = request.params["email"].to_s
# Older than five minutes: a replay, or a clock that is badly off.
return false if (Time.now.to_i - timestamp.to_i).abs > 300
expected = "v1=" + OpenSSL::HMAC.hexdigest("SHA256", secret, "#{timestamp}.#{email}")
Rack::Utils.secure_compare(expected, signature)
end
Node.js
const crypto = require("node:crypto")
const express = require("express")
const app = express()
app.get("/support/customer", async (req, res) => {
const timestamp = req.get("X-Lagotto-Timestamp") || ""
const signature = req.get("X-Lagotto-Signature") || ""
const email = String(req.query.email || "")
// Older than five minutes: a replay, or a clock that is badly off.
if (!(Math.abs(Date.now() / 1000 - Number(timestamp)) <= 300)) return res.sendStatus(400)
const expected = "v1=" + crypto.createHmac("sha256", process.env.LOOKUP_SECRET)
.update(`${timestamp}.${email}`).digest("hex")
const ours = Buffer.from(expected)
const theirs = Buffer.from(signature)
if (ours.length !== theirs.length || !crypto.timingSafeEqual(ours, theirs)) return res.sendStatus(401)
const customer = await findCustomerByEmail(email)
if (!customer) return res.json({ found: false })
res.json({ found: true, title: customer.name, url: adminUrl(customer), data: supportView(customer) })
})
Python
import hashlib, hmac, os, time
from flask import Flask, abort, jsonify, request
app = Flask(__name__)
SECRET = os.environ["LOOKUP_SECRET"].encode()
@app.get("/support/customer")
def customer():
timestamp = request.headers.get("X-Lagotto-Timestamp", "")
signature = request.headers.get("X-Lagotto-Signature", "")
email = request.args.get("email", "")
# Older than five minutes: a replay, or a clock that is badly off.
if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300:
abort(400)
expected = "v1=" + hmac.new(SECRET, f"{timestamp}.{email}".encode(), hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected.encode(), signature.encode()):
abort(401)
found = find_customer_by_email(email)
if found is None:
return jsonify(found=False)
return jsonify(found=True, title=found.name, url=admin_url(found), data=support_view(found))
If the secret is lost or may have leaked, an administrator can press Rotate secret. The old one stops working at once.
Pushed records
Send us the records themselves and we keep a copy, found by the customer's email address. A record is identified by a type of your choosing (account, order, subscription) and your own id for it. Pushing the same type and id again replaces what we hold, so a sync can simply send everything.
These calls are part of the REST API: the same address, the same API keys, the same errors. Writing needs a key with write access.
Create or replace a record
curl -X PUT https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/records/account/381 \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"emails": ["carol@example.com", "billing@example.com"],
"title": "Carol Customer",
"url": "https://admin.yourcompany.com/customers/381",
"data": { "plan": "Team", "seats": 12, "renews_at": "2026-09-01T00:00:00Z" }
}'
emails(required): 1 to 20 addresses the record belongs to. A ticket from any of them shows it.titleandurl: what the card is called and where "Open" goes.data: a JSON object of up to 64KB, shown the same way as a live answer.
The answer is 201 the first time and 200 after that, with the record as we stored it.
Read, list and delete
# One record
curl https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/records/account/381 -H "Authorization: Bearer $API_TOKEN"
# Everything we hold for an address, optionally of one type
curl "https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/records?email=carol@example.com&type=order" -H "Authorization: Bearer $API_TOKEN"
# Delete one
curl -X DELETE https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/records/account/381 -H "Authorization: Bearer $API_TOKEN"
Many at once
Up to 500 upserts and deletes in one call. Each item stands alone: one that is refused says why in its own result, and the rest still go through.
curl -X POST https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/records/batch \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"records": [
{ "type": "account", "external_id": "381", "emails": ["carol@example.com"], "title": "Carol Customer", "data": { "plan": "Team" } },
{ "type": "order", "external_id": "A-1042", "emails": ["carol@example.com"], "data": { "total": "$240.00" } },
{ "type": "order", "external_id": "A-0007", "delete": true }
]
}'
{
"data": [
{
"type": "account",
"external_id": "381",
"status": "updated",
"errors": null
},
{
"type": "order",
"external_id": "A-1042",
"status": "created",
"errors": null
},
{
"type": "order",
"external_id": "A-0007",
"status": "not_found",
"errors": null
}
],
"summary": {
"updated": 1,
"created": 1,
"not_found": 1
}
}
status is created, updated, deleted, not_found (a delete of something we don't hold) or error, with errors saying which field was refused.
Limits
| What | Limit |
|---|---|
| Live lookup answer | 5 seconds, 256KB, 20 records |
A pushed record's data | 64KB of JSON |
| Addresses on a record | 20 |
type and external_id | Letters, numbers and . _ - : |
| Records in a batch | 500 |
| Records in a workspace | 1,000,000. Beyond that, new ones are refused until some are deleted. |
| Records shown on a ticket | The 25 most recently updated for the address |
| API requests | 300 a minute per key, as for the rest of the API |
What the AI does with it
When AI drafts are on, a draft can look up the ticket's customer before it answers a question about their account. It gets the same records an agent sees, for that one customer and nobody else: it has no way to ask about another address.
- It is told to check the customer's records before answering anything about their account, and never to put internal identifiers, or data about anyone else, in the reply.
- If your endpoint is down, it is told the data could not be checked, not that the customer has none, and says so in its note to the agent.
- It only drafts. A person reads the draft and sends it.
- The same lookup is available to assistants connected over MCP, as
get_customer_data.
Privacy
- Send only what support should see. Everyone with a seat in the workspace, read-only seats included, can read what you return or push for a ticket's customer, and so can the AI. Leave out passwords, payment card numbers, government ids and anything your own support team wouldn't be shown.
- Live answers are not stored: they are kept for 60 seconds to spare your endpoint, then dropped.
- Pushed records stay until you delete them through the API, or an administrator deletes them under Settings → Production data. Deleting a record there is written to the audit log.
- Each time somebody opens a customer's records on a ticket, we log who and which ticket.
- The signing secret is stored encrypted and shown once.