Skip to main content
The AnySpend Platform API is designed with AI-first integration in mind. Every endpoint has a unique operationId, detailed JSON schemas, and consistent conventions that make it straightforward to use with LLM function calling, autonomous agents, and AI orchestration frameworks.

OpenAPI Specification

The full OpenAPI 3.1 specification is available at:
The spec includes:
  • A unique operationId for every endpoint (e.g. createPaymentLink, listTransactions)
  • Detailed request and response JSON schemas with descriptions
  • Authentication requirements
  • Error response schemas
Use the OpenAPI spec to auto-generate tool definitions for your LLM. Most AI frameworks can convert OpenAPI operations into function/tool definitions programmatically.

LLM Function Calling

Claude (Anthropic)

Convert OpenAPI operations into Claude tool definitions. Here is an example tool definition for creating a payment link:

OpenAI

The equivalent function definition for OpenAI’s function calling:

Example: Conversation Flow

Here is how an AI assistant might use the AnySpend tools in a conversation:
1

User asks to create a payment link

User: “Create a payment link for 50 USDC for the Pro plan subscription”The AI decides to call the create_payment_link tool.
2

AI calls the tool

3

Tool returns the result

4

AI responds to the user

“I’ve created a payment link for 50 USDC for the Pro Plan Subscription. Here’s the link: https://anyspend.com/pay/pl_abc123

Building an AI Payment Agent

Below is a complete example of an AI agent that can manage payments using Claude and the AnySpend SDK:

MCP Server (Coming Soon)

We are building a Model Context Protocol (MCP) server that will expose the full AnySpend Platform API as MCP tools. This will allow any MCP-compatible AI client (Claude Desktop, Cursor, Windsurf, etc.) to interact with your AnySpend account directly.Join the waitlist to get early access.
The MCP server will support:
  • All CRUD operations for payment links, products, customers, and webhooks
  • Transaction querying and export
  • Analytics and stats
  • Checkout session management

Additional Tool Definitions

Here are more tool definitions you can add to your agent for comprehensive coverage:

Best Practices

Use read-only keys for query agents

AI agents that only read data (list transactions, view analytics) should use API keys with read-only permission. This prevents accidental mutations from hallucinated tool calls.

Use write keys for action agents

Agents that need to create payment links or manage resources need read-write API keys. Scope them to the minimum permissions required.

Always validate amounts

LLMs can hallucinate numbers. Before executing a tool call that involves an amount, validate that the amount is reasonable. Consider adding a confirmation step for amounts above a threshold.

Log all tool calls

Log every tool call and its result for auditability. This is especially important for agents that handle real money.
Never expose your API key in client-side code or AI prompts that are visible to end users. Use a server-side proxy to make API calls on behalf of your AI agent. If using Claude or OpenAI function calling, the API key should only exist in your backend tool execution layer — never in the LLM system prompt.

Generating Tool Definitions from OpenAPI

You can programmatically convert the OpenAPI spec into tool definitions for any LLM framework:
This approach keeps your tool definitions in sync with the API as new endpoints are added.