Safe-Doc - 10 days free.Full trial, no commitment, no credit card.See the offer

Open x402 protocol, paid in USDC

Pseudonymization and anonymization for AI agents, paid per call with x402

An AI agent sends a text, receives the price, pays in USDC and gets the text back pseudonymized or anonymized. No sign-up, no API key, no subscription: the agent handles it alone, in two HTTP requests.

Processed in the European Union, with no third-party AI. Nothing is kept.

agent → safe-doc.ai
  1. POST /x402/v1/anonymize-text{"text": "Hi, I'm Marie Durand…", "mode": "pseudonymize"}
  2. 402 Payment RequiredPAYMENT-REQUIRED: exact price, Base network, USDC
  3. POST /x402/v1/anonymize-textsame request + PAYMENT-SIGNATURE
  4. 200 OKpseudonymized text; payment settled only now

All it takes

  • a USDC wallet on Base
  • an x402 library
  • a text of up to 100,000 characters

How a call works, step by step

Two HTTP requests. The agent knows the price before signing, and the payment is settled only if the text is returned.

How an x402 call to Safe-Doc works The agent sends its text, Safe-Doc answers 402 with the price, the agent signs a USDC payment and sends the same request again, Safe-Doc anonymizes the text in the EU, settles the payment on the Base network, then returns the text. Your agent Safe-Doc (EU) Base network (USDC) 1. POST the text, no payment 2. 402: exact price and address 3. Signs the payment 4. Same request + signature 5. Anonymizes the text 6. Settles the payment 7. 200: anonymized text
Two HTTP requests, in order. The payment is settled only if the anonymized text is returned.

x402: payment built into the web

x402 is an open payment protocol for the web. It finally puts HTTP status code 402 "Payment Required" to use: the code was planned in the early days of the web but never used, for lack of a suitable way to pay. The server states its price in a 402 response, the client pays and sends its request again. The protocol is run by the x402 Foundation, under the Linux Foundation.

For an AI agent, this is the missing piece. Opening an account, entering a card, storing an API key: those steps are made for humans. With x402, the agent finds the service, reads the price, pays for the call and carries on with its task, with no one stepping in.

Two modes

Pseudonymize replaces each piece of data with a stable label: the same person keeps the same label throughout the text, so a model can reason correctly without knowing who is involved.

Text sent

The agreement between John Smith and Morrison Partners sets a fee of £14,500.

Text returned, pseudonymize mode

The agreement between [PERSON_1] and [ORG_1] sets a fee of [AMOUNT_1].

Anonymize replaces the data for good, with no way back: the right choice when the text will be stored, shared or used as training data.

What agents do with it

A support agent

It pseudonymizes each ticket before sending it to the model that writes the summary.

Training data

The agent anonymizes real conversations before adding them to a training or evaluation dataset.

A monitoring agent

It removes personal data from collected emails or messages before storing or sharing them.

A third-party agent

It finds Safe-Doc in its workflow, reads the price, pays for the call and carries on, with no human creating an account.

A prototype

A developer tests a pipeline on real texts without taking out a subscription.

x402 or an account with an API key?

Both use the same engine. For documents and complete processes, see the MCP server.

x402Account with API key
Sign-upNoneSafe-Doc account, from the Pro plan
PaymentPer call, in USDCMonthly subscription
What is processedText, up to 100,000 characters per callText, PDF, Word, spreadsheets, document batches
For whomAutonomous agents, occasional use, trialsRegular use, teams, documents
AccessAny x402-compatible libraryREST API, MCP server, Claude skill, Chrome extension

Price and guarantees

  • A price stated before you pay. It depends on the length of the text, up to 100,000 characters per call, and is given exactly in the 402 response. You can set a per-call cap in the agent's code.
  • Paid only if the text is returned. If processing fails, nothing is charged. Without an account, 20 short texts (up to 5,000 characters) per day per IP address remain free.
  • The same engine, in Europe. No third-party AI reads the text, nothing is kept, and Safe-Doc never has access to the agent's wallet.

For developers

The raw call, then the same thing with the x402 library for fetch, which chains the two requests on its own. The mode field is anonymize or pseudonymize.

POST /x402/v1/anonymize-text
Host: safe-doc.ai
Content-Type: application/json

{"text": "Hi, I'm Marie Durand.",
 "mode": "anonymize"}

# response 1: 402 Payment Required
#   PAYMENT-REQUIRED header = the price
# same request + PAYMENT-SIGNATURE header
# response 2: 200 OK, the anonymized text
// npm install @x402/fetch @x402/evm viem
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const signer = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const client = new x402Client();
registerExactEvmScheme(client, { signer });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);

const res = await fetchWithPayment(
  "https://safe-doc.ai/x402/v1/anonymize-text", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ text: "Hi, I'm Marie Durand.",
                         mode: "pseudonymize" }),
});
console.log(await res.json());

The agent's wallet must hold USDC on the Base network. Equivalent libraries exist for axios, Python and Go.

FAQ

Do I need a Safe-Doc account?

No. The agent pays for each call, with no sign-up and no key. For regular use or for documents (PDF, Word, spreadsheets), an account with an API key is a better fit.

How much does a call cost?

The price depends on the length of the text. It is stated exactly in the 402 response, before any payment.

What if processing fails?

Nothing is charged: the payment is settled only if the text is returned.

Which currency, on which network?

USDC, a digital currency pegged to the dollar, on the Base network.

Can I send a PDF or a Word file?

Not with x402, which processes text. Documents go through the API with an account, or through the MCP server.

Does Safe-Doc keep the text?

No. The text is processed in the European Union, with no third-party AI, and nothing is kept after processing.

Can I limit what my agent spends?

Yes. The agent knows the price before signing, and you can set a per-call cap in its code.

Our guides on this topic

One text, one price, one signed request.

For documents, batches and complete processes, the API and the MCP server take over with an account.