Skip to navigation

Introduction

Integrate Mitu into your product through one API for customers, agent wallets and payments.
View as Markdown

The Mitu API gives your backend direct access to the infrastructure your business uses to get paid by people and AI agents, and to let your customers’ AI agents make payments of their own. Through it you can create the customers you serve, issue the wallets their agents spend from, request payment through links, invoices and subscriptions, and confirm the requests that agents have paid for, all from within your own product rather than alongside it. Everything you can do with these resources in the Mitu dashboard is also available through the API, so the two can be used interchangeably as your business grows.

The API is organised around resources and follows REST conventions, accepting and returning JSON over standard HTTP methods and status codes, with every request authenticated by your API key. Each group in the sidebar covers a single resource, and every endpoint page documents its parameters, request body and responses in full, together with an example request that you can adapt to your own integration.

What you can build

ResourceWhat it does
CustomersCreate and retrieve the people and businesses you serve.
Agent AccessIssue the customer keys your customers use to connect their AI apps to your agent service, and manage the apps they connect by signing in with your OAuth.
Agent WalletsIssue wallets that your customers fund and their AI agents spend from, set the limits each wallet enforces and review its activity, as described in Agent wallets.
Payment LinksRequest a single payment that either a person or an AI agent can complete.
InvoicesBill a recipient formally, with line items and a due date, and deliver the invoice by email.
Plans and SubscriptionsDefine the prices you charge on a recurring schedule and subscribe your customers to them.
RecipientsSave the people and businesses your invoices are addressed to, so they can be billed again without re-entering their details.
UtilitiesCheck that your API key is working and list the networks that Mitu supports.

To understand how links, invoices and subscriptions fit together, read Payment experiences, and to accept the same payment from both people and agents, follow the Universal payments guide.

Environments

The API is available in a sandbox environment for building and testing and a live environment for real payments, and the two behave in exactly the same way. Because each environment has its own API keys and its own data, nothing you create in the sandbox ever appears in live mode, and no real money moves while you develop your integration.

EnvironmentBase URLUse
Sandboxhttps://sandbox-api.mitu.aiBuilding and testing your integration.
Livehttps://api.mitu.aiProcessing real payments for your business.

Keep the base URL and API key for each environment together in your configuration, so that a request is never sent to one environment with the key of the other, and follow Test and live when you are ready to move your integration into production.

Authentication

Every request is authenticated with an API key sent in the x-api-key header over HTTPS, and because that key acts with the full authority of your business account, it should only ever be used from your servers and never from a browser, mobile app or AI client. Authentication explains how to create, store and rotate your keys, while Keys and secrets describes every credential involved in a Mitu integration and where each one belongs.

Requests and responses

Request bodies are sent as JSON, and every successful response returns the resource under data alongside a short message, following the same conventions for identifiers, amounts and timestamps across every resource. Requests and responses describes the headers each request uses, the shape of every response and the conventions your integration can rely on.

Building a reliable integration

Payments must never be duplicated or lost, so the API applies the same safeguards to every resource, and an integration that follows them will behave predictably even when networks fail or requests arrive faster than expected.

  1. Idempotency
    Send an Idempotency-Key with every request that creates something, so that if the request times out you can retry it with the same key and receive the original result instead of performing the operation twice.
  2. Pagination
    List endpoints return their results in pages of up to 100 records, each with a cursor that you send back to fetch the page that follows.
  3. Errors
    A failed request returns a status code that identifies the cause and a message that explains it, giving your integration what it needs to decide whether to correct the request or retry it.
  4. Rate limits
    Requests are limited to protect the stability of the platform, and a request over the limit returns 429 so that it can be retried after a short wait.
  5. Events
    Payments, invoices, subscriptions and wallets continue to change after the request that created them, so configure a webhook to be notified of each change as it happens rather than polling the API.

Versioning

Every path begins with the version of the API, such as /v1/customers, and Mitu extends each version over time by adding endpoints, optional parameters and response fields. Build your integration to ignore any field it does not recognise, so that these additions never affect it, knowing that a change which would break an existing integration is introduced under a new version rather than to the current one.

SDKs

The Mitu SDKs for TypeScript, Python and Go serve a different purpose from this API, running inside your own backend to charge AI agents for requests to your API and collecting payment before your handler runs, as described in API monetisation. To manage customers, wallets and payment experiences, call this API directly from any language or tool that can make an HTTP request.

To make your first request, get your API keys from the dashboard and call Health check to confirm that your key is working. From there you can create your first customer or payment link, knowing that every other endpoint in this reference follows the same patterns, so what you learn from one applies to all of them.