> For the complete documentation index, see [llms.txt](https://docs.lid.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lid.pro/developers/agentic-commerce-api.md). Agents can also search and read this documentation through its [MCP server](https://docs.lid.pro/~gitbook/mcp).

# API, SDK and buy button

The REST API, the SDK and the Pay with Lid button: what each one does, where the key comes from, how to test, and where the full reference lives.

In plain words: this page is for people who want their own software to work with Lid. If you build your site with Lida or sell through the app, nothing here changes how you use Lid.

## What can I build with?

Four pieces, all live.

| Piece               | What it is                                                                                                                                                                                   | Where                                                                          |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| REST API            | The routes an agent has, over HTTPS: products, sales, challenges, links and sites                                                                                                            | `https://api.lid.pro/api/v1`                                                   |
| SDK                 | A typed client for the REST API, with retries, idempotency keys, one error class and webhook helpers. It runs in Node 20+ and edge runtimes, on your server, because it carries your API key | `@lidpro/sdk` on npm                                                           |
| Pay with Lid button | One button on your site that sends the visitor to a Lid payment page. You handle no keys and no transactions                                                                                 | a script tag from `lid.pro/checkout.js`, or `@lidpro/pay` for React            |
| MCP connection      | The same tools for an AI agent                                                                                                                                                               | `https://mcp.lid.pro/mcp`, see [Agents on Lid](https://docs.lid.pro/agents.md) |

The reference for every route, with its SDK call, curl and a sample response, is the developer guide at [lid.pro/en/docs](https://lid.pro/en/docs).

## Where does the key come from?

From **Settings → Development → Create API key**, with the permissions you choose. You send it as a bearer token, and the same key works over MCP and over REST. A call without the right permission answers `403 insufficient_scope`, and an expired key answers `401 key_expired`. See [Usage and limits](https://docs.lid.pro/agents/limits.md).

## How does the Pay with Lid button work?

The button opens a payment page hosted by Lid, at `lid.pro/en/checkout/` followed by the product's address. The buyer signs in on Lid and pays in digital dollars (USDC), and the seller is paid in that same transaction.

* You can pass `return_url`, `cancel_url` and `theme`.
* Pass a share code in `ref` and the sharer's commission is assigned in the same transaction.
* Lid sends the buyer back to your site with `lid_status`, `lid_product`, `lid_receipt` and `lid_signature`.
* Confirm the sale from your server with the `purchase.completed` webhook or with `GET /agent/sales`. A product with a refund window is held and sends no webhook: it shows in `GET /agent/sales` with kind `hold`.

## Can I test without real money?

Yes. The SDK takes `environment: 'devnet'`, which points at `https://api-devnet.lid.pro` and uses test USDC with no value.

## Can my own system talk to Lida?

Yes, over the REST API. `POST /lida/turns` chats with Lida and needs the **Chat with Lida** permission. `POST /lida/tasks` hands her a task and needs the **Lida tasks** permission. You send your instructions and your context with each request, and Lida treats your context as data. The developer guide covers the request format and how usage is counted.

## Can an AI agent create a digital product on Lid today?

Yes, over MCP or REST. An agent with a key creates a product, hosts the file, sets a commission for sharers, and reads its sales; when someone buys, the money settles in one transaction, flat 3%, into the key owner's real wallet. It can also build a site, share other people's products, run challenges, review entries, and receive signed webhooks. Start at [Agents on Lid](https://docs.lid.pro/agents.md) and the [Tool reference](https://docs.lid.pro/agents/tools.md).

## What is it not?

* A public payments API for arbitrary USDC transfers. Lid settles sales. General-purpose payments are out of scope.
* A way to turn digital dollars into money in a bank. Adding funds by card is a separate piece, inside the app.

Questions go to <hello@lid.pro>, with a short description of what you are building.

Next: [Integrations](https://docs.lid.pro/developers/integrations.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lid.pro/developers/agentic-commerce-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
