> ## Documentation Index
> Fetch the complete documentation index at: https://polar.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent signup

> Understand how a coding agent signs up for Polar through auth.md, what it can do before you claim it, and how you take over its organization.

A coding agent can sign up for Polar without you. It registers itself, creates an organization, sets up products and checkout, and then hands everything to you with a claim code. You only need an account at the end.

The agent follows the instructions at [`polar.sh/auth.md`](https://polar.sh/auth.md). Point your agent there:

```text Prompt theme={null}
Sign up for Polar following https://polar.sh/auth.md, then add a Pro plan and a checkout to this app.
```

The agent starts in the [sandbox](https://polar.sh/docs/integrate/sandbox.md), where you test the integration with test cards. When you're ready to take real payments, it does the same in production.

```mermaid theme={null}
flowchart LR
  A[Agent signs up in sandbox] --> B[Builds organization]
  B --> C[You claim it]
  C --> D[You test]
  D --> E[Agent signs up in production]
  E --> F[You claim it]
```

The flow: anonymous registration at the identity endpoint, a one-hour access token from the token endpoint with the JWT bearer grant, then a claim started with the user's email and polled at the token endpoint. Do it in the sandbox first ([https://sandbox.polar.sh/auth.md](https://sandbox.polar.sh/auth.md)), then again in production ([https://polar.sh/auth.md](https://polar.sh/auth.md)) when the user wants to take real payments. Read [https://polar.sh/auth.md](https://polar.sh/auth.md) for the exact requests, error codes and polling rules. It is the source of truth.

## How it works

**1. The agent signs up**

The agent registers anonymously with a name you'll see later. It gets an identity assertion (valid 30 days) and a claim token (valid 30 days, returned once).

**2. The agent builds**

The agent exchanges its assertion for an access token that lasts one hour, and repeats that when it expires. It creates one organization and sets it up.

**3. The agent asks for your email**

When it's done, the agent asks for your email and starts a claim. It gives you a link and a three-word code, like `amber-river-lemon`.

**4. You claim it**

You open the link, sign in or create an account with that email, and enter the code. The organization becomes yours.

**5. You go live**

When you've tested in the sandbox, the agent repeats these steps in production and you claim that organization too. See [Go live](#go-live).

If you've already tested in the sandbox, or want to skip it, tell the agent to go straight to production.

## What the agent can do before you claim it

An agent can create **one** organization. Until you claim it, it can only set up the catalog:

| Can | Can't |
| - | - |
| Products, benefits and discounts | Customers, orders and subscriptions |
| Files and meters | Refunds and payouts |
| Events | Members |
| Checkout Sessions and Checkout Links | Webhook endpoints |
| Read custom fields | Organization access tokens |

In the sandbox, checkout works right away with test cards. In production, the organization can't take payments until you claim it and pass the [account review](https://polar.sh/docs/merchant-of-record/account-reviews.md).

## Claim the agent

The agent gives you a link and a code in one message, for example:

> Open this link, sign in to Polar with [jane@example.com](mailto:jane@example.com), and enter this code: **amber-river-lemon**

1. Open the link. It goes to **Finish setup** in the Polar dashboard.
2. Sign in, or create an account, with the email the agent asked for. Only that account can claim it.
3. Enter the code under **Claim code** and click **Complete setup**.

The dashboard shows the organization and the products the agent created, then opens the organization.

> [!WARNING]
>
> Completing setup lets the agent act on your behalf on Polar, in **all** your organizations, not only the one it created. Claim only agents you trust. To limit an agent to one organization, connect it with an [organization access token](https://polar.sh/docs/integrate/oat.md) instead.

The link and code expire after 7 days. The agent can start a new claim to get a new pair, as long as its claim token is valid (30 days after signup). After that, it has to sign up again.

## After the claim

The agent receives a new identity assertion and an access token for your account. Everything issued to it before the claim stops working. It keeps using one-hour access tokens from then on.

If the agent loses access, connect it another way: the [MCP server](https://polar.sh/docs/integrate/mcp.md) or the [Polar CLI](https://polar.sh/docs/integrate/cli/authentication.md).

## Go live

The sandbox and production are separate: agents, organizations, products, access tokens and accounts don't carry over. When you're ready to take real payments, ask the agent to go live. It:

1. Signs up again in production and recreates the products, benefits and meters.
2. Asks for your email and gives you a new link and code. Claim it with your production Polar account, the same way as in the sandbox.
3. Switches the app to production credentials and the production API.

Then complete the [account review](https://polar.sh/docs/merchant-of-record/account-reviews.md) so the organization can take payments.

## Manage your Pricing as Code Beta

Because the sandbox and production catalogs are separate, we recommend asking the agent to set up [Pricing as Code](https://polar.sh/docs/features/pricing-as-code/overview.md) with `polar config init`. The same billing config in your repository works for both organizations: the agent publishes it to sandbox first, then to production once you've tested it, one organization at a time. Every later pricing change is a pull request that ships as a new catalog version.

```text Prompt theme={null}
Move my pricing into a Polar billing config, using my sandbox organization.
```

## Learn more

| Resource | Description |
| - | - |
| [`auth.md`](https://polar.sh/auth.md) | The exact requests, responses and error codes, written for agents |
| [Sandbox](https://polar.sh/docs/integrate/sandbox.md) | Test without real money before going live |
| [Build with agents](https://polar.sh/docs/agents/overview.md) | Other ways to connect an agent to Polar |
| [Account reviews](https://polar.sh/docs/merchant-of-record/account-reviews.md) | What happens before the organization can take payments |
| [Access tokens](https://polar.sh/docs/integrate/oat.md) | Give an agent access to one organization only |
| [Pricing as Code](https://polar.sh/docs/features/pricing-as-code/overview.md) | Keep the catalog in a billing config in your repository |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.