AestheticData examples
Copy-and-paste examples for the AestheticData pay-per-call API. The snippets show a free sample request, an unpaid HTTP 402, and a paid retry with x402 v2.
This page is a set of examples. It is not a hosted service, and it is not affiliated with the European Commission or the FDA.
Docs and discovery
- Site: https://aestheticdata.io
- Agent guide (llms.txt): https://api.aestheticdata.io/llms.txt
- OpenAPI: https://api.aestheticdata.io/openapi.json
- Free sample (no payment): https://api.aestheticdata.io/sample
- x402 discovery: https://api.aestheticdata.io/.well-known/x402
Paid routes and prices
Base URL: https://api.aestheticdata.io. EU device data as of 2026-11-09. Prices are fixed and also appear in the 402 response before you pay.
| Method | Path | Price |
|---|---|---|
| GET | /x402/ |
0.001 USDC per call |
| GET | /x402/ |
0.002 USDC per page |
| GET | /x402/ |
0.002 USDC per page |
| POST | /x402/ |
0.005 USDC per call |
| GET | /x402/ |
0.002 USDC per page |
| POST | /x402/ |
0.003 USDC per call |
/x402/regulatory/eu/devices is the aesthetic-medicine subset of the public EUDAMED UDI-DI list (14,000+ EU devices, EU MDR scope), synced from the EUDAMED API: medical devices (dermal fillers and filling kits, breast and facial implants, barbed threads, liposuction) plus Annex XVI aesthetic equipment. Not filtered by risk class or country. Devices no longer listed in EUDAMED are excluded. Price is 0.002 USDC per page.
POST /x402/crosswalk/eu-us compares one EU aesthetic device with US FDA public records. Some EU aesthetic devices can be found in US FDA public records. Informational. Not for clinical decisions. Not affiliated with the FDA.
The change feed at /x402/changes/eu is available, but it is a poor first integration target while the upstream EUDAMED /udi feed is unavailable (it has been HTTP 404 since 2026-11-16). Prefer brands, products, verify, or crosswalk if you are trying the API for the first time.
Free vs charged
- Free, no wallet:
GET /sample,/sample/brands,/sample/eu_devices,/sample/verify,/sample/changes, and/x402/crosswalk/eu-us/sample(5 illustrative examples, not real matches). - Charged: a no-match on verify; a crosswalk response with no corresponding US record; an empty changes page.
- Free HTTP 400 before payment (no payment headers): invalid
since/ other invalid change-feed parameters; aproduct_namethat contains no letter or digit (verify and crosswalk); asincetimestamp more than five minutes in the future. - Not charged: if a verify or crosswalk lookup exceeds the server time limit, the API returns HTTP 503 (lookup_timeout) with Retry-After and does not settle.
Snippets
Start with the free sample. For paid calls, put any wallet key in an environment variable and set a small spend cap. Never commit a private key.
snippets/01-curl-sample-and-402.sh— free sample + unpaid 402 (no wallet)snippets/02-python-sample-and-402.py— same in Python, with notes for a paid retry using thex402SDKsnippets/03-ts-x402-fetch.ts— paid retry with@x402/fetchand@x402/evm(x402 v2, networkeip155:8453)
The TypeScript snippet follows the @x402/fetch 2.31.0 public README (wrapFetchWithPaymentFromConfig + ExactEvmScheme).
#!/usr/bin/env bash
# Free sample + unpaid HTTP 402 against the live AestheticData API.
# No wallet and no payment. Safe to run.
set -euo pipefail
BASE="https://api.aestheticdata.io"
echo "== Free sample (no payment) =="
curl -sS "$BASE/sample" | python3 -m json.tool | head -n 40
echo
echo "== Unpaid GET /x402/brands (expect HTTP 402) =="
tmp="$(mktemp)"
hdr="$(mktemp)"
code="$(curl -sS -D "$hdr" -o "$tmp" -w "%{http_code}" "$BASE/x402/brands")"
echo "HTTP $code"
# Show status and payment-related headers only.
awk 'BEGIN{IGNORECASE=1} /^HTTP\// || /^[Cc]ontent-[Tt]ype:/ || /[Pp]ayment/ {print}' "$hdr"
echo
echo "The v2 challenge is the PAYMENT-REQUIRED header (Base64)."
echo "Atomic amount 1000 = 0.001 USDC. Do not send a bare transaction hash."
echo "To pay, retry the same request with PAYMENT-SIGNATURE (see the TypeScript snippet)."
#!/usr/bin/env python3
"""Free sample + unpaid HTTP 402. No wallet required.
A paid retry should use the published x402 Python SDK (PyPI package x402,
extras httpx and evm) with a signer that you already hold. This file does
not construct a payment and does not read a private key, so it is safe to run
as-is.
"""
from __future__ import annotations
import json
import sys
import urllib.error
import urllib.request
BASE = "https://api.aestheticdata.io"
def get(path: str) -> tuple[int, dict[str, str], bytes]:
req = urllib.request.Request(BASE + path, method="GET")
try:
with urllib.request.urlopen(req, timeout=30) as res:
return res.status, {k.lower(): v for k, v in res.headers.items()}, res.read()
except urllib.error.HTTPError as exc:
return exc.code, {k.lower(): v for k, v in exc.headers.items()}, exc.read()
def main() -> int:
status, _headers, body = get("/sample")
print(f"GET /sample -> HTTP {status}")
data = json.loads(body.decode())
datasets = [d.get("dataset") for d in data.get("datasets", [])]
print("datasets:", datasets)
print("This path is free. No payment header is required.")
print()
status, headers, body = get("/x402/brands")
print(f"GET /x402/brands -> HTTP {status}")
print("content-type:", headers.get("content-type"))
print("PAYMENT-REQUIRED present:", "payment-required" in headers)
if status != 402:
print("Unexpected status; expected 402 on an unpaid paid route.", file=sys.stderr)
return 1
print("v2 clients decode PAYMENT-REQUIRED (Base64) and retry with PAYMENT-SIGNATURE.")
print("v1 clients read the JSON body and retry with X-PAYMENT. Do not send both.")
print("Atomic amount 1000 = 0.001 USDC.")
print("Paid retry: use package x402 with extras [httpx, evm], keep keys in the environment,")
print("and cap spend at the route price (0.001-0.005 USDC).")
return 0
if __name__ == "__main__":
raise SystemExit(main())
/**
* Paid GET /x402/brands using @x402/fetch (v2.31.x) and @x402/evm.
*
* Start with the free sample (no key) if you only want to inspect the schema:
* curl -sS https://api.aestheticdata.io/sample
*
* Never commit a private key. Export EVM_PRIVATE_KEY in your shell, and keep a
* tight spend cap: this route costs 0.001 USDC per successful paid call.
*
* Network eip155:8453 is Base mainnet.
*/
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
const SAMPLE_URL = "https://api.aestheticdata.io/sample";
const PAID_URL = "https://api.aestheticdata.io/x402/brands";
async function main(): Promise<void> {
const sample = await fetch(SAMPLE_URL);
if (!sample.ok) {
throw new Error(`Free sample failed: HTTP ${sample.status}`);
}
console.log("Free sample HTTP", sample.status);
const key = process.env.EVM_PRIVATE_KEY as `0x${string}` | undefined;
if (!key) {
console.log("EVM_PRIVATE_KEY is not set; stopping before any paid request.");
console.log("An unpaid GET to the paid route returns HTTP 402 with PAYMENT-REQUIRED.");
const unpaid = await fetch(PAID_URL);
console.log("Unpaid brands HTTP", unpaid.status);
return;
}
const account = privateKeyToAccount(key);
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [
{
network: "eip155:8453",
client: new ExactEvmScheme(account),
},
],
});
const paid = await fetchWithPayment(PAID_URL, { method: "GET" });
const body = await paid.json();
console.log("Paid brands HTTP", paid.status);
if (paid.headers.get("PAYMENT-RESPONSE")) {
console.log("PAYMENT-RESPONSE header is present.");
}
console.log("Top-level keys:", Object.keys(body));
}
main().catch((err) => {
console.error(err);
process.exitCode = 1;
});
Data source
EU device records contain public data from EUDAMED, © European Union, reused under CC BY 4.0. Product classification by AestheticData. Brands are a curated directory and are only partially verified; some fields may be null. Lookup and crosswalk results are informational.
Independent service, not affiliated with the European Commission or the FDA.
