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

# Billing from an agent

> Show the plan, pick a plan with the person, and give them a link to pay, change or cancel it.

An agent with the owner's API key can read the plan and make the links that change it. The person pays, changes or cancels on the page a link opens, in the browser.

The MCP tools are `get-billing` and `create-billing-link`. They are served to API keys only, which is what an agent signing up through PostSyncer gets; apps connected by sign-in (OAuth) don't get them. Without MCP, they are [Get billing](https://docs.postsyncer.com/api-reference/billing/get.md) and [Create a billing link](https://docs.postsyncer.com/api-reference/billing/create-link.md).

## At a limit

On the Free plan, a tool that hits a limit (the month's posts, the accounts, a paid feature) answers with the reason. For a key that can make billing links, the answer ends with one line: "I can make a pay link for this with create-billing-link." Tell the person what happened, and make the link if they want to pay.

On a paid plan the line names the link that lifts the limit: "a link to add accounts" (Agency's accounts: `extra_accounts`) or "a link to change the plan" (`change_plan`).

## Pay for a plan

**1. Read the plan**

Call `get-billing` (`GET /billing`). `plan` and `status` say where the owner is; `plans` lists the plans on sale with `monthly_price` and `yearly_price` (dollars a month) and what each includes. `sale` is a sale running now, if any.

**2. Pick a plan and cycle with the person**

Use the numbers from `plans`. Never guess a price.

**3. Make the pay link**

Call `create-billing-link` with `purpose: "upgrade"`, `plan` (like `pro-v2`) and `cycle` (`monthly` or `yearly`). The answer's `url` is Stripe's payment page; give it as a link to click. It works for 24 hours (`expires_at`) and needs no PostSyncer sign-in.

**4. The person pays**

After paying, the page says "You're on Pro. Go back to Claude Code." (with your agent's name when PostSyncer knows it). Call `get-billing` again to see the new plan.

`upgrade` is for the Free plan. An owner who already pays gets an error naming `change_plan`, and one whose last payment failed gets one naming `card_and_invoices`. While a payment for the plan is still open (an unpaid or incomplete subscription), the error names `card_and_invoices`, to pay it, and `change_plan`, to pick a plan in the app. The person pays it or picks the plan on that page.

## The other links

| `purpose` | What the person gets |
| - | - |
| `change_plan` | The app's plans window, to switch plan or cycle. |
| `card_and_invoices` | Stripe's billing portal: the card, billing details and invoices. Fixes a failed payment. |
| `credits` | Billing → Credits in the app. |
| `extra_accounts` | Billing in the app, where Agency adds accounts above its 100. |
| `cancel` | The app's cancel dialog, with its offers and the pause. |

App pages ask the person to sign in. Stripe pages don't.

One person makes 10 links an hour. Past that, `create-billing-link` makes nothing and says when the next one can be made; make the link when the person is ready to open it.

## Who can do it

Billing is the workspace owner's. A teammate's key gets `403` with "Only the workspace owner can see billing or change the plan, so ask them." The key needs `billing:read` for `get-billing` and `billing:create` for `create-billing-link`; a full-access key has both.


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