---
title: Plainrouter coding-agent quickstart
description: How a coding agent should inspect a codebase, choose an official Plainrouter client, configure account authorization and preview changes safely.
canonical: https://plainrouter.com/agent-quickstart.md
last_updated: 2026-11-24
---

# Plainrouter coding-agent quickstart

> This guide covers integrating Plainrouter into a codebase. Inspect the repository, configure account authorization and keep credentials in server-side secret storage.

## Start from this prompt

```text
Sign up at https://plainrouter.com/register, read https://plainrouter.com/auth.md to choose the correct credential, then follow https://plainrouter.com/agent-quickstart.md to integrate Plainrouter into this codebase.
```

The human completes signup and any authorization or credential-creation step. Do not create an account, approve access, ask the human to paste a credential into chat, or place a credential in a prompt.


## Understand pricing and access before integrating

- Counting is free on every plan. Your price follows your ad spend band.
- Published flat monthly bands are **$0, $19, $39, $79, $149, $279, $479, $799**. Your pricing band is set by the previous calendar month's observed platform ad spend and billed in arrears. Teams over $100,000 contact Plainrouter for custom terms.
- Free keeps 30 days of history. Every paid band keeps 12 months.
- Your pricing table is pinned when your first paying invoice is reserved and stays pinned.
- Registration and production API-token management are self-serve; no contact-sales form is required. A human still creates the workspace and completes any account authorization.

Read the canonical [machine-readable pricing contract](https://plainrouter.com/pricing.md) for the exact billing rule and feature matrix.

## Inspect the codebase before installing anything

1. Identify the server runtime, package manager, existing HTTP client, environment-variable conventions, and test framework.
2. Confirm whether the task needs the Conversion API or an MCP connection. These surfaces use different credentials.
3. Keep Plainrouter calls on the server. Do not put a workspace Signals secret, workspace execution token, or OAuth token in browser code.
4. Read the repository's own `AGENTS.md` and local rules before changing files.

## Connect an account and preview

Sign up free at [Plainrouter](https://plainrouter.com/register), authorize access and connect an ad account. Then call `dry_run_actions` to preview a proposed change against account policy and admission without writing.

## Choose the client that matches the repository

| Codebase               | Official client                                       | Install                                               |
| ---------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
| Node.js or TypeScript  | `@plainrouter/sdk@0.10.1`         | `npm install @plainrouter/sdk@0.10.1`      |
| Python 3.11 or newer   | `plainrouter==0.10.1`             | `python -m pip install plainrouter==0.10.1`          |
| PHP 8.2 or newer       | `plainrouter/sdk:0.4.1`                | `composer require plainrouter/sdk:0.4.1`             |
| Ruby 3.2 or newer      | `plainrouter-sdk 0.6.1`               | `gem install plainrouter-sdk -v 0.6.1`            |
| Go 1.23 or newer       | `github.com/plainrouter/sdk-go@v0.7.1`                 | `go get github.com/plainrouter/sdk-go@v0.7.1`              |
| Another server runtime | REST with the signed OpenAPI contract                 | `https://plainrouter.com/openapi.json`                |
| Shell automation       | `@plainrouter/cli@0.10.1`            | `npm install --global @plainrouter/cli@0.10.1`         |
| Shell with Python      | `plainrouter==0.10.1`           | `pipx install plainrouter==0.10.1`        |

Do not replace a repository's established HTTP stack merely to add an SDK. If the codebase already generates a client from OpenAPI or wraps server requests consistently, extend that pattern.

## Configure production authentication

Read [auth.md](https://plainrouter.com/auth.md) before choosing a credential.

- For the Signals Conversion API, REST, the TypeScript SDK, the Python SDK, the PHP SDK, the Ruby SDK, the Go SDK, and the CLI use the Signals bearer secret for one workspace. Actions REST (`/api/v1/agent/workspaces/{workspace}/actions...`) requires a Write workspace key with an active grant covering `propose-actions`.
- For MCP, first create a workspace key in **Settings → Workspace keys**, then configure the MCP client with `https://plainrouter.com/mcp` and the key as its bearer credential.
- OAuth management credentials are read-only discovery credentials and cannot authenticate the Conversion API or MCP tool calls.

For a server-side Conversion API integration, reference the workspace Signals secret through the codebase's secret manager as `PLAINROUTER_TOKEN`. Do not commit it, print it, include it in a URL, expose it to the browser, or copy it into a fixture.

TypeScript example:

```typescript
import { configurePlainrouter, listEvents } from '@plainrouter/sdk';

configurePlainrouter({
    signalTrackerSecret: process.env.PLAINROUTER_TOKEN!,
});

const result = await listEvents({
    query: { per_page: 25 },
});
```

Use the [Conversion API documentation](https://plainrouter.com/api/docs) and signed [OpenAPI contract](https://plainrouter.com/openapi.json) for request and response fields. Do not infer fields from examples or send browser-derived consent data without preserving the captured consent evidence defined by the contract.

## Make writes retry-safe

- Supply a stable `event_id` or `Idempotency-Key` for a conversion write. If both are present, they must match.
- Preserve the same idempotency value across retries.
- Treat HTTP `202` as newly accepted and HTTP `200` with `duplicate: true` as an idempotent replay.
- Fix `400` and `422` requests before retrying. Stop on `401` or `403` and ask the human to review the credential or scope.
- Respect `Retry-After` on `429`. Retry safe reads and idempotent writes after `5xx` only with bounded backoff.

## Verify the integration

1. Add a focused test using the repository's HTTP mocking or fake-server pattern.
2. Assert the base URL, bearer header injection, response parsing, idempotency behavior, and caller-visible failures.
3. Run the codebase's normal type, format, unit, and integration checks.
4. Search the final diff for credentials, production payloads, and accidental browser exposure.
5. Do not use a production Plainrouter endpoint as a smoke test unless the human explicitly requests that exact verification.

Report which files changed, which client or REST surface you selected, which checks passed, and which production credential or human step remains pending. Local checks alone do not establish that a connected account is configured.

## If the task is MCP instead of code integration

The [Plainrouter MCP quickstart](https://plainrouter.com/quickstart-mcp.md) covers signup, authorization, account connection and `dry_run_actions` previews.

## Reference

- [Authentication](https://plainrouter.com/auth.md)
- [Coding-agent guide](https://plainrouter.com/.well-known/agents.md)
- [Public SDK and agent-integration repository](https://github.com/plainrouter/sdk)
- [Conversion API documentation](https://plainrouter.com/api/docs)
- [OpenAPI 3.1 specification](https://plainrouter.com/openapi.json)

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
