# Anafi Developers: Stablecoin Payments API and Automation SDK

> API, SDK and rule language for recurring stablecoin payments, payouts and bank off-ramps. Non-custodial: your user signs once, the Anafi engine runs it.

URL: https://ana.fi/developers/

[ANA.FI](https://ana.fi/) / TECHNOLOGY / DEVELOPERS

## Build the screen. Skip the engine. SDK, API and a rule language for stablecoin payments and automation.

Anafi is a non-custodial engine for stablecoin payments, payouts and bank off-ramps. Your app fills in a rule, your user signs once, Anafi runs it.

[Start in sandbox](https://portal.ana.fi/) [Talk to Us](https://ana.fi/talk/)

### HOW IT WORKS: Sign once. It runs.

Where Anafi sits in your stack. Your app builds a rule, your user signs one transaction, and the engine pays each time the condition is met.

Your side

**Your app** A form, a sign step, an activity view. Holds no key and no funds.

**User's wallet** Holds the key and the funds. Signs once. Revokes with one transaction.

Anafi

**SDK and API** Builds and sends the rule. Returns the activity.

**Anafi engine** Runs in an Intel TDX enclave. Checks each rule. Signs each payment. One key, sealed inside.

Chain and bank

**Payee** Receives a transfer. Integrates nothing.

**On chain** Only the rule's hash. One nonce per payment. Pays only on a valid engine signature.

**Licensed partner** Converts and pays a bank account, with a reference.

01 · Your app → SDK and API

rule file

02 · SDK and API → Anafi engine

rule, encrypted

03 · Anafi engine → Your app

approved hash

04 · Your app → User's wallet

sign step

05 · User's wallet → On chain

one transaction: the rule's hash

06 · Anafi engine → On chain

signed payment

07 · On chain → Payee

transfer

08 · On chain → Licensed partner

or a bank payout

09 · SDK and API → Your app

activity

Once, at set-up Each time the condition is met

### BUILD WITH AI: Tell your agent what you want.

Pick what your users should do. Copy the prompt, or open it in your assistant. It designs the screens and writes the rules.

MY USERS CAN

Send to other users Pay a bank account Pay rent and bills Save in a pot Set aside tax Split payments Convert on arrival Stop-loss order Pay a member back Follow a wallet

OR IN YOUR WORDS

YOUR PROMPT

```
I am adding stablecoin automations to my app with Anafi (https://ana.fi/developers/). Help me design the screens and write the rules. What my users should be able to do: - Send money to other users of my app - Pay out to a bank account - Save a share of each incoming payment into a pot - Set aside a share of each incoming payment for tax How Anafi works: - My app builds a rule from a form. The user reads the rule as one sentence and signs one transaction in their own wallet. - The Anafi engine then runs the rule. It pays each time the condition is met, only inside the limits the user signed. - My app never holds keys or funds. The user can revoke with one transaction. The rule language is YAML: - trigger types: calendar (day_of_month or day_of_week as lists, with time_of_day and an optional timezone), periodic (interval_seconds), at_fixed_time (timestamps), incoming_tx and outgoing_tx (value as an amount or a range such as "100.. USDC", plus from, to or account), price_crossed (token, direction, price_usd, hold_seconds, cooldown_seconds) - action types: send_one (to, value), send_batch (recipients, each with to and value), exchange (in, out), off_ramp (to with an iban, value, memo), notify (channel, message) - limits: token_allowlist, recipient_allowlist and iban_allowlist under global, and start and expiry on a rule, as full timestamps - A value is an amount and a token ("80 USDC") or a share of what arrived ("trigger.value * 10%"). A name that starts with $ is a value my app fills in. - The full specification, with worked examples, is public: https://api.polygon.ana.fi/api/dsl/docs. Read it first if you can open links, and follow it. Example rule: rules: pay_bill: trigger: { type: calendar, day_of_month: [5], time_of_day: "09:00" } actions: - { type: send_one, to: "$utility", value: "80 USDC" } expiry: "2027-12-31T23:59:59Z" For each feature, give me: 1. The screen: its form fields, the one-sentence summary the user reads before signing, and the empty, loading and error states. 2. The rule template in YAML, with $ placeholders for the values the form fills in. 3. The activity view, with a revoke button. Then list where my code calls Anafi: build the rule, send it for approval, ask the user to sign, read the activity, revoke. Mark each call as a TODO. Do not invent SDK or API names: I will add them from Anafi's reference. Before you start, ask me what you need to know about my app.
```

Copy prompt OPEN IN

Prompt copied. Paste it if the chat opens empty.

The portal gives your agent a starter prompt and the rule language specification. [Start in sandbox](https://portal.ana.fi/)

WHAT YOUR AGENT BUILDS

1 / 10

#### Send to a friend

In your prompt

THE FORM

- **To:** Another user
- **Amount:** 20 USDC
- **Repeat:** Every Friday

YOUR USER READS

Every Friday at 09:00, send 20 USDC to another user.

THE RULE

```
`rules: pay_friend: trigger: type: calendar day_of_week: [ "fri"] time_of_day: "09:00" actions: - type: send_one to: "$friend" value: "20 USDC"`
```

[Use case](https://ana.fi/use-cases/autopay/)

#### Bank payout

In your prompt

THE FORM

- **To:** A bank account
- **Amount:** 80 USDC
- **On:** The 5th
- **Reference:** Invoice 2041

YOUR USER READS

On the 5th, pay 80 USDC into a bank account, with a reference.

THE RULE

```
`rules: to_bank: trigger: type: calendar day_of_month: [5] time_of_day: "09:00" actions: - type: off_ramp to: iban: "$payee_iban" value: "80 USDC" memo: "Invoice 2041"`
```

[Use case](https://ana.fi/use-cases/recurring-off-ramp/)

#### Rent

Add to prompt

THE FORM

- **To:** Landlord's bank account
- **Amount:** 1,850 USDC
- **On:** The 1st
- **Reference:** APT4B-RENT

YOUR USER READS

On the 1st of every month, pay 1,850 USDC to the landlord's bank account, reference APT4B-RENT.

THE RULE

```
`rules: rent: trigger: type: calendar day_of_month: [1] time_of_day: "09:00" actions: - type: off_ramp to: iban: "$landlord_iban" value: "1850 USDC" memo: "APT4B-RENT"`
```

[Use case](https://ana.fi/use-cases/bill-pay/)

#### Savings pot

In your prompt

THE FORM

- **When:** Pay arrives
- **Share:** 10%
- **To:** Savings pot

YOUR USER READS

Each time pay arrives, 10% goes to the savings pot.

THE RULE

```
`rules: save: trigger: type: incoming_tx from: "$employer" actions: - type: send_one to: "$pot" value: "trigger.value * 10%"`
```

#### Tax set-aside

In your prompt

THE FORM

- **When:** 100 USDC or more arrives
- **Share:** 25%
- **To:** Tax wallet

YOUR USER READS

When 100 USDC or more arrives, 25% of it goes to the tax wallet.

THE RULE

```
`rules: tax: trigger: type: incoming_tx value: "100.. USDC" actions: - type: send_one to: "$tax" value: "trigger.value * 25%"`
```

[Use case](https://ana.fi/use-cases/tax-set-aside/)

#### Payment split

Add to prompt

THE FORM

- **When:** 500 USDC or more arrives
- **Partner:** 40%
- **Tax wallet:** 25%

YOUR USER READS

When 500 USDC or more arrives, 40% goes to a partner and 25% to the tax wallet.

THE RULE

```
`rules: split: trigger: type: incoming_tx value: "500.. USDC" actions: - type: send_batch recipients: - to: "$partner" value: "trigger.value * 40%" - to: "$tax" value: "trigger.value * 25%"`
```

[Use case](https://ana.fi/use-cases/payment-routing/)

#### Auto-convert

Add to prompt

THE FORM

- **When:** WETH arrives
- **Sell:** All of it
- **For:** USDC

YOUR USER READS

When 0.01 to 2 WETH arrives, sell all of it for USDC at market.

THE RULE

```
`rules: to_usdc: trigger: type: incoming_tx value: "0.01..2 WETH" actions: - type: exchange in: "trigger.value" out: USDC`
```

[Use case](https://ana.fi/use-cases/auto-convert/)

#### Stop-loss

Add to prompt

THE FORM

- **When:** WETH below $2,000
- **For:** 15 minutes
- **Sell:** 2 WETH for USDC

YOUR USER READS

When WETH stays below $2,000 for 15 minutes, sell 2 WETH for USDC at market.

THE RULE

```
`rules: stop_loss: trigger: type: price_crossed token: WETH direction: below price_usd: 2000 hold_seconds: 900 cooldown_seconds: 86400 actions: - type: exchange in: "2 WETH" out: USDC`
```

[Use case](https://ana.fi/use-cases/limit-orders/)

#### Reimbursement

Add to prompt

THE FORM

- **Watch:** A team member's wallet
- **Payments:** 1 to 500 USDC
- **Pay back:** 100%

YOUR USER READS

Each payment of 1 to 500 USDC that a team member sends is paid back in full.

THE RULE

```
`rules: pay_back: trigger: type: outgoing_tx account: "$member" value: "1..500 USDC" actions: - type: send_one to: "$member" value: "trigger.value"`
```

[Use case](https://ana.fi/use-cases/reimbursements/)

#### Follow a wallet

Add to prompt

THE FORM

- **Watch:** A wallet
- **Sends:** 1,000 WETH or more
- **Then:** Swap 1 WETH for USDC

YOUR USER READS

When a followed wallet sends 1,000 WETH or more to an exchange, swap 1 WETH for USDC.

THE RULE

```
`rules: follow: trigger: type: outgoing_tx account: "$watched" to: "$exchange" value: "1000.. WETH" actions: - type: exchange in: "1 WETH" out: USDC`
```

[Use case](https://ana.fi/use-cases/follow-a-wallet/)

Ten templates. Hover or tap a keyword to see what it does.

### THE RULE LANGUAGE: A rule is a short file.

Three parts: what fires it, what it does, and its limits.

FIRES ON `trigger:`

- **`calendar`:** A day of the month or of the week.
- **`at_fixed_time`:** One fixed time.
- **`periodic`:** An interval.
- **`incoming_tx`:** An incoming payment, by sender and amount.
- **`outgoing_tx`:** A payment a watched account sends.
- **`price_crossed`:** A price crossing a level.

DOES `actions:`

- **`send_one`:** Send to one payee.
- **`send_batch`:** Send to several, all or nothing.
- **`exchange`:** Swap one token for another.
- **`off_ramp`:** Pay out to a bank account.
- **`notify`:** Email the owner.

BOUNDED BY `limits:`

- **`token_allowlist`:** The tokens it may move.
- **`recipient_allowlist`:** The payees it may pay.
- **`iban_allowlist`:** The bank accounts it may pay.
- **`value`:** The amount written in the rule.
- **`start, expiry`:** The dates it runs between.

API REFERENCE

#### Stablecoin payments API: endpoints, authentication and webhooks.

Your project, its API keys and the rule language specification are in the Anafi portal.

[Open the portal](https://portal.ana.fi/)

### NON-CUSTODIAL INTEGRATION: What you build. What you skip.

YOUR SIDE

#### You build

- A form that fills in a rule.
- A sign step in the user's own wallet.
- An activity view, with a revoke button.

ANAFI'S SIDE

#### The engine runs

- The scheduler.
- Retries.
- Bank payouts, through licensed partners.
- Proof that nothing was skipped.
- **BUILD WITH:** The SDK, the API and the rule language.
- **RAILS:** Your off-ramp and virtual accounts, or ours.
- **HOSTING:** Our engine, co-hosted, or yours.

### FROM TEST TO LIVE: Sandbox. Playground. Live.

01 SANDBOX

A project in the portal, with test funds and sample data.

02 PLAYGROUND

Walk the flow your user sees, and read the rule it makes.

03 LIVE

Your users sign in their own wallets, and the engine runs.

### FAILURE MODES: When something goes wrong.

Four parties, and only one of them can sign a payment. It signs what the rule allows, and nothing else.

IF

#### Anafi goes offline

Nothing fires, and the funds stay in the user’s wallet. Missed payments run once, late, when the engine is back.

IF

#### Your app is breached

Your app holds no key. A payment needs the engine’s signature, and the engine signs only what the user’s rule allows.

IF

#### Anafi is asked for data

We can only hand over what we hold: wallet addresses and execution logs. Rules are encrypted. KYC stays with the licensed partner.

IF

#### A rule is wrong

The engine checks each rule before the user signs it: syntax, amounts, payees. A rule it has not approved cannot be committed.

IF

#### The user wants out

One transaction from the user’s own wallet revokes the mandate. Nobody’s permission is needed, and it takes effect once confirmed.

IF

#### The balance is short

The payment is retried once, then it reverts. Nothing moves.

### VERIFY: Don't trust it. Check it.

Four things you can verify yourself, without asking us, and who has reviewed the code.

#### Attested engine

**proves which code holds the key**

The engine runs in an Intel TDX enclave. Its attestation is published on chain and bound to an exact, reproducible build, and our verifier checks it with only an RPC node. The Anafi team cannot read inside the enclave or use its key.

#### Rule hash

**proves what the user signed**

A rule is encrypted on the user’s device. On chain there is only its hash, and every payment can be checked against it. The rule itself stays private.

#### Signed heartbeat

**proves nothing was skipped**

Every 30 minutes the engine signs a heartbeat that records the block it has processed to. The attested code reads every block in order, so a valid heartbeat shows every rule was evaluated up to that block. If it stops, anyone can see it.

#### One nonce per payment

**proves nothing ran twice**

Each payment carries a unique on-chain nonce and an expiry. The wallet refuses a second execution, even after a retry, a restart or a reorg, and a late signature is worth nothing.

[Security review by Hexens](https://github.com/anafi-cc/trust-security/blob/main/reports/2026-10-hexens-security-review.pdf) [Trust & Security](https://ana.fi/trust-security/) [Auditability & Compliance](https://ana.fi/auditability-compliance/)

### WHAT IT RUNS ON: Technology agnostic.

- **CHAINS SUPPORTED:** EVM chains Solana
- **ACCOUNTS:** Safe Swig MPC wallets ERC-4337 EIP-7702 ERC-20 approval Permit2

Any stablecoin, or any deployed whitelisted token.

Rules are private and verifiable on chain.

### USE CASES

#### For businesses

- [Direct Debit Billers pull what the payer approved. Never more.](https://ana.fi/use-cases/direct-debit/)
- [Autopay Pay on a date, or the moment money arrives.](https://ana.fi/use-cases/autopay/)
- [Subscriptions Recurring revenue through one widget.](https://ana.fi/use-cases/subscriptions/)
- [Top-ups & sweeps Warm tops up hot. Surplus sweeps back.](https://ana.fi/use-cases/top-ups-sweeps/)
- [Payouts & payroll Batches on schedule. Large payouts wait for approvers.](https://ana.fi/use-cases/payouts-payroll/)
- [On/off-ramp Stablecoin on-ramp and off-ramp, through licensed partners.](https://ana.fi/use-cases/on-off-ramp/)
- [Recurring off-ramp Stablecoins to a user's bank, on a schedule.](https://ana.fi/use-cases/recurring-off-ramp/)
- [Bill pay Rent and bills, paid by bank transfer.](https://ana.fi/use-cases/bill-pay/)

#### For your wallet

- [Anafi dApp For your own wallet. No integration needed.](https://ana.fi/dapp/)

### FAQ: Before you write the first line.

#### How do I add recurring stablecoin payments to my app?

With Anafi you build three things: a form that fills in a rule, a sign step in the user's own wallet, and an activity view with a revoke button. The Anafi engine runs the scheduler, retries and bank payouts. See [autopay](https://ana.fi/use-cases/autopay/).

#### What can developers use on Anafi today?

Sandbox projects and playgrounds are open today in the [Anafi portal](https://portal.ana.fi/): create a project and build your first rule. Going live with your own users is in beta testing: [talk to us](https://ana.fi/talk/) to take part. The rule language specification and your project's API keys are in the portal too.

#### Is Anafi non-custodial?

Yes. An app built on Anafi holds no keys and no funds. Users sign in their own wallets, and funds stay there until a rule moves them. The engine acts only inside the limits a user signed. See [Trust & Security](https://ana.fi/trust-security/).

#### What is an Anafi rule?

An Anafi rule is a short YAML file: what fires it, what it does, and its limits. Your app builds it from a form, through the SDK or the API, and the user reads it as one sentence before signing.

#### Which wallets and chains does Anafi support?

Anafi is technology agnostic: it supports Safe, Swig, MPC wallets, ERC-4337, EIP-7702, ERC-20 approval and Permit2 on EVM chains and Solana. It is live on Ethereum, Polygon and X Layer, with Solana on devnet.

#### Can we use our own off-ramp or banking partner?

Yes. A rule can pay out to a bank account through your own off-ramp and virtual accounts, or through Anafi's, with licensed partners. See [on/off-ramp](https://ana.fi/use-cases/on-off-ramp/).

#### Can we self-host the Anafi engine?

Yes. The Anafi engine runs three ways: hosted by Anafi, co-hosted, or hosted by you.

#### Can a coding agent build the integration?

Yes. The Anafi portal gives you a prompt to paste into your coding agent, together with the rule language specification.

#### What does it cost to build on Anafi?

Anafi Mandates and Anafi Treasury are priced by quote. See [what Anafi costs](https://ana.fi/#pricing).

GET STARTED

### Build your first rule in the sandbox.

Bring your engineer. We walk through the rule language and the integration.
